Added ignoreHeightmap option to compositions in Compositions.xml.

This commit is contained in:
Steffen 2015-01-17 12:24:54 +01:00
parent 02a9cd7559
commit 147ae17789
2 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<!-- Marble -->
<composition>
<typeID>20</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>marbleSmooth.obj</modelPath>
<xOffset>0.0</xOffset>
@ -14,6 +15,7 @@
<!-- Block -->
<composition>
<typeID>40</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>block.obj</modelPath>
<xOffset>0.0</xOffset>
@ -27,6 +29,7 @@
<!-- Column -->
<composition>
<typeID>60</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>column.obj</modelPath>
<xOffset>0.0</xOffset>
@ -40,6 +43,7 @@
<!-- Torch with Lightsource -->
<composition>
<typeID>80</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>torch.obj</modelPath>
<xOffset>0.0</xOffset>
@ -62,6 +66,7 @@
<!-- Lightsource -->
<composition>
<typeID>85</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<light>
<xOffset>0.0</xOffset>
<yOffset>1</yOffset>
@ -76,6 +81,7 @@
<!-- Block on 2 Pillars -->
<composition>
<typeID>100</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>column.obj</modelPath>
<xOffset>0.0</xOffset>
@ -105,6 +111,7 @@
<!-- Switch -->
<composition>
<typeID>120</typeID>
<ignoreHeightmap>false</ignoreHeightmap>
<object>
<modelPath>switch_inner.obj</modelPath>
<xOffset>0.0</xOffset>
@ -123,13 +130,14 @@
</object>
</composition>
<!-- Static Block -->
<!-- Bridge Block -->
<composition>
<typeID>140</typeID>
<typeID>140</typeID>
<ignoreHeightmap>true</ignoreHeightmap>
<object>
<modelPath>block.obj</modelPath>
<xOffset>0.0</xOffset>
<yOffset>10.0</yOffset>
<yOffset>20.0</yOffset>
<zOffset>2.0</zOffset>
<scale>1.5</scale>
<mass>0.0</mass>

View File

@ -207,10 +207,13 @@ void Level::load() {
errorCheck(thisComposition->FirstChildElement("xRot")->QueryFloatText(&compRot[0]));
errorCheck(thisComposition->FirstChildElement("yRot")->QueryFloatText(&compRot[1]));
errorCheck(thisComposition->FirstChildElement("zRot")->QueryFloatText(&compRot[2]));
glm::vec3 compPos = glm::vec3(compXPos,
compYOffset+terrain.getHeightmap()[int(compXPos-0.5+0.5*terrain.getHeightmapHeight())]
[int(compZPos-0.5+0.5*terrain.getHeightmapWidth())],
compZPos);
bool ignoreHeightmap;
errorCheck(composition->FirstChildElement("ignoreHeightmap")->QueryBoolText(&ignoreHeightmap));
if (!ignoreHeightmap){
compYOffset = compYOffset+terrain.getHeightmap()[int(compXPos-0.5+0.5*terrain.getHeightmapHeight())]
[int(compZPos-0.5+0.5*terrain.getHeightmapWidth())];
}
glm::vec3 compPos = glm::vec3(compXPos, compYOffset, compZPos);
objectOffset = objectOffset * compScale;
glm::vec4 rotatedObjectOffset = glm::rotate(compRot.x, glm::vec3(1.0f, 0.0f, 0.0f))
* glm::rotate(compRot.y, glm::vec3(0.0f, 1.0f, 0.0f))