Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

creating a class for rockets, should i use a static for the models mesh?

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

building a game , which has rockets in it , this will be a class , that has life time , vectors and stuff.
but all instances of this class will have the same mesh.

so i was thinking would it be bes to declare it as static, other wise it will load in meshes which it does not have to .

or is there a better way

Share this post


Link to post
Share on other sites
Advertisement
You are talking about a generic problem ("reuse certain resources") and one specific approach for solving it ("make them static"). In my opinion, there's nothing wrong with the static approach, as long as you can pull it off without getting into order of initialization troubles. However, you should be aware that this problem can be solved in a variety of different ways. For example, you could introduce a resource manager class that makes sure resources are only loaded once. You can find plenty of information (articles, forum discussions...) about resource management on this site.

Share this post


Link to post
Share on other sites
You don't have to declare your rockets static just to use a single mesh.
There are many ways to avoid this, but one would be your class having a reference of some sort, maybe a number or a real reference or pointer, to a mesh.
Why not create a simple mesh manager class, which you can index your meshes in?

Edit: ^ too slow! -although a resource manager is more general. Probably a better idea to start off with that, you can always inherit to more specific loaders and managers.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!