Example #1
0
        private void StoreMeshData <TVertex>(TVertex[] vertices, int[] indices, dReal[] normals)
        {
            ReleaseDataStores();
            verticesData = new DataHandle(vertices.Length * Marshal.SizeOf(typeof(TVertex)));
            indicesData  = new DataHandle(indices.Length * Marshal.SizeOf(typeof(int)));

            float[] floatVertices = vertices as float[];
            if (floatVertices != null)
            {
                verticesData.Copy(floatVertices);
            }

            double[] doubleVertices = vertices as double[];
            if (doubleVertices != null)
            {
                verticesData.Copy(doubleVertices);
            }

            indicesData.Copy(indices);
            if (normals != null)
            {
                normalsData = new DataHandle(normals.Length * Marshal.SizeOf(typeof(int)));
                normalsData.Copy(normals);
            }
        }