Additional changes with the heightmap

This commit is contained in:
sfroitzheim 2015-01-16 16:37:00 +01:00
parent 2c0d4424a2
commit a83e6155b3
11 changed files with 3397 additions and 85 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -123,6 +123,19 @@
</object>
</composition>
<!-- Static Block -->
<composition>
<typeID>140</typeID>
<object>
<modelPath>block.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>10.0</yOffset>
<zOffset>2.0</zOffset>
<scale>1.5</scale>
<mass>0.0</mass>
</object>
</composition>
@ -136,7 +149,7 @@
<shininess>3.0</shininess>
<physicType>Player</physicType>
<radius>1.5</radius>
<dampningL>0.1</dampningL>
<dampningL>0.3</dampningL>
<dampningA>0.7</dampningA>
</objectData>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

View File

@ -81,7 +81,7 @@ void Level::load() {
Material terrainMaterial = Material("seamlessTerrain.png", 0.1f, 0.8f, 0.2f, 3.0f);
//Create object
Object* terrainObject = new Object(terrainModel, terrainMaterial,
glm::vec3(-0.5f*(float)this->terrain.getHeightmapHeight(), 0.0f, -0.5f*(float)this->terrain.getHeightmapWidth()),
glm::vec3(-0.5*(float)this->terrain.getHeightmapHeight(), 0.0f, -0.5f*(float)this->terrain.getHeightmapWidth()),
glm::vec3(0.0f, 0.0f, 0.0f));
objects.push_back(terrainObject);

View File

@ -22,7 +22,7 @@ void Terrain::load() {
for(unsigned int rowNum = 0; rowNum < this->heightmapHeight; rowNum++){ //read in the heightmap
this->heightmap[rowNum] = new float[this->heightmapWidth];
for(unsigned int columnNum = 0; columnNum < this->heightmapWidth; columnNum++){
this->heightmap[rowNum][columnNum] = (float)(image[(rowNum*heightmapWidth+columnNum)*4]) / 8; //<--heightmap is scaled here
this->heightmap[rowNum][columnNum] = (float)(image[(rowNum*heightmapWidth+columnNum)*4]) / 6; //<--heightmap is scaled here
}
}