Files
BlitzNext/Runtime/blitz3d/terrain.cpp
T

49 lines
929 B
C++
Raw Normal View History

2014-01-31 08:23:00 +13:00
2019-01-18 15:55:06 +01:00
#include "terrain.hpp"
2019-01-18 17:04:17 +01:00
#include "std.hpp"
2019-01-18 15:55:06 +01:00
#include "terrainrep.hpp"
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
Terrain::Terrain(int size_shift) : rep(new TerrainRep(size_shift)) {}
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
Terrain::~Terrain()
{
2014-01-31 08:23:00 +13:00
delete rep;
}
2019-01-18 17:04:17 +01:00
void Terrain::setDetail(int n, bool m)
{
rep->setDetail(n, m);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
void Terrain::setShading(bool t)
{
rep->setShading(t);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
void Terrain::setHeight(int x, int z, float h, bool realtime)
{
if (x >= 0 && z >= 0 && x <= rep->getSize() && z <= rep->getSize())
rep->setHeight(x, z, h, realtime);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
int Terrain::getSize() const
{
2014-01-31 08:23:00 +13:00
return rep->getSize();
}
2019-01-18 17:04:17 +01:00
float Terrain::getHeight(int x, int z) const
{
return (x >= 0 && z >= 0 && x <= rep->getSize() && z <= rep->getSize()) ? rep->getHeight(x, z) : 0;
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
bool Terrain::render(const RenderContext& rc)
{
rep->render(this, rc);
2014-01-31 08:23:00 +13:00
return false;
}
2019-01-18 17:04:17 +01:00
bool Terrain::collide(const Line& line, float radius, Collision* curr_coll, const Transform& tf)
{
return rep->collide(line, radius, curr_coll, tf);
2014-01-31 08:23:00 +13:00
}