![]() |
AireEngine
A 3D Open-World Game Engine
|
A class that represents a terrain object. More...
#include <terrain.h>
Public Member Functions | |
| Terrain (TexturePtr heightMap, int numVertices=200, const float xzScale=50.f, const float yScale=10.f, TexturePtr diffuseMap=nullptr, TexturePtr normalMap=nullptr, TexturePtr roughnessmap=nullptr) | |
| Constructs a Terrain object with specified parameters. | |
| ~Terrain () | |
| Destructor for the Terrain object. | |
| bool | saveHeightData () |
| Loads the height data from the height map texture. | |
| float | getHeightAt (const float x, const float z) |
| Retrieves the height of the terrain at a given point in world space. | |
| float | getXZScale () const |
| Gets the terrain scale factor in the x and z axes. | |
| float | getYScale () const |
| Gets the terrain scale factor in the y axis. | |
| void | render (ShaderProgram &prog, Aire::Camera &camera) |
| Renders the terrain using a specified shader program and camera. | |
| void | addWaterSurface (TextureManager *texManager, const Box2D ®ion, float height) |
| Adds a water surface to the terrain. | |
Public Attributes | |
| std::vector< glm::vec3 > | vertices |
| std::vector< glm::vec2 > | uvs |
| std::vector< unsigned int > | indices |
| glm::mat4 | modelMatrix = glm::mat4(1.0f) |
| TexturePtr | heightMap = nullptr |
| TexturePtr | diffuseMap = nullptr |
| TexturePtr | specularMap = nullptr |
| TexturePtr | normalMap = nullptr |
| TexturePtr | roughnessMap = nullptr |
| glm::vec3 | diffuseColor = glm::vec3(0.f, 0.1f, 0.f) |
| glm::vec3 | specularColor = glm::vec3(0.05f, 0.05f, 0.05f) |
| float | shininessValue = 1.f |
| std::vector< Aire::WaterSurface * > | waterSurfaces |
A class that represents a terrain object.
| Terrain::Terrain | ( | Aire::TexturePtr | heightmap, |
| int | numVertices = 200, | ||
| const float | xzScale = 50.f, | ||
| const float | yScale = 10.f, | ||
| Aire::TexturePtr | diffuseMap = nullptr, | ||
| Aire::TexturePtr | normalMap = nullptr, | ||
| Aire::TexturePtr | roughnessMap = nullptr ) |
Constructs a Terrain object with specified parameters.
| heightMap | The height map texture to use for the terrain. |
| numVertices | The number of vertices along one side of the terrain. |
| xzScale | The scale of the terrain in the x and z axes. |
| yScale | The scale of the terrain in the y axis. |
| diffuseMap | Optional diffuse map texture (nullptr for no texture). |
| normalMap | Optional normal map texture (nullptr for no texture). |
| roughnessMap | Optional roughness map texture (nullptr for no texture). |

| void Terrain::addWaterSurface | ( | TextureManager * | texManager, |
| const Box2D & | region, | ||
| float | height ) |
Adds a water surface to the terrain.
| texManager | The texture manager for loading water textures. |
| region | The region of the terrain to add the water surface to. |
| height | The height of the water surface. |

Retrieves the height of the terrain at a given point in world space.
| x | The x coordinate of the point. |
| z | The z coordinate of the point. |

|
inline |
Gets the terrain scale factor in the x and z axes.

|
inline |
Gets the terrain scale factor in the y axis.

| void Terrain::render | ( | ShaderProgram & | prog, |
| Aire::Camera & | camera ) |
Renders the terrain using a specified shader program and camera.
| prog | The shader program used for rendering. |
| camera | The camera object used for view and projection matrices. |

| bool Terrain::saveHeightData | ( | ) |
Loads the height data from the height map texture.

Diffuse color of the terrain material.
| TexturePtr Aire::Terrain::diffuseMap = nullptr |
Pointer to the diffuse map texture.
| TexturePtr Aire::Terrain::heightMap = nullptr |
Pointer to the height map texture.
| glm::mat4 Aire::Terrain::modelMatrix = glm::mat4(1.0f) |
Model matrix of the terrain.
| TexturePtr Aire::Terrain::normalMap = nullptr |
Pointer to the normal map texture.
| TexturePtr Aire::Terrain::roughnessMap = nullptr |
Pointer to the roughness map texture.
Specular color of the terrain material.
| TexturePtr Aire::Terrain::specularMap = nullptr |
Pointer to the specular map texture.
| std::vector<glm::vec2> Aire::Terrain::uvs |
Texture coordinates corresponding to the vertices.
| std::vector<glm::vec3> Aire::Terrain::vertices |
List of vertices defining the terrain geometry.
| std::vector<Aire::WaterSurface*> Aire::Terrain::waterSurfaces |
List of water surfaces associated with the terrain.