TD Engine optimalization

Published April 28, 2010
Advertisement
So I've started to work through the list of optimalizations and bug fixes I want in place before I move to the shader implementation.

First thing I did was to attack #2 on my list. I implemented a renderInfo factory that checks the nodetype and makes sure that the same node type only get a reference to the same renderInfo. I had to handle som special cases. For example I have NODE_OBJECT, NODE_ELEMENT, NODE_ANIMATED_MESH and NODE_STATIC_MESH. Certainly these node types wouldn't all hold the same renderInfo. So, I reserved 100 indexes for each type, and let the base object of each type handle offsetting the node type.

Handling the meshes were a bit different, since I couldn't know if two mesh nodes share the same renderInfo until a file-load is being initiated, so I wrote that meshFactory I spoke of in #6, that also makes sure that the same filename isn't loaded twice. I give each unique mesh an id, and use this id to offset the nodetype. This seems to work great :)

I also changed the way I create and work with VBOs a bit. Before I had one dedicated vbo per array for each renderInfo. This means I had 5 vbos for handling index, vertex, normal, texcoord and color arrays. I merged the last four into a single VBO with offsetting using glBufferSubData. This actually gave me a significant speed increase of close to 100%! (though that speed increase might have been affected by the other changes I've done as well).

I also implemented load awareness in the texture manager, so that I only load a single copy of the same texture file.

In addition I went into the mesh node wrapping and reserved space in the vectors, and did the same thing for the grid node initialization. Quite hard to say, but this should optimize loading times a bit.

So, next on my list is to fix the mesh node wrapper so that I can 1) support multiple mesh groups and 2) store the normals and texcoords correctly! It will be awesome when I have this working!
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