/// <summary> /// Creates the vertex buffer which includes all four ring fixup vertices. /// There is a fixup on each side of the level, in the middle. /// </summary> /// <param name="pGraphicsDevice"></param> private void CreateSharedVertexBuffer(GraphicsDevice pGraphicsDevice) { // create vertices TerrainVertex.Shared[] pVertices = new TerrainVertex.Shared[Settings.EDGE_STITCHES_NUM_VERTICES]; int nCounter = 0; // bottom side for (short x = 0; x < Settings.GRID_SIZE_N; x++) { pVertices[nCounter++] = new TerrainVertex.Shared(x, 0); } // right side for (short y = 1; y < Settings.GRID_SIZE_N; y++) { pVertices[nCounter++] = new TerrainVertex.Shared(Settings.GRID_SIZE_N_MINUS_ONE, y); } // top side for (short x = Settings.GRID_SIZE_N_MINUS_ONE - 1; x >= 0; x--) { pVertices[nCounter++] = new TerrainVertex.Shared(x, Settings.GRID_SIZE_N_MINUS_ONE); } // left side for (short y = Settings.GRID_SIZE_N_MINUS_ONE - 1; y >= 0; y--) { pVertices[nCounter++] = new TerrainVertex.Shared(0, y); } // create shared vertex buffer m_pSharedVertexBuffer = new VertexBuffer( pGraphicsDevice, TerrainVertex.Shared.VertexDeclaration, Settings.EDGE_STITCHES_NUM_VERTICES, BufferUsage.None); m_pSharedVertexBuffer.SetData(pVertices); }
private void CreateSharedVertexBuffer(GraphicsDevice pGraphicsDevice, WhichInteriorTrim eWhichInteriorTrim) { // create vertices TerrainVertex.Shared[] pVertices = new TerrainVertex.Shared[Settings.INTERIOR_TRIM_NUM_VERTICES]; switch (eWhichInteriorTrim) { case WhichInteriorTrim.TopLeft: PopulateVerticesTopLeft(pVertices); break; case WhichInteriorTrim.TopRight: PopulateVerticesTopRight(pVertices); break; case WhichInteriorTrim.BottomLeft: PopulateVerticesBottomLeft(pVertices); break; case WhichInteriorTrim.BottomRight: PopulateVerticesBottomRight(pVertices); break; } // create shared vertex buffer m_pSharedVertexBuffers[(int) eWhichInteriorTrim] = new VertexBuffer( pGraphicsDevice, TerrainVertex.Shared.VertexDeclaration, Settings.INTERIOR_TRIM_NUM_VERTICES, BufferUsage.None); m_pSharedVertexBuffers[(int) eWhichInteriorTrim].SetData(pVertices); }
/// <summary> /// Creates the vertex buffer for the bottom right interior trim /// </summary> /// <param name="pGraphicsDevice"></param> private void PopulateVerticesBottomRight(TerrainVertex.Shared[] pVertices) { int nCounter = 0; // bottom segment for (short y = Settings.BLOCK_SIZE_M_MINUS_ONE; y < Settings.BLOCK_SIZE_M + 1; y++) { for (short x = Settings.BLOCK_SIZE_M_MINUS_ONE; x < Settings.GRID_SIZE_N - Settings.BLOCK_SIZE_M_MINUS_ONE; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // right segment for (short y = Settings.BLOCK_SIZE_M; y < (3 * Settings.BLOCK_SIZE_M); y++) { for (short x = Settings.GRID_SIZE_N - Settings.BLOCK_SIZE_M - 1; x < Settings.GRID_SIZE_N - Settings.BLOCK_SIZE_M_MINUS_ONE; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } }
/// <summary> /// Creates the vertex buffer which includes all four ring fixup vertices. /// There is a fixup on each side of the level, in the middle. /// </summary> /// <param name="pGraphicsDevice"></param> private void CreateSharedVertexBuffer(GraphicsDevice pGraphicsDevice) { // create vertices TerrainVertex.Shared[] pVertices = new TerrainVertex.Shared[Settings.RING_FIXUPS_NUM_VERTICES]; int nCounter = 0; // left side for (short y = Settings.BLOCK_SIZE_M_MINUS_ONE * 2; y < (Settings.BLOCK_SIZE_M_MINUS_ONE * 2) + 3; y++) { for (short x = 0; x < Settings.BLOCK_SIZE_M; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // top side for (short y = Settings.GRID_SIZE_N_MINUS_ONE - Settings.BLOCK_SIZE_M_MINUS_ONE; y < Settings.GRID_SIZE_N; y++) { for (short x = Settings.BLOCK_SIZE_M_MINUS_ONE * 2; x < (Settings.BLOCK_SIZE_M_MINUS_ONE * 2) + 3; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // right side for (short y = Settings.BLOCK_SIZE_M_MINUS_ONE * 2; y < (Settings.BLOCK_SIZE_M_MINUS_ONE * 2) + 3; y++) { for (short x = Settings.GRID_SIZE_N_MINUS_ONE - Settings.BLOCK_SIZE_M_MINUS_ONE; x < Settings.GRID_SIZE_N; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // bottom side for (short y = 0; y < Settings.BLOCK_SIZE_M; y++) { for (short x = Settings.BLOCK_SIZE_M_MINUS_ONE * 2; x < (Settings.BLOCK_SIZE_M_MINUS_ONE * 2) + 3; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // create shared vertex buffer m_pSharedVertexBuffer = new VertexBuffer( pGraphicsDevice, TerrainVertex.Shared.VertexDeclaration, Settings.RING_FIXUPS_NUM_VERTICES, BufferUsage.None); m_pSharedVertexBuffer.SetData<TerrainVertex.Shared>(pVertices); }
private void CreateSharedVertexBuffer(GraphicsDevice pGraphicsDevice) { // create vertices TerrainVertex.Shared[] pVertices = new TerrainVertex.Shared[Settings.BLOCK_NUM_VERTICES]; int nCounter = 0; for (short y = 0; y < Settings.BLOCK_SIZE_M; y++) { for (short x = 0; x < Settings.BLOCK_SIZE_M; x++) { // write shared data pVertices[nCounter++] = new TerrainVertex.Shared(x, y); } } // create shared vertex buffer m_pSharedVertexBuffer = new VertexBuffer( pGraphicsDevice, TerrainVertex.Shared.VertexDeclaration, Settings.BLOCK_NUM_VERTICES, BufferUsage.None); m_pSharedVertexBuffer.SetData<TerrainVertex.Shared>(pVertices); }