SHARE
TWEET
Untitled
a guest
Dec 20th, 2014
3
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- const int maxTessellationLevel = 64;
- const int trianglesPerHeightSample = 10;
- const int xDivisions = trianglesPerHeightSample * TILE_WIDTH / CHUNKS / maxTessellationLevel;
- const int zDivisions = trianglesPerHeightSample * TILE_HEIGHT / CHUNKS / maxTessellationLevel;
- int patchCount = xDivisions * zDivisions;
- QVector<float> positionData(2 * patchCount); // 2 floats per vertex
- const float dx = 1.0f / MathHelper::toFloat(xDivisions);
- const float dz = 1.0f / MathHelper::toFloat(zDivisions);
- for(int j = 0; j < 2 * zDivisions; j += 2)
- {
- float z = MathHelper::toFloat(j) * dz * 0.5;
- for(int i = 0; i < 2 * xDivisions; i += 2)
- {
- float x = MathHelper::toFloat(i) * dx * 0.5;
- const int index = xDivisions * j + i;
- positionData[index] = x;
- positionData[index + 1] = z;
- }
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

