Sign in to follow this  
Kinju

One mesh composed by several materials/textures

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this