Tuesday, May 17, 2005

I added the vertex/index buffer interface to the MBGraphics component of the MBLib library. It is divided into two sections: pools and buffers. I wanted this interface to be very simple at getting up and running while maintaining high standards in performance.

Pools

There are two pools: MBGraphics_VertexBufferPool and MBGraphics_IndexBufferPool. The purpose of the pools is to have a central location for managing the existence of and access to the buffers needed by an application. The client is able to interface with a particular buffer through the buffer's id. All buffer ids are supplied to the client when they are allocated in the pool. From there it becomes the responsibility of the client to organize and manage them.

Buffers

There are two buffers: MBGraphics_VertexBuffer and MBGraphics_IndexBuffer. The vertex buffer is used to store vertex information about a mesh object. The index buffer is used to reference vertices loaded in a vertex buffer describing how those vertices are supposed to be connected. A vertex buffer can be used without an index buffer, but it is highly advantageous to use an index buffer to cutback on the memory usage. Index buffers must reference a vertex buffer (at this point in time) in order to be used by the renderer.

Another important advantage is all buffers take advantage of the Direct3D Managed Pool system. This take the responsibility of having to recover lost vertex data during lost device situations. The disadvantage is because Direct3D maintains a system copy of the data, the memory use is doubled. I chose this route because I wanted the use of this system to be simple, and one less thing the client has to worry about is a big plus to me.

Conclusion

This system is still a work in progress, but I am very pleased at its current state. It is fast and very simple and flexible to use. Once the MBGraphics component of the MBLib has been completed, i will provide a series of brief tutorials on how to use it. I speculate this component being the largest out of all the other planned components. Stay tuned! There is plenty more to come...


OOH OOH EEH EEH

No comments: