Пример #1
0
        private long AddVertex(FaceVertex fv, Vixen.Mesh mesh)
        {
            Vertex v = new Vertex(mesh.VertexSize);

            float[] p = _vertices[fv.VertexIndex - 1];
            long    n = _numverts;
            long    i = 0;

            v.data[i]     = p[0];
            v.data[i + 1] = p[1];
            v.data[i + 2] = p[2];
            i            += 3;
            if (_normals.Count > 0)
            {
                p             = _normals[fv.NormalIndex - 1];
                v.data[i]     = p[0];
                v.data[i + 1] = p[1];
                v.data[i + 2] = p[2];
            }
            else
            {
                v.data[i]     = 0;
                v.data[i + 1] = 0;
                v.data[i + 2] = 0;
            }
            i += 3;
            if (_textures.Count > 0)
            {
                long ti = (fv.TextureIndex - 1) * 2;
                v.data[i + 1] = _textures[ti];
                v.data[i + 2] = _textures[ti + 1];
            }
            if (_vtxcache.ContainsKey(v))
            {
                return(_vtxcache[v]);
            }
            _vtxcache.Add(v, n);
            ++_numverts;
            return(n);
        }
Пример #2
0
 public void AddVertex(FaceVertex vertex)
 {
     _vertices.Add(vertex);
 }