GL Studio SCECpp Runtime Library
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GlsTriangleMesh Class Reference

#include <gls_triangle_mesh.h>

Inheritance diagram for GlsTriangleMesh:
GlsRenderObject GlsDisplayObject

Classes

struct  InitParameters
 
struct  TriangleFace
 

Public Member Functions

 GlsTriangleMesh (const InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
 
virtual void Draw (GlsStateManager &gl, const GlsFloat64 time)
 
virtual void SetTextureIndex (const GlsUInt32 textureIndex)
 
virtual void OffsetTexture (const GlsVector2D &offset)
 
- Public Member Functions inherited from GlsRenderObject
virtual void SetAlphaMode (const GlsAlphaMode alphaMode)
 
virtual void SetFillColor (const GlsColor &fillColor)
 
virtual void SetLineColor (const GlsColor &lineColor)
 
virtual void SetLineWidth (const GlsFloat32 lineWidth)
 
virtual void SetPolygonMode (const GlsPolygonMode polygonMode)
 
- Public Member Functions inherited from GlsDisplayObject
virtual void Calculate (const GlsFloat64 time)
 
virtual GlsDisplayObjectPickTest (const GlsVector2D &windowCoord, GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
 
GlsDisplayObjectHandleEvent (GlsEvent &event)
 
ObjectType GetObjectType (void) const
 
void SetBlinking (const GlsBool blinking)
 
void SetBlinkRate (const GlsFloat32 blinkRate)
 
void SetDynamicRotation (const GlsVector3D &dynamicRotation)
 
void SetDynamicScale (const GlsVector3D &dynamicScale)
 
void SetDynamicTranslation (const GlsVector3D &dynamicTranslation)
 
void SetVisibility (const GlsBool visible)
 
void SetParent (GlsDisplayObject *const parent)
 
void SetPickMode (const PickMode pickMode)
 
GlsBool NeedCalculate (void) const
 
void InvalidatePickCache (void)
 

Protected Member Functions

virtual ~GlsTriangleMesh ()
 
- Protected Member Functions inherited from GlsRenderObject
 GlsRenderObject (const InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
 
GLint GlsTextureFilterModeToGL (const GlsTextureFilterMode mode) const
 
void SetupDepthTest (GlsStateManager &gl) const
 
void SetupAlpha (GlsStateManager &gl) const
 
GlsBool SetupTexture (GlsStateManager &gl, const GlsUInt32 textureIndex) const
 
void SetupTextureFilterSettings (GlsStateManager &gl) const
 
void SetupBackfaceCulling (GlsStateManager &gl) const
 
void SetupShading (GlsStateManager &gl) const
 
void SetupLineStyle (GlsStateManager &gl) const
 
void SetupAntiAlias (GlsStateManager &gl) const
 
virtual ~GlsRenderObject ()
 
- Protected Member Functions inherited from GlsDisplayObject
 GlsDisplayObject (const InitParameters &initParameters, const ObjectType objectType, GlsEventDispatcher *const eventDispatcher)
 
virtual ~GlsDisplayObject ()
 
GlsBool CalcDrawMatrix (const GlsMatrixAffineD *const additionalTransform, const GlsBool includeLocation)
 
virtual void CalcWindowPickRegion (GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
 
GlsBool IsBlinkedOff (const GlsFloat64 time) const
 

Protected Attributes

const GlsUInt32 _numFaces
 
TriangleFace *const _faces
 
GlsTextureVertexArray _vertices
 
- Protected Attributes inherited from GlsRenderObject
const GlsBool _antiAlias
 
const GlsTexturePalette_texturePalette
 
const GlsBool _textureRepeat
 
const GlsTextureMapMode _textureMapMode
 
const GlsTextureFilterMode _textureMagFilterMode
 
const GlsTextureFilterMode _textureMinFilterMode
 
const GlsBool _cullBackFace
 
const GlsDepthBufferMode _depthBufferMode
 
const GlsPolygonEndMode _polygonEndMode
 
const GlsShadingMode _shadingMode
 
GlsAlphaMode _alphaMode
 
GlsColor _lineColor
 
GlsUInt32 _textureIndex
 
GlsPolygonMode _polygonMode
 
GlsColor _fillColor
 
GlsFloat32 _lineWidth
 
- Protected Attributes inherited from GlsDisplayObject
const GlsMatrixAffineD _dcsMatrix
 
const GlsMatrixAffineD _dcsMatrixInverse
 
const GlsBool _dcsMatrixIsIdentity
 
const GlsVector3D _location
 
const GlsBool _needCalculate
 
const ObjectType _objectType
 
const PickRegion _pickRegion
 
GlsEventDispatcher *const _eventDispatcher
 
const GlsVector3D _rotationPoint
 
GlsBool _blinking
 
GlsFloat32 _blinkRate
 
GlsMatrixAffineD::GLMatrixAffineF _drawMatrix
 
GlsVector3D _dynamicRotation
 
GlsVector3D _dynamicScale
 
GlsBool _dynamicScaleIsUnity
 
GlsVector3D _dynamicTranslation
 
GlsBool _needCalcDrawMatrix
 
GlsBool _visible
 
PickMode _pickMode
 
GlsBool _windowPickRegionValid
 
GlsVector2D _windowPickLowerLeft
 
GlsVector2D _windowPickUpperRight
 
GlsVector2D _windowPickUpperLeft
 
GlsVector2D _windowPickLowerRight
 
GlsMatrixAffineD::GLMatrixAffineF _pickMatrix
 
GlsDisplayObject_parent
 

Additional Inherited Members

- Public Types inherited from GlsDisplayObject
enum  ObjectType { OBJECT_TYPE_COMPOSITE, OBJECT_TYPE_RENDERABLE }
 
enum  PickMode { PICK_MODE_NEVER, PICK_MODE_FIRST, PICK_MODE_ALWAYS }
 
- Static Protected Attributes inherited from GlsRenderObject
static const GLclampf ALPHA_MODE_2_LEVEL_REF
 

Detailed Description

This class encapsulates a mesh of triangle faces.

Invariant
base class invariant holds, GLS_NULL != _faces, _numFaces > 0u, _vertices invariant holds, for each element in _faces: v1,v2,v3 < _vertices.GetSize(), textureIndex < _texturePalette.GetSize()

Constructor & Destructor Documentation

GlsTriangleMesh::GlsTriangleMesh ( const InitParameters initParameters,
GlsEventDispatcher *const  eventDispatcher 
)

Constructor - create an instance

Parameters
initParametersinitialization parameters
eventDispatcherevent dispatcher for this object else GLS_NULL
Precondition
initParameters.isValid()
Postcondition
instance is created
virtual GlsTriangleMesh::~GlsTriangleMesh ( )
protectedvirtual

Destructor - shall never be called

Precondition
none
Postcondition
none

Member Function Documentation

virtual void GlsTriangleMesh::Draw ( GlsStateManager gl,
const GlsFloat64  time 
)
virtual

Draws the triangle mesh

Parameters
glGL State manager for OpenGL into which object is drawn
timethe elaspsed time in seconds since program start
Precondition
time >= 0.0
Postcondition
object is drawn to OpenGL if visible and not blinked off

Implements GlsDisplayObject.

virtual void GlsTriangleMesh::OffsetTexture ( const GlsVector2D offset)
virtual

Offset the texture on the object

Parameters
offsetx, y offset for texture
Precondition
offset.IsValid()
Postcondition
offset is added to the texture coordinates

Implements GlsRenderObject.

virtual void GlsTriangleMesh::SetTextureIndex ( const GlsUInt32  textureIndex)
virtual

Set the desired texture index

Parameters
textureIndexdesired texture index into palette else GlsTexturePalette::NO_TEXTURE
Precondition
textureIndex is less than the size of the texture palette, else GlsTexturePalette::NO_TEXTURE, object's texture palette must have a valid texture (not an empty palette entry) at textureIndex if textureIndex != GlsTexturePalette::NO_TEXTURE
Postcondition
object has new texture index or is untextured if textureIndex == GlsTexturePalette::NO_TEXTURE

Reimplemented from GlsRenderObject.

Member Data Documentation

TriangleFace* const GlsTriangleMesh::_faces
protected

array of faces in triangle mesh

const GlsUInt32 GlsTriangleMesh::_numFaces
protected

number of faces in faces array

GlsTextureVertexArray GlsTriangleMesh::_vertices
protected

vertices in triangle mesh