Đang chuẩn bị liên kết để tải về tài liệu:
Multi-Threaded Game Engine Design phần 7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Về mặt kỹ thuật, card video rasterizes tất cả các đầu ra trả lại dựa trên các thiết lập ma trận chiếu của chúng tôi. Tuy nhiên, trong bối cảnh của chương này, ma rasterization là một thuật ngữ thích hợp bởi vì ID3DXSprite làm cho các hình dạng hình chữ nhật bằng cách sử dụng chiếu trực giao. | 340 Simpor PDF.Merge ancLSplitcUnregistered Versioryrhttp www.simpopdf.com The type of texture we need is for a regular plane. Perlin has support for seamless texture generation and can even generate sphere textures with the correct stretching applied to the poles so the texture looks correct wrapped on a sphere. We used this technique in Starflight The Lost Colony www .starflightgame.com to generate random planets. noise utils NoiseMapBuilderPlane heightMapBuilder Next we tell our heightmap object to use the Perlin object for it s random algorithms set the destination to the noise map object and set the width and height of the data set. heightMapBuilder.SetSourceModule perlin heightMapBuilder.SetDestNoiseMap noiseMap heightMapBuilder.SetDestSize width length Finally we have to tell the heightmap object where on the Cartesian coordinate system it should base its calculations for tiling purposes. Tiling is an advanced feature that I won t get into here because we just don t need it but I encourage you to look into it if you want to generate a huge game world without consuming huge amounts of memory. After setting the bounds to the upperright quadrant we can then build the random data. heightMapBuilder.SetBounds 0.0 5.0 0.0 5.0 heightMapBuilder.Build At this point we have the data needed to apply height data to a terrain vertex buffer. To get at the data access the GetValue function in NoiseMap. float value noiseMap.GetValue x z The value coming from Perlin will be fairly small so it s normally multiplied by the desired height value to bring the terrain up from the sub-1.0 range into a tangible height. Finally if you would like to save the height data to a texture libnoise can do that as well. Just to be clear it s normal to add the noise namespace to simplify variable declarations so I ll include it here for reference. using namespace noise utils RendererImage renderer utils Image image renderer.SetSourceNoiseMap noiseMap Simpo PDF Merge and Split Unregistered .

TÀI LIỆU LIÊN QUAN