Ejemplo n.º 1
0
        public void AddUV(Vector2 uv)
        {
            DynamicSubMesh dynamicSubMesh = Meshes[UVMeshIdx];

            if (dynamicSubMesh.AreUVsFull())
            {
                dynamicSubMesh = Meshes[++UVMeshIdx];
            }
            dynamicSubMesh.AddUV(uv);
        }
Ejemplo n.º 2
0
        public void AddVertex(Vector3 vertex)
        {
            DynamicSubMesh dynamicSubMesh = Meshes[VertexMeshIdx];

            if (dynamicSubMesh.AreVerticesFull())
            {
                dynamicSubMesh = Meshes[++VertexMeshIdx];
            }
            dynamicSubMesh.AddVertex(vertex);
        }
Ejemplo n.º 3
0
        public void AddTriangle(int triangle)
        {
            DynamicSubMesh dynamicSubMesh = Meshes[TriangleMeshIdx];

            if (dynamicSubMesh.AreTrianglesFull())
            {
                dynamicSubMesh = Meshes[++TriangleMeshIdx];
            }
            Meshes[TriangleMeshIdx].AddTriangle(triangle);
        }
Ejemplo n.º 4
0
        public void Reserve(int vertex_count, int triangle_count)
        {
            if (vertex_count > VertexCount)
            {
                SetUVs = true;
            }
            else
            {
                SetUVs = false;
            }
            if (TriangleCount != triangle_count)
            {
                SetTriangles = true;
            }
            else
            {
                SetTriangles = false;
            }
            int num = (int)Mathf.Ceil((float)triangle_count / (float)TrianglesPerMesh);

            if (num != Meshes.Length)
            {
                Meshes = new DynamicSubMesh[num];
                for (int i = 0; i < Meshes.Length; i++)
                {
                    int idx_offset = -i * VerticesPerMesh;
                    Meshes[i] = new DynamicSubMesh(Name, Bounds, idx_offset);
                }
                SetUVs       = true;
                SetTriangles = true;
            }
            for (int j = 0; j < Meshes.Length; j++)
            {
                if (j == Meshes.Length - 1)
                {
                    Meshes[j].Reserve(vertex_count % VerticesPerMesh, triangle_count % TrianglesPerMesh);
                }
                else
                {
                    Meshes[j].Reserve(VerticesPerMesh, TrianglesPerMesh);
                }
            }
            VertexCount   = vertex_count;
            TriangleCount = triangle_count;
        }