Class FoliageCluster
Represents a single foliage cluster that contains a sub clusters organized in quad-tree or if it's a leaf node it contains a set of foliage instances.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Foliage/FoliageCluster.h
Syntax
public class FoliageCluster
Fields
Bounds
The cluster bounds (in world space). Made of subdivided parent node in quad-tree.
Declaration
public BoundingBox Bounds
Field Value
BoundingBox
|
Children
The child clusters. If any element is valid then all are created.
Declaration
public FoliageCluster* Children[4]
Field Value
FoliageCluster
|
Instances
The allocated foliage instances within this cluster.
Declaration
public Array<FoliageInstance* , FixedAllocation<FOLIAGE_CLUSTER_CAPACITY>> Instances
Field Value
Array<FoliageInstance , FixedAllocation<FOLIAGE_CLUSTER_CAPACITY>>
|
MaxCullDistance
The maximum cull distance for the instances that are located in this cluster (including child clusters).
Declaration
public float MaxCullDistance
Field Value
float
|
TotalBounds
The cached cluster total bounds (in world space). Made of attached instances bounds including children.
Declaration
public BoundingBox TotalBounds
Field Value
BoundingBox
|
TotalBoundsSphere
The cached cluster total bounds (in world space). Made of attached instances bounds including children.
Declaration
public BoundingSphere TotalBoundsSphere
Field Value
BoundingSphere
|
Methods
Init(const BoundingBox& bounds)
Initializes this instance.
Declaration
public void Init(const BoundingBox& bounds)
Parameters
BoundingBox
bounds
The bounds. |
Intersects(Foliage* foliage, const Ray& ray, Real& distance, Vector3& normal, FoliageInstance*& instance)
Determines if there is an intersection between the current object or any it's child and a ray.
Declaration
public bool Intersects(Foliage* foliage, const Ray& ray, Real& distance, Vector3& normal, FoliageInstance*& instance)
Parameters
Foliage
foliage
The parent foliage actor. |
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
FoliageInstance
instance
When the method completes, contains pointer of the foliage instance that is the closest to the ray. |
Returns
bool
True whether the two objects intersected, otherwise false. |
UpdateCullDistance()
Updates the cull distance for all foliage instances added to the cluster and its children.
Declaration
public void UpdateCullDistance()
UpdateTotalBoundsAndCullDistance()
Updates the total bounds of the cluster and all child clusters and cull distance (as UpdateCullDistance does).
Declaration
public void UpdateTotalBoundsAndCullDistance()