X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fterrain.h;fp=source%2F3d%2Fterrain.h;h=2cd98540d991f4f055d2f48a6c4a5ea312fed744;hb=2220ba2f11705ea9a4e480603d43ab7ed4cf5a89;hp=0000000000000000000000000000000000000000;hpb=e37f7bfbbee86eef3b1f6e338a21239905911608;p=r2c2.git diff --git a/source/3d/terrain.h b/source/3d/terrain.h new file mode 100644 index 0000000..2cd9854 --- /dev/null +++ b/source/3d/terrain.h @@ -0,0 +1,45 @@ +#ifndef R2C2_3D_TERRAIN_H_ +#define R2C2_3D_TERRAIN_H_ + +#include +#include +#include +#include +#include "libr2c2/terrain.h" +#include "object.h" + +namespace R2C2 { + +class Terrain3D: public Object3D, public Msp::GL::Renderable +{ +private: + Terrain &terrain; + Msp::GL::Mesh mesh; + const Msp::GL::Technique &tech; + + static unsigned surface_indices[]; + static unsigned wall_indices[]; + +public: + Terrain3D(Layout3D &, Terrain &); + virtual ~Terrain3D(); + + virtual Vector get_node() const; + virtual bool is_visible() const { return true; } + +private: + void create_mesh(); + void gather_nodes(unsigned, unsigned, Vector *); + void build_triangle(Msp::GL::PrimitiveBuilder &, const Vector *, const unsigned *); + void update_triangle(unsigned, const Vector *, const unsigned *); + + void size_changed(unsigned, unsigned); + void tile_changed(unsigned, unsigned, bool); + +public: + virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const; +}; + +} // namespace R2C2 + +#endif