|
DirectX 8 Programming TutorialPossible values: D3DFILL_POINT, D3DFILL_WIREFRAME, D3DFILL_SOLID m_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); Fig 8.2 Now that we have a flat grid, we can turn this into a simple terrain by setting a random value for y for each vertex. I've done this for each vertex in the grid except the ones that are around the edge so that the four edges are all the same level. If you want to create a more detailed terrain, have a look at where there is a tutorial on how to generate a random fractal terrain. Fig 8.3 below shows the grid with random y values. Fig 8.3 The last thing to do is apply a grass texture to the terrain and set the render state to solid rather than wireframe. Once you have done this, you should end up with a scene that looks like the screenshot below. Summary In this tutorial we've look at index buffers and how they can make a massive saving on how many vertices need to be processed. In the next tutorial we will look at how to create other shapes such as spheres, cylinders and cones ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|