Exemple #1
0
	void InitPerHeightRadius(int a_GridX, int a_GridZ)
	{
		int h = 0;
		while (h < cChunkDef::Height)
		{
			m_Noise.SetSeed(m_Seed + h);
			int rnd = m_Noise.IntNoise2DInt(a_GridX, a_GridZ) / 13;
			int NumBlocks = (rnd % 3) + 2;
			rnd = rnd / 4;
			float Val = (float)(rnd % 256) / 128 - 1;  // Random float in range [-1, +1]
			if (h + NumBlocks > cChunkDef::Height)
			{
				NumBlocks = cChunkDef::Height - h;
			}
			for (int i = 0; i < NumBlocks; i++)
			{
				m_PerHeightRadius[h + i] = Val;
			}
			h += NumBlocks;
		}
	}