public GLMesh(GLMesh source, GLAvatar av) : base(source.Name) { this.av = av; // Make a new GLMesh copy from the supplied source RenderData.Vertices = new float[source.RenderData.Vertices.Length]; RenderData.Normals = new float[source.RenderData.Normals.Length]; RenderData.TexCoords = new float[source.RenderData.TexCoords.Length]; RenderData.Indices = new ushort[source.RenderData.Indices.Length]; RenderData.weights = new float[source.RenderData.weights.Length]; RenderData.skinJoints = new string[source.RenderData.skinJoints.Length]; Array.Copy(source.RenderData.Vertices, RenderData.Vertices, source.RenderData.Vertices.Length); Array.Copy(source.RenderData.Normals, RenderData.Normals, source.RenderData.Normals.Length); Array.Copy(source.RenderData.TexCoords, RenderData.TexCoords, source.RenderData.TexCoords.Length); Array.Copy(source.RenderData.Indices, RenderData.Indices, source.RenderData.Indices.Length); Array.Copy(source.RenderData.weights, RenderData.weights, source.RenderData.weights.Length); Array.Copy(source.RenderData.skinJoints, RenderData.skinJoints, source.RenderData.skinJoints.Length); RenderData.Center = new Vector3(source.RenderData.Center); teFaceID = source.teFaceID; _rotationAngles = new Vector3(source.RotationAngles); _scale = new Vector3(source.Scale); _position = new Vector3(source.Position); // We should not need to instance these the reference from the top should be constant _evp = source._evp; _morphs = source._morphs; OrigRenderData.Indices = new ushort[source.RenderData.Indices.Length]; OrigRenderData.TexCoords = new float[source.RenderData.TexCoords.Length]; OrigRenderData.Vertices = new float[source.RenderData.Vertices.Length]; OrigRenderData.Normals = new float[source.RenderData.Normals.Length]; MorphRenderData.Vertices = new float[source.RenderData.Vertices.Length]; MorphRenderData.Normals = new float[source.RenderData.Normals.Length]; Array.Copy(source.RenderData.Vertices, OrigRenderData.Vertices, source.RenderData.Vertices.Length); Array.Copy(source.RenderData.Vertices, MorphRenderData.Vertices, source.RenderData.Vertices.Length); Array.Copy(source.RenderData.Normals, OrigRenderData.Normals, source.RenderData.Normals.Length); Array.Copy(source.RenderData.Normals, MorphRenderData.Normals, source.RenderData.Normals.Length); Array.Copy(source.RenderData.TexCoords, OrigRenderData.TexCoords, source.RenderData.TexCoords.Length); Array.Copy(source.RenderData.Indices, OrigRenderData.Indices, source.RenderData.Indices.Length); }
public GLAvatar() { lock (_defaultmeshes) foreach (KeyValuePair<string, GLMesh> kvp in _defaultmeshes) { GLMesh mesh = new GLMesh(kvp.Value, this); // Instance our meshes _meshes.Add(kvp.Key, mesh); } }