Пример #1
0
 public VertexInfoSimple(VertexInfoSimple copy)
 {
     this.m_position   = copy.m_position;
     this.m_textureUV  = copy.m_textureUV;
     this.m_textureUV2 = copy.m_textureUV2;
     this.m_normal     = copy.m_normal;
     this.m_color      = copy.m_color;
 }
Пример #2
0
 public int NextIndex()
 {
     if (index == array.Length)
     {
         VertexInfoSimple[] newArray = new VertexInfoSimple[array.Length * 2];
         array.CopyTo(newArray, 0);
         array = newArray;
     }
     return(index++);
 }
            private void AddFace(Mesh m, ushort faceIndex)
            {
                Tuple <ushort, ushort, ushort, ushort> face = face_array[faceIndex];
                VertexInfoSimple v1 = m.smesh.vertexBuffer.array[face.Item1];
                VertexInfoSimple v2 = m.smesh.vertexBuffer.array[face.Item2];
                VertexInfoSimple v3 = m.smesh.vertexBuffer.array[face.Item3];

                Vec3 normal = (v3.m_position.Vec3() - v1.m_position.Vec3()).normalize().Cross((v2.m_position.Vec3() - v1.m_position.Vec3()).normalize()).normalize();

                AddNormal(face.Item1, m, face.Item1, normal);
                AddNormal(face.Item2, m, face.Item2, normal);
                AddNormal(face.Item3, m, face.Item3, normal);
                m.m_indexBuffer.Add(face.Item1);
                m.m_indexBuffer.Add(face.Item3);
                m.m_indexBuffer.Add(face.Item2);
            }
Пример #4
0
        public void Add(VertexInfoSimple v)
        {
            int index = NextIndex();

            array[index] = v;
        }