Page 470 OpenGL Super Bible! n[0][1] = ny (Database web hosting)

Page 470 OpenGL Super Bible! n[0][1] = ny / d; n[0][2] = nz / d; }; /* * Set the top row of normals to be the same as the second -to* last row of normals. */ for (x = 0; x < TERRAIN_SIZE; x ++, n ++) { n[0][0] = n[-TERRAIN_SIZE][0]; n[0][1] = n[-TERRAIN_SIZE][1]; n[0][2] = n[- TERRAIN_SIZE][2]; }; } /* * 'InitializeTerrain() - Initialize the terrain arrays */ void InitializeTerrain(void) { int x, y; /* Terrain (x,y) location */ /* * Fill the terrain array with grass */ TerrainCurrent = IDC_WATER; for (y = 0; y < TERRAIN_SIZE; y ++) for (x = 0; x < TERRAIN_SIZE; x ++) { TerrainType[y][x] = IDC_GRASS; TerrainHeight[y][x] = GRASS_HEIGHT + 0.1 * (rand() % 5); }; /* * Update the lighting normals */ UpdateNormals(); } /* * 'draw_cell() - Draw (fill-in) a single terrain cell */ void draw_cell(int x, /* I - Terrain X location */ int y) /* I - Terrain Y location */ { /*
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply