public void FromGenMesh(GraphicsDevice _gd, GenMesh _mesh, bool _bComputeBounds) { //Clear GPU Buffers ClearGPUVBOBuffers(); //Init m_npartsCount = 0; for (int i = 0; i < _mesh.m_genMeshParts.Count; i++) { GenMeshPart part = _mesh.m_genMeshParts[i]; MeshGPUPart partGPU = m_meshParts[i]; //Vertices partGPU.m_gpuVertexBuffer = new VertexBuffer(_gd, typeof(VertexPosColorNorm), part.m_vertices.Count, BufferUsage.WriteOnly); partGPU.m_gpuVertexBuffer.SetData(part.m_vertices.ToArray(), 0, part.m_vertices.Count); //Indices partGPU.m_gpuIndexBuffer = new IndexBuffer(_gd, typeof(ushort), part.m_indices.Count, BufferUsage.WriteOnly); partGPU.m_gpuIndexBuffer.SetData(0, part.m_indices.ToArray(), 0, part.m_indices.Count); m_npartsCount++; } }
public CubeBrush(Game _game, int _sizeX, int _sizeY, int _sizeZ, bool _createDummy) { Game = _game; //Array size SetSize(_sizeX, _sizeY, _sizeZ); //Create a plane at bottom if (_createDummy) { SmallCube cube = new SmallCube(); cube.byMatL0 = 16; int x, y, z; y = 0; for (x = 0; x < _sizeX; x++) { for (z = 0; z < _sizeZ; z++) { m_array.SetCube(x, y, z, cube); } } } //Create Palette BuildDefaultColorPalette(); //Meshes m_genMesh = new GenMesh(); }
public CubeBrush(Game _game, CubeArray3D _carray, Color[] _palette) { Game = _game; //Set Palette m_colPalette = _palette; //Set Array m_array = _carray; InitFromNewArray(); //Meshes m_genMesh = new GenMesh(); }