/// <summary> /// Creates a member-wise copy of the specified TerrainPage. /// </summary> /// <param name="page">The TerrainPage to copy.</param> public TerrainPage(TerrainPage page) { if (page != null) { _name = page._name; _position = page._position; _scale = page._scale; _rotation = page._rotation; _renderable = page._renderable; _maxVertexHeight = page._maxVertexHeight; _patch = new TerrainPatch(page._patch); } else { Dispose(); _patch = new TerrainPatch(); } }
/// <summary> /// Creates a member-wise copy of the specified TerrainPage. /// </summary> /// <param name="page">The TerrainPage to copy.</param> public TerrainPage( TerrainPage page ) { if ( page != null ) { _name = page._name; _position = page._position; _scale = page._scale; _rotation = page._rotation; _renderable = page._renderable; _maxVertexHeight = page._maxVertexHeight; _patch = new TerrainPatch( page._patch ); } else { Dispose(); _patch = new TerrainPatch(); } }
/// <summary> /// Creates a member-wise copy of the specified TerrainPatch. /// </summary> /// <param name="patch">The TerrainPatch to copy.</param> public TerrainPatch(TerrainPatch patch) { if (patch != null) { _rows = patch._rows; _columns = patch._columns; _numIndices = patch._numIndices; _numVertices = patch._numVertices; _refreshBuffers = patch._refreshBuffers; _refreshVertices = patch._refreshVertices; _nearestVertices = patch._nearestVertices; _height = patch._height; _width = patch._width; _verticesSelected = patch._verticesSelected; _numChangedVertices = patch._numChangedVertices; _numSelectedVertices = patch._numSelectedVertices; _selectedTexture = patch._selectedTexture; // Copy list of texture coordinates _texCoords = new ArrayList(); for (int i = 0; i < patch._texCoords.Count; i++) { Vector2[] texCoords = new Vector2[((Vector2[]) patch._texCoords[i]).Length]; for (int j = 0; j < texCoords.Length; j++) { texCoords[j] = new Vector2( ((Vector2[])patch._texCoords[i])[j].X, ((Vector2[])patch._texCoords[i])[j].Y); } _texCoords.Add(texCoords); } // Copy textures _textures = new ArrayList(); for (int i = 0; i < patch._textures.Count; i++) { _textures.Add(new Texture((Texture)patch._textures[i])); } // Copy vertices if (patch._vertices != null) { _vertices = new CustomVertex.PositionNormal[patch._vertices.Length]; for (int i = 0; i < _vertices.Length; i++) { _vertices[i].Position = patch._vertices[i].Position; _vertices[i].Normal = patch._vertices[i].Normal; } } else { _vertices = null; } // Copy indices if (patch._indices != null) { _indices = new short[patch._indices.Length]; for (int i = 0; i < _indices.Length; i++) { _indices[i] = patch._indices[i]; } } else { _indices = null; } // Copy list of changed vertices if (patch._changedVertices != null) { _changedVertices = new bool[patch._changedVertices.Length]; for (int i = 0; i < _changedVertices.Length; i++) { _changedVertices[i] = patch._changedVertices[i]; } } else { _changedVertices = null; } // Copy list of selected vertices if (patch._selectedVertices != null) { _selectedVertices = new bool[patch._selectedVertices.Length]; for (int i = 0; i < _selectedVertices.Length; i++) { _selectedVertices[i] = patch._selectedVertices[i]; } } else { _selectedVertices = null; } } else { Dispose(); } }
/// <summary> /// Initialize a TerrainPage object. /// </summary> public TerrainPage() { Dispose(); _patch = new TerrainPatch(); }
/// <summary> /// Creates a member-wise copy of the specified TerrainPatch. /// </summary> /// <param name="patch">The TerrainPatch to copy.</param> public TerrainPatch( TerrainPatch patch ) { if ( patch != null ) { _rows = patch._rows; _columns = patch._columns; _numIndices = patch._numIndices; _numVertices = patch._numVertices; _refreshBuffers = patch._refreshBuffers; _refreshVertices = patch._refreshVertices; _nearestVertices = patch._nearestVertices; _height = patch._height; _width = patch._width; _verticesSelected = patch._verticesSelected; _numChangedVertices = patch._numChangedVertices; _numSelectedVertices = patch._numSelectedVertices; _selectedTexture = patch._selectedTexture; // Copy list of texture coordinates _texCoords = new ArrayList(); for ( int i = 0; i < patch._texCoords.Count; i++ ) { Vector2[] texCoords = new Vector2[( (Vector2[]) patch._texCoords[i] ).Length]; for ( int j = 0; j < texCoords.Length; j++ ) texCoords[j] = new Vector2( ( (Vector2[]) patch._texCoords[i] )[j].X, ( (Vector2[]) patch._texCoords[i] )[j].Y); _texCoords.Add( texCoords ); } // Copy textures _textures = new ArrayList(); for ( int i = 0; i < patch._textures.Count; i++ ) _textures.Add( new Texture( (Texture) patch._textures[i] ) ); // Copy vertices if ( patch._vertices != null ) { _vertices = new CustomVertex.PositionNormal[patch._vertices.Length]; for ( int i = 0; i < _vertices.Length; i++ ) { _vertices[i].Position = patch._vertices[i].Position; _vertices[i].Normal = patch._vertices[i].Normal; } } else _vertices = null; // Copy indices if ( patch._indices != null ) { _indices = new short[patch._indices.Length]; for ( int i = 0; i < _indices.Length; i++ ) _indices[i] = patch._indices[i]; } else _indices = null; // Copy list of changed vertices if ( patch._changedVertices != null ) { _changedVertices = new bool[patch._changedVertices.Length]; for ( int i = 0; i < _changedVertices.Length; i++ ) _changedVertices[i] = patch._changedVertices[i]; } else _changedVertices = null; // Copy list of selected vertices if ( patch._selectedVertices != null ) { _selectedVertices = new bool[patch._selectedVertices.Length]; for ( int i = 0; i < _selectedVertices.Length; i++ ) _selectedVertices[i] = patch._selectedVertices[i]; } else _selectedVertices = null; } else Dispose(); }
/// <summary> /// Initialize a TerrainPage object. /// </summary> public TerrainPage() { Dispose(); _patch = new TerrainPatch(); }