SuperTuxKart
Public Member Functions | Private Attributes | List of all members
TerrainInfo Class Reference

This class stores information about the triangle that's under an object, i.e. More...

#include <terrain_info.hpp>

Inheritance diagram for TerrainInfo:
Inheritance graph
[legend]

Public Member Functions

 TerrainInfo ()
 Constructor to initialise terrain data.
 
 TerrainInfo (const Vec3 &pos)
 Constructor to initialise terrain data at a given position. More...
 
bool getSurfaceInfo (const Vec3 &from, Vec3 *position, const Material **m)
 Does a raycast upwards from the given position If the raycast indicated that the kart is 'under something' (i.e. More...
 
virtual void update (const btMatrix3x3 &rotation, const Vec3 &from)
 Update the terrain information based on the latest position. More...
 
virtual void update (const Vec3 &from)
 Update the terrain information based on the latest position. More...
 
virtual void update (const Vec3 &from, const Vec3 &towards)
 Update the terrain information based on the latest position. More...
 
virtual void update (const btMatrix3x3 &rotation)
 Simple wrapper with no offset. More...
 
float getHoT () const
 Returns the height of the terrain. More...
 
const MaterialgetMaterial () const
 Returns the current material the kart is on. More...
 
const MaterialgetLastMaterial () const
 Returns the previous material the kart was one (which might be the same as getMaterial() ). More...
 
const Vec3getNormal () const
 Returns the normal of the terrain the kart is on. More...
 
float getTerrainPitch (float heading) const
 Returns the pitch of the terrain depending on the heading. More...
 
const btVector3 & getHitPoint () const
 Returns the hit point of the raycast. More...
 
const Vec3getOrigin () const
 

Private Attributes

Vec3 m_normal
 Normal of the triangle under the object. More...
 
const Materialm_material
 Material of the triangle under the object. More...
 
const Materialm_last_material
 The previous material a kart was on. More...
 
Vec3 m_hit_point
 The point that was hit. More...
 
Vec3 m_origin_ray
 DEBUG only: origin of raycast. More...
 

Detailed Description

This class stores information about the triangle that's under an object, i.e.

: the normal, a pointer to the material, and the height above th

Constructor & Destructor Documentation

◆ TerrainInfo()

TerrainInfo::TerrainInfo ( const Vec3 pos)

Constructor to initialise terrain data at a given position.

Parameters
posThe position to get the data from.

Member Function Documentation

◆ getHitPoint()

const btVector3& TerrainInfo::getHitPoint ( ) const
inline

Returns the hit point of the raycast.

◆ getHoT()

float TerrainInfo::getHoT ( ) const
inline

Returns the height of the terrain.

we're currently above

◆ getLastMaterial()

const Material* TerrainInfo::getLastMaterial ( ) const
inline

Returns the previous material the kart was one (which might be the same as getMaterial() ).

◆ getMaterial()

const Material* TerrainInfo::getMaterial ( ) const
inline

Returns the current material the kart is on.

◆ getNormal()

const Vec3& TerrainInfo::getNormal ( ) const
inline

Returns the normal of the terrain the kart is on.

◆ getSurfaceInfo()

bool TerrainInfo::getSurfaceInfo ( const Vec3 from,
Vec3 position,
const Material **  material 
)

Does a raycast upwards from the given position If the raycast indicated that the kart is 'under something' (i.e.

a specially marked terrain), to another raycast up to detect under whic mesh the kart is. This is using the special gfx effect mesh only. This is used e.g. to detect if a kart is under water, and then to get the proper position for water effects. Note that the TerrainInfo objects keeps track of the previous raycast position.

◆ getTerrainPitch()

float TerrainInfo::getTerrainPitch ( float  heading) const

Returns the pitch of the terrain depending on the heading.

◆ update() [1/4]

void TerrainInfo::update ( const btMatrix3x3 &  rotation,
const Vec3 from 
)
virtual

Update the terrain information based on the latest position.

Parameters
tranThe transform ov the kart
fromWorld coordinates from which to start the raycast.

◆ update() [2/4]

void TerrainInfo::update ( const Vec3 from)
virtual

Update the terrain information based on the latest position.

Parameters
Positionfrom which to start the rayast from.

◆ update() [3/4]

void TerrainInfo::update ( const Vec3 from,
const Vec3 towards 
)
virtual

Update the terrain information based on the latest position.

Parameters
Positionfrom which to start the rayast from.

◆ update() [4/4]

virtual void TerrainInfo::update ( const btMatrix3x3 &  rotation)
inlinevirtual

Simple wrapper with no offset.

Member Data Documentation

◆ m_hit_point

Vec3 TerrainInfo::m_hit_point
private

The point that was hit.

◆ m_last_material

const Material* TerrainInfo::m_last_material
private

The previous material a kart was on.

◆ m_material

const Material* TerrainInfo::m_material
private

Material of the triangle under the object.

◆ m_normal

Vec3 TerrainInfo::m_normal
private

Normal of the triangle under the object.

◆ m_origin_ray

Vec3 TerrainInfo::m_origin_ray
private

DEBUG only: origin of raycast.


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