Original Post
I''ve just been playing around with a bit of design and I''m running into headaches left and right.
I''m trying to design a simple engine with the following ideas:
-All objects are linked or parented in some way such that you can get to every object by traversing a linked list.
-Rendering code is abstracted so that the engine doesn''t become dependent on a particular API.
-The engine itself consists of a few items which define the world, and also some controllers (like texture managers, font engine and such).
I''m wondering about two things here. Trying to abstract the API is giving me a hard time because I''m not sure how to handle the loading of textures and such so that they would be compatible with different APIs. Initially I though I''d store just the bitmap array data, but then I realized that I''m losing all kinds of info that I need like compression. Also storing all textures in memory doesn''t seem like a good idea, and I need some kind of efficient way of requesting a texture and keeping common ones in memory.
Another issues is the sorting of all objects. I can get to every object by starting at the root, but its not the best order for drawing them. Perhaps you guys have some pointers on how I might use texture id''s to render objects using the same texture... and also ideas on how to sort the objects for rendering.
Basically the root node is everything. It splits into 3d and 2d... 2d would be UI elements and such that get drawn. I''m thinking using some kind of panel system to group UI elements for easy transformation and such would work well. So in my linked list I''d add a panel to the interface node, and I''d add text and other UI controls to the panel. That way I could move, scale, rotate a panel easily.
One issue with the panels that is driving me nuts is do I want to treat all 2d elements as 3d objects? If so, is there a more efficient way of drawing them then to texture a rectangle? I''m thinking that if I have a rectangle for each character and each element, I''d be dealing with a lot of geometry since each object would require 4 vertexes and such (2 polys).
I''m just looking for some general pointers, ideas, concepts to intergate into my design.
Appreciate all your input guys,
Aaron