Organising models, meshes, materials, textures and shaders
Hi,
I'm redesigning the Model classes in my engine to something more structured.
Here is a proposed design:
- MODEL class: Contains pointer to a MESH object, and position/rotation information
- MESH class: Contains mesh data, animation data, UV coords, pointers to MATERIAL objects
- MATERIAL class: Contains colour info, UV tiling/offset, pointer to texture object, pointer to SHADER object
- TEXTURE class: Just a GLuint
- SHADER class: Just a CgEffect object
Where appropriate, file loading is done through a resource manager.
Can anyone foresee any problems?
Should I really separate the MESH class from the MATERIAL class, or have it all in one?
Is it wise to have a shader belong to a material?
Thanks in advance for any feedback
Sounds pretty good to me, just one note, you might want to add the ANIMATION resource and have mesh optionally contain a pointer to that, now you can also reference your animiations across mesh the same way you reference materials. Set to NULL and this mesh has no animation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement