Wasabi
Classes | Public Member Functions | Static Public Member Functions | List of all members
WTerrain Class Reference

#include <WTerrain.hpp>

Inheritance diagram for WTerrain:
WBase WOrientation WMaterialsStore

Public Member Functions

virtual std::string GetTypeName () const override
 
virtual void SetID (uint32_t newID) override
 
virtual void SetName (std::string newName) override
 
 WTerrain (class Wasabi *const app, uint32_t ID=0)
 
WError Create (uint32_t N=256, float size=1.0f, uint32_t numRings=6)
 
void SetViewpoint (WVector3 point)
 
bool WillRender (class WRenderTarget *rt)
 
void Render (class WRenderTarget *rt, WMaterial *material)
 
float GetHeight (WVector2 pos2D)
 
void Show ()
 
void Hide ()
 
bool Hidden () const
 
WMatrix GetWorldMatrix ()
 
bool UpdateLocals ()
 
virtual bool Valid () const override
 
virtual void OnStateChange (STATE_CHANGE_TYPE type) override
 
- Public Member Functions inherited from WBase
 WBase (class Wasabi *const app, uint32_t ID=0)
 
uint32_t GetID () const
 
std::string GetName () const
 
class WasabiGetAppPtr () const
 
void AddReference ()
 
void RemoveReference ()
 
- Public Member Functions inherited from WOrientation
void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 
- Public Member Functions inherited from WMaterialsStore
void AddEffect (class WEffect *effect, uint32_t bindingSet=0)
 
void RemoveEffect (class WEffect *effect)
 
void RemoveEffect (class WMaterial *material)
 
void ClearEffects ()
 
class WMaterialGetMaterial (class WEffect *effect)
 
class WMaterialCollectionGetMaterials ()
 

Static Public Member Functions

static std::string _GetTypeName ()
 

Additional Inherited Members

- Protected Member Functions inherited from WMaterialsStore
void _AddMaterial (class WMaterial *material)
 
virtual void OnMaterialAdded (class WMaterial *newMaterial)
 
- Protected Attributes inherited from WBase
class Wasabim_app
 
uint32_t m_ID
 
std::string m_name
 
- Protected Attributes inherited from WMaterialsStore
std::unordered_map< class WEffect *, class WMaterial * > m_materialMap
 
class WMaterialCollectionm_materialsCollection
 

Detailed Description

This represents a terrain object and is responsible for rendering it.

Member Function Documentation

◆ _GetTypeName()

static std::string WTerrain::_GetTypeName ( )
static

Returns "Terrain" string.

Returns
Returns "Terrain" string

◆ Create()

WError WTerrain::Create ( uint32_t  N = 256,
float  size = 1.0f,
uint32_t  numRings = 6 
)

Initializes the terrain.

Parameters
NDimension (in number of vertices) of each block in the terrain, must be a power of 2 greater than 1
sizeSize of each square in the highest resolution block, must be greater than 0
numRingsNumber of LOD rings drawn around the origin
Returns
Error code, see WError.h

◆ GetHeight()

float WTerrain::GetHeight ( WVector2  pos2D)

Retrieves the height of the terrain at a given point on the xz plain

Parameters
pos2Dx and z coordinates to retrieve the height at
Returns
the height at pos2D

◆ GetTypeName()

virtual std::string WTerrain::GetTypeName ( ) const
overridevirtual

This function must be implemented by a child class. This is used for debugging, in which a class should return its name.

Returns
The name of the class

Implements WBase.

◆ GetWorldMatrix()

WMatrix WTerrain::GetWorldMatrix ( )

Retrieves the world matrix for the terrain.

Returns
World matrix for the terrain

◆ Hidden()

bool WTerrain::Hidden ( ) const

Checks if the terrain hidden.

Returns
true if the terrain is hidden, false otherwise

◆ Hide()

void WTerrain::Hide ( )

Hides the terrain.

◆ OnStateChange()

virtual void WTerrain::OnStateChange ( STATE_CHANGE_TYPE  type)
overridevirtual

A callback called by this class when the entity changes its position or orientation.

Parameters
typeOrientation change type

Reimplemented from WOrientation.

◆ Render()

void WTerrain::Render ( class WRenderTarget rt,
WMaterial material 
)

Renders the terrain to the given render target. @params rt Render target to render to

Parameters
materialMaterial to use for rendering

◆ SetID()

virtual void WTerrain::SetID ( uint32_t  newID)
overridevirtual

Sets the ID of this object and notifies its manager.

Parameters
newIDNew ID

Implements WBase.

◆ SetName()

virtual void WTerrain::SetName ( std::string  newName)
overridevirtual

Sets the name of this object.

Parameters
nameNew name for the object

Implements WBase.

◆ SetViewpoint()

void WTerrain::SetViewpoint ( WVector3  point)

Sets the point around which the terrain is loaded. The terrain will not immediately load around the point.

Parameters
pointPoint to load the terrain around

◆ Show()

void WTerrain::Show ( )

Shows the terrain so that it can be rendered.

◆ UpdateLocals()

bool WTerrain::UpdateLocals ( )

Updates the world matrix of the terrain.

Returns
true if the matrix has changed, false otherwise

◆ Valid()

virtual bool WTerrain::Valid ( ) const
overridevirtual
Returns
Whether or not the terrain will render properly

Implements WBase.

◆ WillRender()

bool WTerrain::WillRender ( class WRenderTarget rt)

Checks whether a call to Render() will cause any rendering (draw call) to happen.


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