Exemple #1
0
        private void prepareFaceData(ref Mesh mesh)
        {
            List <VertexDataSet> vertexDataList = new List <VertexDataSet>();

            foreach (Face face in mesh.FaceList)
            {
                foreach (Vertex vertex in face.Vertices)
                {
                    VertexDataSet vertexData = new VertexDataSet();
                    vertexData.position = PositionDataList[vertex.Vi];
                    vertexData.normal   = NormalDataList[vertex.Ni];
                    vertexData.texture  = TexCoordDataList[vertex.Ti];

                    vertexDataList.Add(vertexData);
                }
            }

            int vertNum = vertexDataList.Count;

            mesh.PositionData = new Vector3[vertNum];
            mesh.NormalData   = new Vector3[vertNum];
            mesh.TexCoordData = new Vector2[vertNum];

            for (int i = 0; i < vertexDataList.Count; i++)
            {
                mesh.PositionData[i] = vertexDataList[i].position;
                mesh.NormalData[i]   = vertexDataList[i].normal;
                mesh.TexCoordData[i] = vertexDataList[i].texture;
            }
        }
Exemple #2
0
 public bool Equals(VertexDataSet vert)
 {
     threshold = 0.0001f;
     if ((this.position - vert.position).LengthFast < threshold &&
         (this.texture - vert.texture).LengthFast < threshold &&
         (this.normal - vert.normal).LengthFast < threshold)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }