My Project
BatchedElementDraw.h
1 #pragma once
2 #include "IBatchedElementDraw.h"
3 #include "VertexFVF.h"
4 #include "unordered_ref_array.h"
5 #include <vector>
6 
7 namespace ParaEngine
8 {
9  struct TextureEntity;
10 
11 
16  {
17  public:
20 
23  public:
25  virtual void DrawLine(const PARAVECTOR3& from,const PARAVECTOR3& to,const PARAVECTOR3& color);
26 
36  virtual void DrawPredefinedLines(const PARAVECTOR3* lines, int nLineCount, const PARAVECTOR3& color);
37 
39  virtual void DrawContactPoint( const PARAVECTOR3& PointOnB,const PARAVECTOR3& normalOnB,float distance,int lifeTime,const PARAVECTOR3& color );
40 
42  virtual void ReportErrorWarning( const char* warningString );
43 
45  virtual void Draw3dText( const PARAVECTOR3& location,const char* textString );
46 
48  virtual void SetRenderOffset(const PARAVECTOR3& vOffset);
49 
50  virtual PARAVECTOR3 GetRenderOffset(){return (PARAVECTOR3&)m_vOffset;};
51 
53  virtual void SetDebugDrawMode(int debugMode);
54 
56  virtual int GetDebugDrawMode();
57 
59  virtual void SetDefaultColor(const PARAVECTOR3& color) {m_vDefaultColor = color;};
60 
62  virtual PARAVECTOR3 GetDefaultColor() {return m_vDefaultColor;};
63 
65  virtual void AddThickLine(const PARAVECTOR3& from, const PARAVECTOR3& to, const PARAVECTOR4& color, float fThickness = 0.f, float DepthBias = 0.f);
67  virtual void AddThickLines(const PARAVECTOR3* points, int nPointCount, const PARAVECTOR4& color, float fThickness = 0.f, float DepthBias = 0.f);
68 
73  virtual void AddParticle(CParticleElement* particle);
74 
75  void ClearParticles();
76 
78  void ClearAll();
79  public:
81  void ClearLines();
82 
83  void DrawAll(bool bClear = true);
84 
88  void DrawBatchedLines(bool bClear=true);
89 
90  void DrawBatchedThickLines(bool bClear = true);
91 
92  void DrawBatchedParticles(bool bClear = true);
93 
95  int GetLineCount();
96 
97  bool IsEmpty();
98  protected:
100  void SortParticles();
101  protected:
102  Vector3 m_vOffset;
103  int m_nDrawMode;
104  PARAVECTOR3 m_vDefaultColor;
105 
106  std::vector<LINEVERTEX> m_lines_vertex_array;
107  std::vector<int16> m_lines_index_array;
108  int m_nLineCount;
109 
111  {
112  PARAVECTOR3 vStart;
113  PARAVECTOR3 vEnd;
114  DWORD Color;
115  // Negative thickness means that thickness is calculated in screen space, positive thickness should be used for world space thickness.
116  float Thickness;
117  float DepthBias;
118  bool IsScreenSpace() const { return Thickness < 0.f; };
119  };
120 
121  std::vector<BatchedThickLines> m_listThickLines;
122 
124  std::vector<ParticleRenderPass> m_ParticleRenderPasses;
125 
126 
128  static std::vector<char> s_VertexData;
129  };
130 }
virtual PARAVECTOR3 GetDefaultColor()
set the current draw color.
Definition: BatchedElementDraw.h:62
virtual void AddThickLine(const PARAVECTOR3 &from, const PARAVECTOR3 &to, const PARAVECTOR4 &color, float fThickness=0.f, float DepthBias=0.f)
draw line with thickness
Definition: BatchedElementDraw.cpp:54
virtual int GetDebugDrawMode()
bitwise fields of PhysicsDebugDrawModes
Definition: BatchedElementDraw.cpp:152
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
Definition: BatchedElementDraw.cpp:81
int GetLineCount()
get the total number of line primitives in the cached render list.
Definition: BatchedElementDraw.cpp:164
virtual void SetDebugDrawMode(int debugMode)
bitwise fields of IParaDebugDraw::DebugDrawModes
Definition: BatchedElementDraw.cpp:147
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void ReportErrorWarning(const char *warningString)
draw a contact point with a given color.
Definition: BatchedElementDraw.cpp:131
void DrawBatchedLines(bool bClear=true)
draw all cached line primitives since last Clear() call.
Definition: BatchedElementDraw.cpp:186
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
virtual PARAVECTOR3 GetRenderOffset()
get current render offset.
Definition: BatchedElementDraw.h:50
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IBatchedElementDraw.h:12
void SortParticles()
sort particle into render passes according to texture.
Definition: BatchedElementDraw.cpp:514
virtual void SetDefaultColor(const PARAVECTOR3 &color)
get the current draw color.
Definition: BatchedElementDraw.h:59
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IParaDebugDraw.h:10
IParaDebugDraw * GetDebugDrawInterface()
deprecated: interface
Definition: BatchedElementDraw.cpp:181
virtual void DrawLine(const PARAVECTOR3 &from, const PARAVECTOR3 &to, const PARAVECTOR3 &color)
draw a line with a given color.
Definition: BatchedElementDraw.cpp:33
Definition: BatchedElementDraw.h:110
similar to unordered array except that it will automatically call addref/Release when obj is added/re...
Definition: unordered_ref_array.h:12
void ClearLines()
clear all cached drawing.
Definition: BatchedElementDraw.cpp:157
virtual void SetRenderOffset(const PARAVECTOR3 &vOffset)
set a render offset.
Definition: BatchedElementDraw.cpp:142
virtual void Draw3dText(const PARAVECTOR3 &location, const char *textString)
draw a text with a given color.
Definition: BatchedElementDraw.cpp:137
base class for a rectangle particle.
Definition: ParticleElement.h:21
virtual void DrawContactPoint(const PARAVECTOR3 &PointOnB, const PARAVECTOR3 &normalOnB, float distance, int lifeTime, const PARAVECTOR3 &color)
draw a contact point with a given color.
Definition: BatchedElementDraw.cpp:126
Definition: PEtypes.h:298
void ClearAll()
call this before scene is reset.
Definition: BatchedElementDraw.cpp:407
static std::vector< char > s_VertexData
tessellation vertex buffer data
Definition: BatchedElementDraw.h:128
Definition: ParaColor.h:275
for drawing special element object(like particles, lines, etc) in the scene.
Definition: BatchedElementDraw.h:15
virtual void AddParticle(CParticleElement *particle)
add a particle.
Definition: BatchedElementDraw.cpp:413
Definition: PEtypes.h:306
virtual void DrawPredefinedLines(const PARAVECTOR3 *lines, int nLineCount, const PARAVECTOR3 &color)
draw multiple lines with a given color using the predefined index order.
Definition: BatchedElementDraw.cpp:89