public override IItemRenderer Clone() { return(new ItemBlockModelRenderer(_block, Model, _resource) { Vertices = (VertexPositionColorTexture[])Vertices.Clone() }); }
public override IItemRenderer Clone() { return(new ItemBlockModelRenderer(_block, Model, null, _resource) { Vertices = (VertexPositionNormalTextureColor[])Vertices.Clone(), Indexes = (short[])Indexes.Clone() }); }
public override IItemRenderer Clone() { return(new ItemBlockModelRenderer(_block, Model, null, _resource) { Vertices = (BlockShaderVertex[])Vertices.Clone(), Indexes = (short[])Indexes.Clone() }); }
public override IItemRenderer Clone() { return(new ItemBlockModelRenderer(_blockState, Model, _texture) { Vertices = (VertexPositionColorTexture[])Vertices.Clone(), Size = Size }); }
public override IItemRenderer Clone() { return(new ItemModelRenderer(Model) { Vertices = Vertices.Clone() as VertexPositionColor[], // Indexes = Indexes.ToArray() }); }
public override ShapeBase Clone() { var shape = new Line { Location = Location, Size = Size, DrawMethod = DrawMethod, OutlineColor = OutlineColor, OutlineWidth = OutlineWidth, FillColor = FillColor, Vertices = (VertexCollection)Vertices.Clone() }; return(shape); }
public override ShapeBase Clone() { var shape = new IsoscelesTriangle { Location = Location, Size = Size, DrawMethod = DrawMethod, OutlineColor = OutlineColor, OutlineWidth = OutlineWidth, FillColor = FillColor, IsClosedFigure = IsClosedFigure, Vertices = (VertexCollection)Vertices.Clone() }; return(shape); }
/// <summary> /// Gets a new mesh instance with vertices and indices clone. /// </summary> /// <returns></returns> public Mesh <V> Clone() { V[] newVertices = Vertices.Clone() as V[]; int[] newIndices = Indices.Clone() as int[]; return(new Mesh <V>(newVertices, newIndices, this.Topology, Slices)); }
/// <summary> /// Changes a mesh to another object with different topology. For instance, from a triangle mesh to a wireframe (lines). /// </summary> public Mesh <V> ConvertTo(Topology topology) { switch (topology) { case Topology.Triangles: switch (this.Topology) { case Topology.Triangles: return(this.Clone()); // No necessary change case Topology.Lines: // This problem is NP. // Try to implement a greedy, that means, recognize the small triangle and so on... throw new NotImplementedException("Missing implementing line-to-triangle conversion."); case Topology.Points: throw new NotImplementedException("Missing implementing point-to-triangle conversion."); } break; case Topology.Lines: switch (this.Topology) { case Topology.Points: // Get the wireframe from surface reconstruction return(ConvertTo(Topology.Triangles).ConvertTo(Topology.Lines)); case Topology.Lines: return(this.Clone()); // nothing to do case Topology.Triangles: { // This is repeating edges for adjacent triangles.... use a hash table to prevent for double linking vertices. V[] newVertices = Vertices.Clone() as V[]; int[] newIndices = new int[Indices.Length * 2]; int index = 0; for (int i = 0; i < Indices.Length / 3; i++) { newIndices[index++] = Indices[i * 3 + 0]; newIndices[index++] = Indices[i * 3 + 1]; newIndices[index++] = Indices[i * 3 + 1]; newIndices[index++] = Indices[i * 3 + 2]; newIndices[index++] = Indices[i * 3 + 2]; newIndices[index++] = Indices[i * 3 + 0]; } return(new Mesh <V>(newVertices, newIndices, Topology.Lines)); } } break; case Topology.Points: { V[] newVertices = Vertices.Clone() as V[]; int[] indices = new int[newVertices.Length]; for (int i = 0; i < indices.Length; i++) { indices[i] = i; } return(new Mesh <V>(newVertices, indices, Topology.Points)); } } throw new ArgumentException("Wrong topology."); }