Increase scale to massive

This commit is contained in:
2016-05-23 20:50:30 +02:00
parent 24a9ccd7fa
commit 28d5c06c7f
2 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -12,6 +12,8 @@ HeightMap::HeightMap(const std::string &file)
int bpp;
unsigned char* imgData = stbi_load(file.c_str(), &width, &height, &bpp, 4);
int scale = 50;
for (int h = 0; h < height; h++)
{
for (int w = 0; w < width; w++)
@@ -22,7 +24,7 @@ HeightMap::HeightMap(const std::string &file)
float y = ((float)imgData[((h + offsets[i][0]) + (w + offsets[i][1]) * width) * 4]);
y = (y / 256.0f) * 100.0f;
vertices.push_back(Vertex{ (float)(h + offsets[i][0]), y, (float)(w + offsets[i][1]),
vertices.push_back(Vertex{ (float)(h + offsets[i][0])*scale, y*scale, (float)(w + offsets[i][1])*scale,
0, 1, 0,
(h + offsets[i][0]) / (float)height, (w + offsets[i][1]) / (float)width } );
}
+3 -3
View File
@@ -63,7 +63,7 @@ void display()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0f, (float)width/height, 0.1, 5000);
gluPerspective(60.0f, (float)width/height, 0.1, 15000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -123,7 +123,7 @@ void idle()
float deltaTime = frameTime - lastFrameTime;
lastFrameTime = frameTime;
const float speed = 50;
const float speed = 500;
if (keys['a']) move(0, deltaTime*speed);
if (keys['d']) move(180, deltaTime*speed);
if (keys['w']) move(90, deltaTime*speed);
@@ -186,7 +186,7 @@ int main(int argc, char* argv[])
glutKeyboardUpFunc(keyboardUp);
glutPassiveMotionFunc(mousePassiveMotion);
heightmap = new HeightMap("worlds/hell.png");
heightmap = new HeightMap("worlds/HMCSHeightmap.gif");
cubeVertices.push_back(Vertex{ -1, -1, -1, 0,0,1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, -1, 0,0,1, 1,1,1,1 });