Class TerrainChunk
Represents a single terrain chunk.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Terrain/TerrainChunk.h
Syntax
public class TerrainChunk : public ScriptingObject, public ISerializable
Fields
Lightmap
The baked lightmap entry info for this chunk.
Declaration
public LightmapEntry Lightmap
Field Value
|
LightmapEntry
|
OverrideMaterial
The material to override the terrain default one for this chunk.
Declaration
public AssetReference<MaterialBase> OverrideMaterial
Field Value
|
AssetReference<MaterialBase>
|
Methods
CacheNeighbors()
Caches the neighbor chunks of this chunk.
Declaration
public void CacheNeighbors()
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
|
DeserializeStream
stream
The input stream. |
|
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Overrides
Draw(const RenderContext& renderContext)
Draws the chunk (adds the draw call). Must be called after PrepareDraw.
Declaration
public void Draw(const RenderContext& renderContext) const
Parameters
|
RenderContext
renderContext
The rendering context. |
Draw(const RenderContext& renderContext, MaterialBase* material, int32 lodIndex = 0)
Draws the terrain chunk.
Declaration
public void Draw(const RenderContext& renderContext, MaterialBase* material, int32 lodIndex = 0) const
Parameters
|
RenderContext
renderContext
The rendering context. |
|
MaterialBase
material
The material to use for rendering. |
|
int32
lodIndex
The LOD index. |
GetBounds()
GetHeightmapUVScaleBias()
Gets the scale (in XY) and bias (in ZW) applied to the vertex UVs to get the chunk coordinates.
Declaration
public Float4 GetHeightmapUVScaleBias() const
Returns
|
Float4
|
GetPatch()
GetTransform()
Gets the chunk transformation (world to local).
Declaration
public Transform GetTransform() const
Returns
|
Transform
|
GetX()
Gets the x coordinate.
Declaration
public int32 GetX() const
Returns
|
int32
|
GetZ()
Gets the z coordinate.
Declaration
public int32 GetZ() const
Returns
|
int32
|
HasLightmap()
Determines whether this chunk has valid lightmap data.
Declaration
public bool HasLightmap() const
Returns
|
bool
|
Intersects(const Ray& ray, Real& distance)
Determines if there is an intersection between the terrain chunk and a point
Declaration
public bool Intersects(const Ray& ray, Real& distance)
Parameters
|
Ray
ray
The ray. |
|
Real
distance
The output distance. |
Returns
|
bool
True if chunk intersects with the ray, otherwise false. |
PrepareDraw(const RenderContext& renderContext)
Prepares for drawing chunk. Cached LOD and material.
Declaration
public bool PrepareDraw(const RenderContext& renderContext)
Parameters
|
RenderContext
renderContext
The rendering context. |
Returns
|
bool
True if draw chunk, otherwise false. |
RemoveLightmap()
Removes the lightmap data from the chunk.
Declaration
public void RemoveLightmap()
Returns
|
void
|
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
|
SerializeStream
stream
The output stream. |
|
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
Overrides
UpdateBounds()
Updates the cached bounds of the chunk.
Declaration
public void UpdateBounds()
UpdateTransform()
Updates the cached transform of the chunk.
Declaration
public void UpdateTransform()