Turned the heightmap loading around so the level now is like the png. The wall backsides dont seem to have textures...

This commit is contained in:
Steffen Fündgens 2015-02-27 16:53:46 +01:00
parent cf75a9c2a8
commit 2d872c644e
8 changed files with 7028 additions and 7028 deletions

View File

@ -69,19 +69,19 @@ int main( int argc, char *argv[] ){
}
printf("Iterating over the png.\n");
//iterate over all pixels of the image
for(unsigned int rowNum = 0; rowNum < height; rowNum++){
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
for(unsigned int rowNum = 0; rowNum < height; rowNum++){
unsigned int pixel = (rowNum*width+columnNum)*4;
//if there is a composition here, adjust the xml and image
if(image[pixel]!=0 && image[pixel]!=255){
if(image[pixel+1]==0 && image[pixel+2]==0){//composition has no ID
std::vector<int> newID;
newID = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
newID = conv.newComposition(image[pixel], 0.5+columnNum-0.5*width, 0.5+rowNum-0.5*height);
idFound[newID[0]][newID[1]] = true;
image[pixel+1] = newID[0];
image[pixel+2] = newID[1];
}else{//composition has an ID
conv.updateComposition(image[pixel+1], image[pixel+2], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
conv.updateComposition(image[pixel+1], image[pixel+2], 0.5+columnNum-0.5*width, 0.5+rowNum-0.5*height);
idFound[image[pixel+1]][image[pixel+2]] = true;
}
}

View File

@ -226,7 +226,7 @@
<yOffset>20.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<yRot>90.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>
@ -243,7 +243,7 @@
<yOffset>20.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>90.0</yRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>
@ -264,7 +264,7 @@
<yOffset>20.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<yRot>90.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>
@ -314,7 +314,7 @@
<yOffset>20.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>90.0</yRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>
@ -364,7 +364,7 @@
<yOffset>25.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<yRot>90.0</yRot>
<zRot>0.0</zRot>
<scale>1.48</scale>
<mass>0.0</mass>
@ -381,7 +381,7 @@
<yOffset>25.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>90.0</yRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.48</scale>
<mass>0.0</mass>
@ -415,7 +415,7 @@
<yOffset>25.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>0.0</yRot>
<yRot>90.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>100.0</mass>
@ -432,7 +432,7 @@
<yOffset>25.0</yOffset>
<zOffset>0.0</zOffset>
<xRot>0.0</xRot>
<yRot>90.0</yRot>
<yRot>0.0</yRot>
<zRot>0.0</zRot>
<scale>1.5</scale>
<mass>0.0</mass>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

File diff suppressed because it is too large Load Diff

View File

@ -8283,7 +8283,7 @@
<rColour>1.0</rColour>
<gColour>1.0</gColour>
<bColour>0.9</bColour>
<intensity>0.2</intensity>
<intensity>0.6</intensity>
</directionalLight>
<terrain>

View File

@ -10,9 +10,9 @@ function trigger(objectToChange)
end
local strength = 100
local xPos = 81.5
local xPos = 17.5
local yPos = 35
local zPos = 17.5
local zPos = 81.5
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
global.triggeredOpenFirstDoorUndo = false

View File

@ -10,9 +10,9 @@ function trigger(objectToChange)
end
local strength = 100
local xPos = 81.5
local xPos = 17.5
local yPos = 25
local zPos = 17.5
local zPos = 81.5
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
global.triggeredOpenFirstDoor = false

View File

@ -18,11 +18,11 @@ void Terrain::load() {
if (error) {
std::cout << "Decoder error " << error << " from Terrain::load: " << lodepng_error_text(error) << std::endl;
}
this->heightmap = new float*[this->heightmapHeight]; //initialize the heightmap
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]) / 6; //<--heightmap is scaled here
this->heightmap = new float*[this->heightmapWidth]; //initialize the heightmap
for(unsigned int columnNum = 0; columnNum < this->heightmapWidth; columnNum++){ //read in the heightmap
this->heightmap[columnNum] = new float[this->heightmapHeight];
for(unsigned int rowNum = 0; rowNum < this->heightmapHeight; rowNum++){
this->heightmap[columnNum][rowNum] = (float)(image[(rowNum*heightmapWidth+columnNum)*4]) / 6; //<--heightmap is scaled here
}
}
this->makeTriangleMesh();