My Project
SortedFaceGroups.h
1 #pragma once
2 
3 #include <vector>
4 #include <list>
5 #include "ParaXModel/ParaXModel.h"
6 
7 namespace ParaEngine
8 {
9  struct TextureEntity;
10 
11  using namespace std;
12 
13 
19  class CFaceGroup
20  {
21  public:
22  CFaceGroup();
23 
25  // render parameters
26  bool m_alphaBlending;
27  bool m_alphaTesting;
28  bool m_disableZWrite;
29  bool m_bHasLighting;
30  bool m_bAdditive;
31  bool m_bSkinningAni;
32 
33  TextureEntity* m_pTexture;
34  // materials.
35  ParaMaterial m_material;
36  // the larger, the later to to be rendered. In most cases, this is always 0.
37  int m_order;
38 
39  // center of mass position in object space. This value multiplied by the instance transform matrix is used to determine the camera to face distance.
40  Vector3 m_vCenterPos;
41 
43  // triangle list: vertices, normals, texture coordinate set 1.
44  int m_nNumTriangles;
45  vector <Vector3> m_vertices;
46  vector <Vector3> m_normals;
47  vector <Vector2> m_UVs;
48  vector <uint32> m_vertexWeights;
49  vector <uint32> m_boneIndices;
50 
51  float m_stripLength;
52  public:
54  void UpdateCenterPos();
55  };
56 
63  {
64  public:
66  CFaceGroupInstance(const Matrix4* pMat, CFaceGroup* faceGroup);
67 
70 
73 
77  /* in most cases, this is (0,0,0) */
78  Vector3 m_vUVRotate;
79  /* in most cases, this is (1.0f, 1.0f) */
80  Vector2 m_vUVScale;
81 
84 
86  float m_fAlpha;
87 
88  bool m_UVRgbAnim;
89 
90  Bone *m_bones;
91  };
92 
103  {
104  public:
105  typedef std::vector<CFaceGroupInstance> FaceGroups_Type;
106  CSortedFaceGroups(void);
107  ~CSortedFaceGroups(void);
108 
109  public:
111  void AddFaceGroup(const CFaceGroupInstance& facegroup);
112 
114  void Sort(const Vector3& vCameraPos);
115 
117  bool IsSorted(){return m_sorted;}
118 
120  void Render();
121 
123  void Clear();
124 
126  bool IsEmpty() {return m_sortedFaceGroups.empty();};
127  private:
129  FaceGroups_Type m_sortedFaceGroups;
130 
132  bool m_sorted;
133  };
134 
135 }
136 
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
float m_fAlpha
the alpha value in [0,1]
Definition: SortedFaceGroups.h:86
Matrix4 m_transform
transform of the face group instance.
Definition: SortedFaceGroups.h:72
different physics engine has different winding order.
Definition: EventBinding.h:32
bool IsEmpty()
check if empty.
Definition: SortedFaceGroups.h:126
float m_fToCameraDistSq
distance square to camera.
Definition: SortedFaceGroups.h:69
a single animated bone, it contains both the bone instance data and all animation data of the bone...
Definition: ParaXBone.h:15
face group is similar to render pass in ParaXModel, or sub mesh in StaticMesh.
Definition: SortedFaceGroups.h:19
CFaceGroup * m_facegroup
pointer to the data of the face group.
Definition: SortedFaceGroups.h:83
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
bool IsSorted()
whether faces is sorted from back to front.
Definition: SortedFaceGroups.h:117
an instance of the face group: it contains the face group static data, and per-instance data...
Definition: SortedFaceGroups.h:62
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
Definition: RenderCore.h:50
Vector2 m_vUVOffset
in case there is an UV animation applied to this face group.
Definition: SortedFaceGroups.h:76
This class provides sorting and rendering of translucent face groups.
Definition: SortedFaceGroups.h:102