My Project
ParticleElement.h
1 #pragma once
2 #include "VertexFVF.h"
3 
4 namespace ParaEngine
5 {
6  struct TextureEntity;
7  struct SPRITEVERTEX;
8  struct SceneState;
9 
13  {
14  Vector2 tc[4];
15  };
16 
22  {
23  public:
24  CParticleElement(){};
25  virtual ~CParticleElement(){};
26 
30  virtual int RenderParticle(SPRITEVERTEX** pVertexBuffer, SceneState* pSceneState) = 0;
31  virtual TextureEntity* GetTexture() = 0;
32  virtual bool IsPointTexture() { return false; }
33  virtual bool IsAlphaTested() { return false; }
34 
35  static inline void SetParticleVertex(SPRITEVERTEX& vert, float x, float y, float z, float u, float v, DWORD color)
36  {
37  vert.p.x = x; vert.p.y = y; vert.p.z = z;
38  vert.tu = u; vert.tv = v; vert.color = color;
39  }
40  protected:
41  TextureEntity* m_pTexture;
42  };
43 
44 
47  {
48  ParticleRenderPass() : texture(NULL), isPointTexture(false), isAlphaTested(false), nMinIndex(0xfffffff), nMaxIndex(0), nCount(0){};
51  {
52  if (baseParticle)
53  {
54  texture = baseParticle->GetTexture();
55  isPointTexture = baseParticle->IsPointTexture();
56  isAlphaTested = baseParticle->IsAlphaTested();
57  }
58  }
59  TextureEntity* GetTexture() { return texture; }
60 
63  {
64  return texture == particle->GetTexture();
65  }
66 
67  void AddParticle(int nParticleIndex)
68  {
69  if (nMinIndex > nParticleIndex)
70  nMinIndex = nParticleIndex;
71  if (nMaxIndex < nParticleIndex)
72  nMaxIndex = nParticleIndex;
73  nCount++;
74  }
75  int32 GetCount() const { return nCount; }
76  int32 GetMinIndex() const { return nMinIndex; }
77  int32 GetMaxIndex() const { return nMaxIndex; }
78  bool IsPointTexture() const { return isPointTexture; }
79  bool IsAlphaTested() const { return isAlphaTested; }
80 
81  int32 nMinIndex;
82  int32 nMaxIndex;
83  int32 nCount;
84  bool isPointTexture;
85  bool isAlphaTested;
86  TextureEntity* texture;
87  };
88 }
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
DWORD color
Vertex color.
Definition: VertexFVF.h:151
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
different physics engine has different winding order.
Definition: EventBinding.h:32
Custom vertex type for the trees.
Definition: VertexFVF.h:146
FLOAT tu
Vertex texture coordinates.
Definition: VertexFVF.h:153
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
Definition: PERef.h:11
bool CheckParticle(CParticleElement *particle)
check if particle belongs to this render pass
Definition: ParticleElement.h:62
particle render pass
Definition: ParticleElement.h:46
base class for a rectangle particle.
Definition: ParticleElement.h:21
Vector3 p
Vertex position.
Definition: VertexFVF.h:149
for pre-calculated UV
Definition: ParticleElement.h:12