Sign in to follow this  

Multiple Object Best Approach?

This topic is 4337 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

Hi, I was wondering if any of you could just give me some suggestions on how to do this. Any help is appreciated! I want to do something similar to the Direct3DLight system. I want to have a unique ID for different types of terrains. For instance, terrain 1 could be a 3D Brute Force mesh terrain while terrain 2 could be a isometric terrain, both could be loaded and ready to go, but I would only enable and draw one at a time. So, my question is about the approach in storing the terrain data. I have a List template that will store items by name and return an index for the item. So, if you create a mesh, give it a name, it is stored by name and returns index 1 let's say. I want to use that approach with the terrains, but each terrain class will be very different. Should I do like Microsoft and pass in a data structure that contains all of the needed data along with the terrain type? I thought about using object inheritance, but none of the terrain types will have the same generation function or anything else for that matter. Is there a way to do that cleanly while still keeping my List object that assigns a unique ID to each terrain generated, no matter what type it is? Thanks! Chris

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hi Supernat02,

could you please give us some (pseudo)code depicting the way you think it should be done? it's a bit hard to understand for me what you want to achieve right now.

cheers,
simon

Share this post


Link to post
Share on other sites
I think I have a solution now. Sorry that it was confusing. Basically, I just wanted to use the same template list to store multiple classes. I was just over complicating things. I'm going to just create a base Terrain class and pass that to the templated list. The base Terrain type will only contain an enumeration for the type of terrain, which I can then use to cast the base Terrain pointer to the proper terrain. Other suggestions are still welcome though.

Thanks!

Share this post


Link to post
Share on other sites

This topic is 4337 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.

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

Sign in to follow this