Sign in to follow this  
  • entries
    45
  • comments
    44
  • views
    50131

Beautiful code part 3 - bottom up design

Sign in to follow this  
Norman Barrows

1052 views

Beautiful code part 3 - bottom up design

an example of beautiful code using bottom up design.

with this method, you start with the lowest level stuff, then add higher level layers until you have a sufficiently high level API.

so you go from ugly low level stuff to a beautiful high level API.

This example uses the directx 9 skinned mesh code from tiny.cpp and DXUT.h macros at the low level:

https://www.gamedev.net/blog/1729/entry-2261223-skinned-mesh-code-part-1-low-level-microsoft-code/

probably not what most folks would call beautiful code. but that's the low level API i had to start with.

first step was a wrapper layer API to "beautify" things a bit:

https://www.gamedev.net/blog/1729/entry-2261224-skinned-mesh-code-part-2-rockland-skinned-mesh-api/

a little better, but still kind of ugly, given all the various routines for the different skinning methods. it should really be split up into separate API's, one for each skinning method.

mesh and controller pools were required. being new APIs, they turned out to be relatively simple and beautiful:

https://www.gamedev.net/blog/1729/entry-2261225-skinned-mesh-code-part-3-mesh-and-controller-memory-pools/

and finally, one routine to rule them all: draw_skinmesh_caveman

https://www.gamedev.net/blog/1729/entry-2261227-skinned-mesh-code-part-4-implementation-example/

https://www.gamedev.net/blog/1729/entry-2261228-skinned-mesh-code-part-5-implementation-example-2/

so all that ugly code has been beautified into the single API call draw_skinmesh_caveman
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now