Merge branch 'master' of github.com:Faerbit/swp

This commit is contained in:
Faerbit 2015-02-27 23:34:33 +01:00
commit 3807e2d869
13 changed files with 16915 additions and 13377 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: 4.1 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

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

@ -157,7 +157,7 @@ void Physics::addTerrain(int width, int length, float** heightData) //The terrai
info.m_restitution = 0;
btRigidBody* tBody = new btRigidBody(info);
tBody->getWorldTransform().setOrigin(btVector3(0,((float)highest)/2,0)); //we have to move the origin of our rigid body down, because bullet sets the origin (0,0,0) at (width/2, height/2, length/2) in the map the x and z are correct in our level, but y needs to be addapted
tBody->getWorldTransform().setOrigin(btVector3(-0.5,((float)highest)/2,-0.5)); //we have to move the origin of our rigid body down, because bullet sets the origin (0,0,0) at (width/2, height/2, length/2) in the map the x and z are correct in our level, but y needs to be addapted
terrainBody = tBody;
if (world == NULL) {

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();

View File

@ -7,7 +7,7 @@
#include "model.hh"
class Terrain {
public:
Terrain(std::string levelNum);
Terrain(std::string heightmapFilePath);
Terrain();
~Terrain();
void load();