Copies of Textures of 3d meshes in .x files

Started by
2 comments, last by Zantagor 19 years, 2 months ago
Well in my game I have loaded more than 30 meshes and made one or more mesh objects. The meshes are of .x(dot ex format!hehe) and the texture names are embeded in them.But all the meshes are having same bitmap texture My question is that if I am loading all the meshes seperately will dx load the same texture 30 times or keep only one copy of the texture?

Got a Game? Get Reviews and Links.Free and Honest Publicity never Hurts!ITnauts.com

Advertisement
DX doesn't load the textures, you do so do the right thing.
Stay Casual,KenDrunken Hyena
Thankyou very much :)

Got a Game? Get Reviews and Links.Free and Honest Publicity never Hurts!ITnauts.com

You can do like I did, and have a ResourceManager class that handles that.

mine currently handles the model loading only, I have to modify my model loading class to do the same with the textures...

anyway, what I did was something like
CModel* MyModel = ResourceManager::GetInstance->GetModel("MyModel.x")

what GetModel does is find the "MyModel.x" in a map container, if it doesn't find it, it loads the .X file and stores the model pointers in the map. So it doesn't get loaded twice.

When you're loading the textures, you could do the same. first search in a Map that contains all textures already loaded, if it ain't found, load and add.

You can also add a RefNum to your model/texture objects, so that you can know how many mesh/textures are currently in "use" so you don't delete one that is still in use.

This topic is closed to new replies.

Advertisement