Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualBlackJoker

Posted 23 March 2013 - 08:47 AM

Sorry for my 1st post, I was in despair. I try to explain all detail.

 

1. I write my own converter from collada (blender and 3s max) to my binary format on C#.

2. That binary format I load in my engine.

3. Converter work fine and even can triangulate non-triangulated meshes and engine display all of them correctly. You can see it on attached screen shot 1.

I use class with 3 lists o store 3 array indices, but they are not optimized. They just written as they are in COLLADA file. I want to use correct index buffer to save memory.

 

I construct from those 3 arrays of indices  one mesh. And it works. Code here



for (int i = 0; i < indexvector3.Vertices.Count; i++)
                    {
                       
                        constructedMesh.Vertices.Add(tempMesh.Vertices[indexvector3.Vertices[i]]);
                    }
                    for (int i = 0; i < indexvector3.Normals.Count; i++)
                    {
         
                        constructedMesh.Normals.Add(tempMesh.Normals[indexvector3.Normals[i]]);
                    }
                    for (int i = 0; i < indexvector3.Texcoords.Count; i++)
                    {
   
                        constructedMesh.Textures.Add(tempMesh.Textures[indexvector3.Texcoords[i]]);
                    }

 

But when I use algorithm from my 1st message for creating index array I have some problems with my models. They all are broken. This you can see on screen shots 2 and 3.

 

P.S I use for

(int j = i + 1; j < indexvector3.Vertices.Count; j++)

because I compare in second and 3rd cycles previous value with current. There is no need add unnecessary pass through the loop.


#1BlackJoker

Posted 23 March 2013 - 08:01 AM

Sorry for my 1st post, I was in despair. I try to explain all detail.

 

1. I write my own converter from collada (blender and 3s max) to my binary format on C#.

2. That binary format I load in my engine.

3. Converter work fine and even can triangulate non-triangulated meshes and engine display all of them correctly. You can see it on attached screen shot 1.

I use class with 3 lists o store 3 array indices, but they are not optimized. They just written as they are in COLLADA file. I want to use correct index buffer to save memory.

 

I construct from those 3 arrays of indices  one mesh. And it works. Code here

for (int i = 0; i < indexvector3.Vertices.Count; i++)
                    {
                       
                        constructedMesh.Vertices.Add(tempMesh.Vertices[indexvector3.Vertices[i]]);
                    }
                    for (int i = 0; i < indexvector3.Normals.Count; i++)
                    {
         
                        constructedMesh.Normals.Add(tempMesh.Normals[indexvector3.Normals[i]]);
                    }
                    for (int i = 0; i < indexvector3.Texcoords.Count; i++)
                    {
   
                        constructedMesh.Textures.Add(tempMesh.Textures[indexvector3.Texcoords[i]]);
                    }

 

But when I use algorithm from my 1st message for creating index array I have some problems with my models. They all are broken. This you can see on screen shots 2 and 3.


PARTNERS