Spikey path fixed

This commit is contained in:
Dofensmirtsz
2016-05-31 08:46:33 +02:00
parent 6f28527be4
commit ae5a28f273
11 changed files with 426 additions and 8 deletions
+6 -2
View File
@@ -39,9 +39,13 @@ HeightMap::HeightMap(const std::string &file, float scale, World* world)
Vec3f ca(0, heightAt(x, y + 1) - heightAt(x, y), 1);
Vec3f ba(1, heightAt(x + 1, y) - heightAt(x, y), 0);
if (valueAt(x, y, GREEN) > 0)
if ((valueAt(x, y, GREEN) >= 200) && (valueAt(x, y, GREEN) <= 240))
{
world->addLevelObject(new LevelObject(world->getObjectFromValue(valueAt(x, y, GREEN)), Vec3f(x*scale, heightAt(x, y), y*scale), Vec3f(0, rand()%360, 0), 1, true));
world->addLevelObject(new LevelObject(world->getObjectFromValue(valueAt(x, y, GREEN)), Vec3f(x*scale, heightAt(x, y), y*scale), Vec3f(0, 0, 0), 1, false));
}
if (valueAt(x, y, GREEN) == 190)
{
world->addLevelObject(new LevelObject(world->getObjectFromValue(valueAt(x, y, GREEN)), Vec3f(x*scale, heightAt(x, y), y*scale), Vec3f(0, 0, 0), 1, false));
}
Vec3f normal = ca.cross(ba);