Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to come up with my Model/Object structure and I'm having a hard time figuring it out.

I have a ResourceModule which is responsible for managing resources, and it has a vector of Meshes. Each mesh has a single VBO/IBO and Material. An object can contain multiple meshes.

Then, when my Model asks for the ResourceModule for a resource, I check if it's already loaded in the vector and return a pointer to it, if it isn't I parse the DATA files and return a stream.

Using as example a sword, the blade would be a mesh with textureA, the hilt would be another mesh with textureB, and the Object would contain both meshes. Both of these meshes are loaded in memory and kept in the vector inside the ResourceModule.

But in this example, the blade mesh has to be positioned above the hilt, and the hilt below the blade so it "fits" perfectly. This means they need to have an Orientation/Position class to keep their positioning, but then what about the object's Orientation?

I think this might be going wrong because the matrix multiplications are increasing exponentially to my depth of elements, such as:

VehicleMatrix -> PlayerMatrix -> HandMatrix -> SwordMatrix -> BladeMatrix / HiltMatrix + how much elements my Object has

How is this usually done? Any suggestions?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.