Good or Bad Idea - Placing Texture2D inside class
There probably is a better way all together but here's what I've been doing. I've been keeping my textures inside several dictionaries and each polygon can hold a string to a texture. When I look up textures I use the polygon's string.
I was thinking, wouldn't it be easier to just use a reference to the texture I'm using and avoid the lookup in general?
Here is how it's normally done:
the game has a collection of TextureResource's which hold the d3d/opengl texture & the textures name as a string.
the game also has a collection of Meshes which each have a Material and some materials reference a TextureResource and/or the texture directly using a pointer.
if you want to save a mesh, you can find out the texture name by looking for the texture in your resource collection.
the game has a collection of TextureResource's which hold the d3d/opengl texture & the textures name as a string.
the game also has a collection of Meshes which each have a Material and some materials reference a TextureResource and/or the texture directly using a pointer.
if you want to save a mesh, you can find out the texture name by looking for the texture in your resource collection.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement