Page MenuHomePhorge

Terrain.h
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

Terrain.h

#ifndef ECHO_TERRAIN_H
#define ECHO_TERRAIN_H
#include <echo/Graphics/SceneEntity.h>
namespace Echo
{
class MeshManager;
class TextureManager;
class Texture;
class Mesh;
class Terrain : public SceneEntity
{
public:
struct PixelModes
{
enum _
{
PIXEL_IS_VERTEX, ///Each pixel is a vertex.
PIXEL_IS_QUAD ///Each pixel represents the centre of a quad.
///mResolution determines the size of each quad.
};
};
typedef PixelModes::_ PixelMode;
Terrain(const std::string& terrainName, MeshManager& meshManager, TextureManager& textureManager);
~Terrain();
void SetTexture(const std::string& textureName);
/**
* Set the pixel mode for the terrain.
* @see PixelModes.
* @param pixelMode
*/
void SetPixelMode(PixelMode pixelMode);
/**
* Set the resolution that each pixel represents.
* @param resolution
*/
void SetResolution(const Vector3& resolution);
/**
* Update the internal mesh.
*/
void UpdateMesh();
virtual void Render(const Matrix4& transform, RenderTarget& renderTarget) override;
private:
/**
* Build the mesh using vertex mode.
*/
void BuildVertexMesh();
/**
* Build the mesh using quad mode.
*/
void BuildQuadMesh();
MeshManager& mMeshManager;
TextureManager& mTextureManager;
bool mMeshOutOfDate;
PixelMode mPixelMode;
Vector3 mResolution;
shared_ptr<Texture> mTexture;
};
}
#endif

File Metadata

Mime Type
text/x-c++
Expires
Thu, Dec 5, 1:58 AM (6 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61633
Default Alt Text
Terrain.h (1 KB)

Event Timeline