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. More... | |
~ArchesTree () | |
Deletes the tree structure. | |
ScalarAlpha | GetBedrock (const Vector2 &) const |
Compute the bedrock height of a given input point. More... | |
ScalarAlpha | GetWater (const Vector2 &) const |
Compute the height of a given input point. More... | |
ScalarAlpha | GetFoam (const Vector2 &) const |
Compute the height of a given input point. More... | |
ScalarAlpha | GetSand (const Vector2 &) const |
Compute the height of a given input point. More... | |
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. More... | |
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. More... | |
bool | Intersect (const Ray &, double &) const |
Compute the intersection between the surface and a ray. More... | |
Mesh | CreateMesh (const Circle2 &, int) const |
Create a mesh over a disc support. More... | |
Mesh | CreateMeshBorder (const Circle2 &, int) const |
Create a mesh over a disc support. More... | |
void | HeightFieldRock (HeightField &) const |
Create a Rock Heightfield. More... | |
void | HeightFieldWater (HeightField &) const |
Create a Water Heightfield. More... | |
void | HeightFieldSand (HeightField &) const |
Create a Sand Heightfield. More... | |
LayerStack | CreateLayerStack (const Array2 &) const |
Create a LayerStack. More... | |
void | Blend (HeightField &) const |
Blend a given node with an existing terrain over an input heightfield. More... | |
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, TerraNode::ElevationAlpha(), Array2::GetBox(), Array2::GetSizeX(), Array2::GetSizeY(), ScalarAlpha::Value(), and water.
Create a mesh over a disc support.
circle | The disc. |
n | Subdivision. |
References bedrock, GetBedrock(), Mesh2::Indexes(), TerraNode::Normal(), Vector2::ToVector(), ScalarAlpha::Value(), 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, TerraNode::ElevationAlpha(), 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, and TerraNode::ElevationAlpha().
Referenced by Blend(), CreateMesh(), and CreateMeshBorder().
ScalarAlpha ArchesTree::GetFoam | ( | const Vector2 & | p | ) | const |
Compute the height of a given input point.
p | Point. |
References TerraNode::ElevationAlpha().
ScalarAlpha ArchesTree::GetSand | ( | const Vector2 & | p | ) | const |
Compute the height of a given input point.
p | Point. |
References TerraNode::ElevationAlpha().
ScalarAlpha ArchesTree::GetWater | ( | const Vector2 & | p | ) | const |
Compute the height of a given input point.
p | Point. |
References TerraNode::ElevationAlpha(), and water.
void ArchesTree::HeightFieldRock | ( | HeightField & | hf | ) | const |
void ArchesTree::HeightFieldSand | ( | HeightField & | hf | ) | const |
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, and TerraNode::Elevation().
int ArchesTree::Traversal | ( | const Vector2 & | p | ) | const |
Compute the number of nodes that are traversed when evaluating the tree.
p | Point. |
References bedrock, TerraNode::Traversal(), and water.