Antkeeper  0.0.1
Public Member Functions | List of all members
terrain_system Class Reference

Generates terrain patches and performs terrain patch LOD selection. More...

#include <terrain-system.hpp>

Inheritance diagram for terrain_system:
updatable_system

Public Member Functions

 terrain_system (entity::registry &registry)
 
 ~terrain_system ()
 
virtual void update (float t, float dt)
 Perform's a system's update() function. More...
 
entity::id generate (std::shared_ptr< gl::image_2d > heightmap, const math::uvec2 &subdivisions, const math::transform< float > &transform, std::shared_ptr< render::material > material)
 Generates terrain entities from a heightmap. More...
 
- Public Member Functions inherited from updatable_system
 updatable_system (entity::registry &registry)
 Creates an updatable system. More...
 

Additional Inherited Members

- Protected Attributes inherited from updatable_system
entity::registryregistry
 Registry on which the system operate. More...
 

Detailed Description

Generates terrain patches and performs terrain patch LOD selection.

Definition at line 37 of file terrain-system.hpp.

Constructor & Destructor Documentation

◆ terrain_system()

terrain_system::terrain_system ( entity::registry registry)
explicit

Definition at line 37 of file terrain-system.cpp.

◆ ~terrain_system()

terrain_system::~terrain_system ( )

Definition at line 41 of file terrain-system.cpp.

Member Function Documentation

◆ generate()

entity::id terrain_system::generate ( std::shared_ptr< gl::image_2d heightmap,
const math::uvec2 subdivisions,
const math::transform< float > &  transform,
std::shared_ptr< render::material material 
)

Generates terrain entities from a heightmap.

Parameters
heightmapHeightmap from which the terrain should be generated.
subdivisionsNumber of heightmap subdivisions on the x- and z-axes. Determines the number of terrain entities generated.
transformTranslation, rotation, and scale of the terrain.
materialTerrain material.
Returns
Entity ID of the generated terrain grid.

@except std::invalid_argument Failed to generate terrain from null heightmap. @except std::runtime_error Heightmap size less than 2x2. @except std::runtime_error Heightmap subdivision failed.

Definition at line 48 of file terrain-system.cpp.

◆ update()

void terrain_system::update ( float  t,
float  dt 
)
virtual

Perform's a system's update() function.

Parameters
tTotal elapsed time, in seconds.
dtDelta time, in seconds.

Implements updatable_system.

Definition at line 44 of file terrain-system.cpp.


The documentation for this class was generated from the following files: