My Project
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ParaEngine::CBatchedElementDraw Class Reference

for drawing special element object(like particles, lines, etc) in the scene. More...

#include <BatchedElementDraw.h>

Inheritance diagram for ParaEngine::CBatchedElementDraw:
ParaEngine::IBatchedElementDraw ParaEngine::IParaDebugDraw

Classes

struct  BatchedThickLines
 

Public Member Functions

IParaDebugDrawGetDebugDrawInterface ()
 deprecated: interface
 
virtual void DrawLine (const PARAVECTOR3 &from, const PARAVECTOR3 &to, const PARAVECTOR3 &color)
 draw a line with a given color. More...
 
virtual void DrawPredefinedLines (const PARAVECTOR3 *lines, int nLineCount, const PARAVECTOR3 &color)
 draw multiple lines with a given color using the predefined index order. More...
 
virtual void DrawContactPoint (const PARAVECTOR3 &PointOnB, const PARAVECTOR3 &normalOnB, float distance, int lifeTime, const PARAVECTOR3 &color)
 draw a contact point with a given color. More...
 
virtual void ReportErrorWarning (const char *warningString)
 draw a contact point with a given color. More...
 
virtual void Draw3dText (const PARAVECTOR3 &location, const char *textString)
 draw a text with a given color. More...
 
virtual void SetRenderOffset (const PARAVECTOR3 &vOffset)
 set a render offset. More...
 
virtual PARAVECTOR3 GetRenderOffset ()
 get current render offset. More...
 
virtual void SetDebugDrawMode (int debugMode)
 bitwise fields of IParaDebugDraw::DebugDrawModes
 
virtual int GetDebugDrawMode ()
 bitwise fields of PhysicsDebugDrawModes
 
virtual void SetDefaultColor (const PARAVECTOR3 &color)
 get the current draw color. More...
 
virtual PARAVECTOR3 GetDefaultColor ()
 set the current draw color. More...
 
virtual void AddThickLine (const PARAVECTOR3 &from, const PARAVECTOR3 &to, const PARAVECTOR4 &color, float fThickness=0.f, float DepthBias=0.f)
 draw line with thickness
 
virtual void AddThickLines (const PARAVECTOR3 *points, int nPointCount, const PARAVECTOR4 &color, float fThickness=0.f, float DepthBias=0.f)
 nPointCount-1 lines segment is drawn
 
virtual void AddParticle (CParticleElement *particle)
 add a particle. More...
 
void ClearParticles ()
 
void ClearAll ()
 call this before scene is reset. More...
 
void ClearLines ()
 clear all cached drawing. More...
 
void DrawAll (bool bClear=true)
 
void DrawBatchedLines (bool bClear=true)
 draw all cached line primitives since last Clear() call. More...
 
void DrawBatchedThickLines (bool bClear=true)
 
void DrawBatchedParticles (bool bClear=true)
 
int GetLineCount ()
 get the total number of line primitives in the cached render list. More...
 
bool IsEmpty ()
 

Protected Member Functions

void SortParticles ()
 sort particle into render passes according to texture. More...
 

Protected Attributes

Vector3 m_vOffset
 
int m_nDrawMode
 
PARAVECTOR3 m_vDefaultColor
 
std::vector< LINEVERTEXm_lines_vertex_array
 
std::vector< int16 > m_lines_index_array
 
int m_nLineCount
 
std::vector< BatchedThickLinesm_listThickLines
 
unordered_ref_array< CParticleElement * > m_listParticles
 
std::vector< ParticleRenderPassm_ParticleRenderPasses
 

Static Protected Attributes

static std::vector< char > s_VertexData
 tessellation vertex buffer data
 

Additional Inherited Members

- Public Types inherited from ParaEngine::IBatchedElementDraw
enum  BatchDrawModes {
  BDM_NoDebug =0, BDM_DrawWireframe = 1, BDM_DrawAabb =2, BDM_DrawFeaturesText =4,
  BDM_DrawContactPoints =8, BDM_NoDeactivation =16, BDM_NoHelpText = 32, BDM_DrawText =64,
  BDM_ProfileTimings = 128, BDM_EnableSatComparison = 256, BDM_DisableBulletLCP = 512, BDM_EnableCCD = 1024,
  BDM_DrawConstraints = (1 << 11), BDM_DrawConstraintLimits = (1 << 12), BDM_FastWireframe = (1<<13), BDM_MAX_DRAW_MODE
}
 
- Public Types inherited from ParaEngine::IParaDebugDraw
enum  DebugDrawModes {
  DDM_NoDebug =0, DDM_DrawWireframe = 1, DDM_DrawAabb =2, DDM_DrawFeaturesText =4,
  DDM_DrawContactPoints =8, DDM_NoDeactivation =16, DDM_NoHelpText = 32, DDM_DrawText =64,
  DDM_ProfileTimings = 128, DDM_EnableSatComparison = 256, DDM_DisableBulletLCP = 512, DDM_EnableCCD = 1024,
  DDM_DrawConstraints = (1 << 11), DDM_DrawConstraintLimits = (1 << 12), DDM_FastWireframe = (1<<13), DDM_MAX_DEBUG_DRAW_MODE
}
 

Detailed Description

for drawing special element object(like particles, lines, etc) in the scene.

this is usually a singleton associated with a scene object. And is always rendered after 3d scene is rendered but before GUI object.

Member Function Documentation

§ AddParticle()

void ParaEngine::CBatchedElementDraw::AddParticle ( CParticleElement particle)
virtual

add a particle.

although we will sort by texture in a special way, for better performance, it is recommended that particles with same textures are added in sequence or close to one another.

Parameters
particlethe pointer must be valid until the end of the frame.

Implements ParaEngine::IBatchedElementDraw.

§ ClearAll()

void ParaEngine::CBatchedElementDraw::ClearAll ( )

call this before scene is reset.

§ ClearLines()

void ParaEngine::CBatchedElementDraw::ClearLines ( )

clear all cached drawing.

§ Draw3dText()

void ParaEngine::CBatchedElementDraw::Draw3dText ( const PARAVECTOR3 location,
const char *  textString 
)
virtual

draw a text with a given color.

Implements ParaEngine::IBatchedElementDraw.

§ DrawBatchedLines()

void ParaEngine::CBatchedElementDraw::DrawBatchedLines ( bool  bClear = true)

draw all cached line primitives since last Clear() call.

Parameters
bClearif true(default), it will clear the render list after draw.

§ DrawContactPoint()

void ParaEngine::CBatchedElementDraw::DrawContactPoint ( const PARAVECTOR3 PointOnB,
const PARAVECTOR3 normalOnB,
float  distance,
int  lifeTime,
const PARAVECTOR3 color 
)
virtual

draw a contact point with a given color.

Implements ParaEngine::IBatchedElementDraw.

§ DrawLine()

void ParaEngine::CBatchedElementDraw::DrawLine ( const PARAVECTOR3 from,
const PARAVECTOR3 to,
const PARAVECTOR3 color 
)
virtual

draw a line with a given color.

Implements ParaEngine::IBatchedElementDraw.

§ DrawPredefinedLines()

void ParaEngine::CBatchedElementDraw::DrawPredefinedLines ( const PARAVECTOR3 lines,
int  nLineCount,
const PARAVECTOR3 color 
)
virtual

draw multiple lines with a given color using the predefined index order.

it can be used to render a quad(4 lines) or box(12 lines). 0,1,1,2,2,3,3,0, // bottom 4,5,5,6,6,7,7,4, // top 0,4,1,5,2,6,3,7, // sides

Parameters
linesvertex arrays
nLineCountit can be 4 or 12. the index order is given above.
colorcolor to draw the line.

Implements ParaEngine::IBatchedElementDraw.

§ GetDefaultColor()

virtual PARAVECTOR3 ParaEngine::CBatchedElementDraw::GetDefaultColor ( )
inlinevirtual

set the current draw color.

some object may reply on this value when drawing the primitives.

Implements ParaEngine::IBatchedElementDraw.

§ GetLineCount()

int ParaEngine::CBatchedElementDraw::GetLineCount ( )

get the total number of line primitives in the cached render list.

§ GetRenderOffset()

virtual PARAVECTOR3 ParaEngine::CBatchedElementDraw::GetRenderOffset ( )
inlinevirtual

get current render offset.

It only takes effect when calling one of the above Draw functions.

Implements ParaEngine::IBatchedElementDraw.

§ ReportErrorWarning()

void ParaEngine::CBatchedElementDraw::ReportErrorWarning ( const char *  warningString)
virtual

draw a contact point with a given color.

Implements ParaEngine::IBatchedElementDraw.

§ SetDefaultColor()

virtual void ParaEngine::CBatchedElementDraw::SetDefaultColor ( const PARAVECTOR3 color)
inlinevirtual

get the current draw color.

some object may reply on this value when drawing the primitives.

Implements ParaEngine::IBatchedElementDraw.

§ SetRenderOffset()

void ParaEngine::CBatchedElementDraw::SetRenderOffset ( const PARAVECTOR3 vOffset)
virtual

set a render offset.

Implements ParaEngine::IBatchedElementDraw.

§ SortParticles()

void ParaEngine::CBatchedElementDraw::SortParticles ( )
protected

sort particle into render passes according to texture.


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