Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Beautiful code part 3 - bottom up design

Sign in to follow this  
Norman Barrows


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:


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:


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:


and finally, one routine to rule them all: draw_skinmesh_caveman



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


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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!