Merge branch 'master' of github.com:Faerbit/swp
This commit is contained in:
commit
3807e2d869
@ -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 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;
|
||||
}
|
||||
}
|
||||
|
@ -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.
16234
data/levels/Level1.xml
16234
data/levels/Level1.xml
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.
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
10
terrain.cc
10
terrain.cc
@ -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();
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "model.hh"
|
||||
class Terrain {
|
||||
public:
|
||||
Terrain(std::string levelNum);
|
||||
Terrain(std::string heightmapFilePath);
|
||||
Terrain();
|
||||
~Terrain();
|
||||
void load();
|
||||
|
Loading…
Reference in New Issue
Block a user