Пример #1
0
        private void ProcessPrimitive(EditablePrimitiveInfo primitive)
        {
            int firstVert = verts.Count;
            int vertCount = primitive.VertexCount;

            for (int i = 0; i < vertCount; i++)
            {
                var vert = primitive.vertices[i];
                verts.Add(vert.position);
                uvs.Add(vert.uv);
                normals.Add(vert.normal);
                colors.Add(vert.color);
            }

            int triIndex = indices.Count / 3;

            triangleIndexToPrimitive[triIndex++] = primitive;
            indices.Add(firstVert);
            indices.Add(firstVert + 1);
            indices.Add(firstVert + 2);
            if (vertCount > 3)
            {
                triangleIndexToPrimitive[triIndex] = primitive;
                indices.Add(firstVert + 2);
                indices.Add(firstVert + 1);
                indices.Add(firstVert + 3);
            }
        }
Пример #2
0
        public void UpdatePrimitive(EditablePrimitiveInfo info, EditorMaterial mat)
        {
            this.info     = info;
            this.Material = mat;

            for (int i = 0; i < 4; i++)
            {
                vertObjs[i].transform.localPosition = info.vertices[i].position;
            }

            UpdateMesh();
        }
Пример #3
0
        public EditablePrimitiveInfo Copy()
        {
            var copy = new EditablePrimitiveInfo
            {
                norm     = norm,
                norm2    = norm2,
                area     = area,
                room     = room,
                paddy    = paddy,
                polyType = polyType,
            };

            for (int i = 0; i < 4; i++)
            {
                copy.vertices[i] = vertices[i].Copy();
            }

            return(copy);
        }
Пример #4
0
 public void RemovePrimitive(EditablePrimitiveInfo primitive)
 {
     primitives.Remove(primitive);
 }
Пример #5
0
 public void AddPrimitive(EditablePrimitiveInfo primitive)
 {
     primitives.Add(primitive);
 }