Beautiful code part 3 - bottom up design

posted in Gamedev info
Published June 30, 2015
Advertisement
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
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement