Terra 1.0
|
This class implements complex terrains created by combining elements. More...
#include <archestree.h>
Public Member Functions | |
ArchesTree (TerraNode *, TerraNode *=nullptr, TerraNode *=nullptr, TerraNode *=nullptr) | |
Create terrain structure from an input TerraNode element with Vegetation. | |
~ArchesTree () | |
Deletes the tree structure. | |
ScalarAlpha | GetBedrock (const Vector2 &) const |
Compute the bedrock height of a given input point. | |
ScalarAlpha | GetWater (const Vector2 &) const |
Compute the height of a given input point. | |
ScalarAlpha | GetFoam (const Vector2 &) const |
Compute the height of a given input point. | |
ScalarAlpha | GetSand (const Vector2 &) const |
Compute the height of a given input point. | |
Box2 | GetBox () const |
Return the bounding box of the tree. | |
int | Traversal (const Vector2 &) const |
Compute the number of nodes that are traversed when evaluating the tree. | |
void | GetTriangles (const Triangle2 &, QVector< Vector > &, QVector< Vector > &) const |
Get triangles of terrain and water using the Archestree. | |
Vector | dichotomie (Vector, Vector, double, double) const |
Find the intersection between the terrain and a segment. | |
bool | Intersect (const Ray &, double &) const |
Compute the intersection between the surface and a ray. | |
Mesh | CreateMesh (const Circle2 &, int) const |
Create a mesh over a disc support. | |
Mesh | CreateMeshBorder (const Circle2 &, int) const |
Create a mesh over a disc support. | |
void | HeightFieldRock (HeightField &) const |
Create a Rock Heightfield. | |
void | HeightFieldWater (HeightField &) const |
Create a Water Heightfield. | |
void | HeightFieldSand (HeightField &) const |
Create a Sand Heightfield. | |
LayerStack | CreateLayerStack (const Array2 &) const |
Create a LayerStack. | |
void | Blend (HeightField &) const |
Blend a given node with an existing terrain over an input heightfield. | |
Protected Attributes | |
TerraNode * | bedrock |
Bedrock tree. | |
TerraNode * | water |
Water. | |
Static Protected Attributes | |
static const double | epsilon = 1e-6 |
Epsilon value for gradient computations. | |
This class implements complex terrains created by combining elements.
void ArchesTree::Blend | ( | HeightField & | h | ) | const |
Blend a given node with an existing terrain over an input heightfield.
Let a the mask of the node, the mask of the heightfield is implicitly defined as (1-a).
h | HeighfField. |
References ScalarAlpha::Alpha(), GetBedrock(), GetBox(), Math::Lerp(), and ScalarAlpha::Value().
LayerStack ArchesTree::CreateLayerStack | ( | const Array2 & | a | ) | const |
Create a LayerStack.
a | The grid array. |
References ScalarAlpha::Alpha(), bedrock, Array2::GetBox(), Array2::GetSizeX(), Array2::GetSizeY(), ScalarAlpha::Value(), and water.
Create a mesh over a disc support.
circle | The disc. |
n | Subdivision. |
References bedrock, Mesh2::Indexes(), Vector2::ToVector(), Mesh2::Vertex(), and Mesh2::VertexSize().
Create a mesh over a disc support.
circle | The disc. |
n | Subdivision. |
References Circle2::Center(), GetBedrock(), Circle2::Radius(), Vector2::ToVector(), ScalarAlpha::Value(), and Mesh::Vertex().
Find the intersection between the terrain and a segment.
a,b | Segment. |
va,vb | Values at vertexes. |
References bedrock, epsilon, ScalarAlpha::Value(), and water.
Referenced by GetTriangles().
ScalarAlpha ArchesTree::GetBedrock | ( | const Vector2 & | p | ) | const |
Compute the bedrock height of a given input point.
p | Point. |
References bedrock.
Referenced by Blend(), and CreateMeshBorder().
ScalarAlpha ArchesTree::GetFoam | ( | const Vector2 & | p | ) | const |
Compute the height of a given input point.
p | Point. |
ScalarAlpha ArchesTree::GetSand | ( | const Vector2 & | p | ) | const |
Compute the height of a given input point.
p | Point. |
ScalarAlpha ArchesTree::GetWater | ( | const Vector2 & | p | ) | const |
void ArchesTree::HeightFieldRock | ( | HeightField & | hf | ) | const |
void ArchesTree::HeightFieldSand | ( | HeightField & | hf | ) | const |
Create a Sand Heightfield.
hf | Heightfield. |
void ArchesTree::HeightFieldWater | ( | HeightField & | hf | ) | const |
bool ArchesTree::Intersect | ( | const Ray & | ray, |
double & | t ) const |
Compute the intersection between the surface and a ray.
ray | The ray. |
t | Intersection depth. |
References bedrock.