Jump to content
  • Advertisement
Sign in to follow this  
Kinju

One mesh composed by several materials/textures

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

Hi all, I have a model that have only one geometry to display with one material and one texture to use. Now, I have to load a model witch have a geometry composed by several materials and several textures. For each material/texture, I have the triangle list to draw. So, I would like if I have to see : 1 - "a model have a list of geometries that have their own vertex data, material and texture to use. The drawing function draw the geometries one by one" 2 - "a model have one only geometry. For each material and texture, the model number of the first vertex in the buffer to draw and the number of triangles to draw" In the first point of view, I will have something like: Geometry::Draw() { //Set the vertex buffer //Set the index buffer //Set the declaration //Set the material //Set the texture //Draw x triangles } Model::Draw() { foreach(Geometry oGeo in m_Geometries) oGeo.Draw(); } In the second point of view I will have something like: Model::Draw() { //Set the vertex buffer //Set the index buffer //triangles = 0 foreach(Subset oSub in m_oSubset) { //Set the subset material //Set the subset texture //Set the subset declaration //Draw triangles from "triangles" to "triangles" + subset triangle count //triangles += subset triangle count } } In good practice, how geometries with several materials/textures/vertex type are managed ? Thanks for your help, Aurélien

Share this post


Link to post
Share on other sites
Advertisement
I worked with Cal3d recently and it worked quite exactly as you said. A Model with several materials was devided into subsets and was rendered using said algorythm

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!