Wraith  0.1.5
Basic 3D game engine in C++
TerrainObject Class Reference

A TerrainObject object used for storing TerrainObject model and texture. As well as having functionality for collision testing More...

#include <TerrainObject.h>

Inheritance diagram for TerrainObject:
Inheritance graph
Collaboration diagram for TerrainObject:
Collaboration graph

Classes

struct  CellTriangle
 

Public Member Functions

 TerrainObject (const TerrainObject &)=default
 
TerrainObjectoperator= (const TerrainObject &)=default
 
 TerrainObject (TerrainObject &&)=default
 
TerrainObjectoperator= (TerrainObject &&)=default
 
 TerrainObject (const char *fileName, float sideLength, float maxHeight, float assignedGroundLevel, const std::string &textureName, int uRepeat, int vRepeat)
 
void intersect (Collidable *) const override
 
virtual TerrainRectangleArea getTerrainRectangleArea (Collidable *) const override
 
virtual const AABBCellgetAABBCellAt (int row, int column) const override
 
void visualizeCellAt (const Collidable &collidable) const
 Visualizes the cell on the terrain that the collidable is currently above/below. More...
 
virtual void visualizeCellAt (const Vect &position) const override
 Visualizes the cell on the terrain given a position. More...
 
const AABBCellgetCellAt (const Vect &position) const
 
AABBCellIndex getCellIndexAt (const Vect &position) const
 
Vect computePointOnTerrainObject (const Vect &position) const
 computes the point on the terrain given a position in 3D space More...
 
Vect computeNormalOnTerrainObject (const Vect &position) const
 computes the normal on the terrain given a position in 3D space More...
 
virtual void submitTerrainDrawRegistration () override
 
virtual void submitTerrainDrawDeregistration () override
 
- Public Member Functions inherited from Drawable
 Drawable (const Drawable &)=default
 
Drawableoperator= (const Drawable &)=default
 
 Drawable (Drawable &&)=default
 
Drawableoperator= (Drawable &&)=default
 

Private Member Functions

void computeVertices (float sideLength, const int &sideCount, GLbyte *imageData, float maxHeight, float assignedGroundLevel, VertexStride_VUN *pVertexList, int uRepeat, int vRepeat)
 
void computeTriangleIndices (const int &sideCount, TriangleIndex *pTriangleList)
 
void computeVertexNormals (const int &sideCount, TriangleIndex *pTriangleList, VertexStride_VUN *pVertexList)
 
void computeAABBCells (const int &sideCount, VertexStride_VUN *pVertexList)
 
int computeTexelIndex (int side, int row, int col) const
 
int computeVertexIndex (int side, int row, int col) const
 
int computeTriangleIndex (int side, int row, int col) const
 
Vect computeFaceNormal (const int triangleIndex, const TriangleIndex triangleList[], const VertexStride_VUN vertexList[])
 
Vect computeFaceNormal (const TriangleIndex &triangleIndex, const VertexStride_VUN vertexList[])
 
Vect computeFaceNormal (const Vect &p1, const Vect &p2, const Vect &p3)
 
Vect convert (const VertexStride_VUN &) const
 
CellTriangle computeCellTriangleAt (const Collidable &) const
 
CellTriangle computeCellTriangleAt (const Vect &position) const
 
Vect interpolate (const Vect &vertexQA, const Vect &vertexQB, const Vect &vertexQC, float beta, float gamma) const
 
void outputBetaGamma (const Vect &target, const Vect &vertexQA, const Vect &vertexQB, const Vect &vertexQC, float &outBeta, float &outGamma) const
 
void outputBetaGamma (const Vect &position, float &outBeta, float &outGamma) const
 
virtual void draw () override
 Draw callback this object. More...
 

Private Attributes

Model * _pTerrainObjectModel
 
GraphicsObject * _pTerrainObjectGraphicsObject
 
GraphicsObject * _pTerrainObjectGraphicsObjectWire
 
std::vector< std::vector< AABBCell > > _AABBCells
 
std::vector< std::vector< Vect > > _normals
 
float _sideLength
 
float _cellLength
 

Additional Inherited Members

- Protected Member Functions inherited from Drawable
void submitDrawRegistration ()
 Submit draw registration to current scene. More...
 
void submitDrawDeregistration ()
 Submit draw deregistration to current scene. More...
 
void submitDraw2DRegistration ()
 Submit draw 2D registration to current scene. More...
 
void submitDraw2DDeregistration ()
 Submit draw 2D deregistration from current scene. More...
 
bool isRegisteredForDraw () const
 Query if this object is registered for draw. More...
 
bool isRegisteredForDraw2D () const
 Query if this object is registered for draw 2D. More...
 

Detailed Description

A TerrainObject object used for storing TerrainObject model and texture. As well as having functionality for collision testing

remarks>

Member Function Documentation

◆ draw()

void TerrainObject::draw ( )
overrideprivatevirtual

Draw callback this object.

To be implemented by user in object derived from GameObject (NOT directly derived from Drawable). Called ONLY by current active scene.

Reimplemented from Drawable.


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