Jump to content
  • Advertisement
Sign in to follow this  

Index/Vertex Buffer Management Class

This topic is 5005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I'm currently rewriting my game engine as I've now decided to move away from standard heightmap terrain in the game I'm writing for my portfolio in an effort to write a game that can be finished in a more realistic timeframe. So I'm now writing a vamped up bomberman clone in 3D (I know my ideas change on a daily basis but I've decided to definitely stick with this one!!). Now I'm basing the game around sewer tunnels and cleaning robots that have turned nasty. The cleaning robots will be futuristic bio-mechanical characters that will move around the map with intertia due to their anti-grav propulsion, so I get some chance to showcase some more physics in the game as well. Anyhoo the game design is not too important here, but goes to illustrate what I'm trying to achieve with my buffer manager. That is that I am going to write a wrapper for directX to make it much easier to gte something on the screen. I'm going to write a class that will store indices and vertices. It will be able to assign the indices and vertices to (for the time being) quads and triangles. I will include a function to create a regular grided plane of vertices (like a heightmap). A function to create a circle of vertices (for use as a cursor). I will include various functions like these that will simplify the job of creating basic game geometry. I shall also include the ability to assign groups of vertices/quads/triangles such that different groups can have separate operations performed upon them. Then within these groups I will allow the ability to assign a specific texture(s) and shaders forming sub-groups. Finally I will add functionality to allow for mouse ray casting to be performed upon the geometry. Now to the point! I plan to allow the user to create a map by using the class function to create a regular gridded (flat) heightmap. The class will handle the mouse input to detect which triangle the cursor is pointing at. based on the response of the class I will then use the class to highlight the triangle that the mouse is pointing at and if the mouse is clicked, I will get the class to make the triangle visible. I will add functionality to store adjacency data, so then I can check if the triangle has any active triangles around it. If it doesn't have an adjacent triangle on any one egde, then I will add a wall segment on that edge facing towards the active triangle. I then figure that I can use the class in another edit mode to determine which floor or wall segment is being selected by the mouse and then select the texture in the editor, which will tell the class to assign the wall or floor tile that particular texture. The class can then handle assigning that tile a particular subgroup within the larger groups of floor and wall tiles. I figure that once I get past the initial work of writing this class, creating the game and the editor will be a real triviality and will produce very nice readable code to get a map up and running. Now I'm sorry this has been so long winded, but I just wondered if this sounds like a reasonable design for a class, or would you be tempted to include any further useful functions in the class to do this job. Perhaps you think it is overkill and the class should not be using so many functions? Personally I like the idea and think that it would be nice to have a class that could create and render a flat heightmap with only 2 function calls or so.... even if I only use the class 2 or 3 times I think it would have saved a lot of repetition of vertex buffer locking, index buffer locking, working out the indices and vertices to create a grid... etc etc. So what do you think... good, bad, or has potential?

Share this post

Link to post
Share on other sites
Sign in to follow this  

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