ScummVM API documentation
RenderList.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_RENDER_LIST_H
29#define HPL_RENDER_LIST_H
30
31#include "hpl1/engine/graphics/GraphicsTypes.h"
32#include "hpl1/engine/graphics/Material.h"
33#include "hpl1/engine/graphics/OcclusionQuery.h"
34#include "hpl1/engine/graphics/VertexBuffer.h"
35#include "hpl1/engine/math/MathTypes.h"
36#include "hpl1/engine/scene/Light3D.h"
37#include "hpl1/engine/system/SystemTypes.h"
38#include "hpl1/std/multiset.h"
39#include "hpl1/std/set.h"
40
41namespace hpl {
42
43class iRenderable;
44class cCamera3D;
45class cGraphics;
46
47class iRenderState;
48class cRenderSettings;
49
50//-------------------------------------------------------------
51
52enum eRenderListDrawType {
53 eRenderListDrawType_Normal,
54 eRenderListDrawType_Trans,
55 eRenderListDrawType_LastEnum
56};
57
58//-------------------------------------------------------------
59
60class cRenderNode;
61
63public:
64 bool operator()(cRenderNode *apNodeA, cRenderNode *apNodeB) const;
65};
66
68typedef tRenderNodeSet::iterator tRenderNodeSetIt;
69
71public:
72 cRenderNode() : mpState(NULL) {}
73
74 iRenderState *mpState;
75
76 tRenderNodeSet m_setNodes;
77
78 void DeleteChildren();
79 void Render(cRenderSettings *apSettings);
80};
81
82//-------------------------------------------------------------
83
85public:
86 bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
87};
88
90typedef tMotionBlurObjectSet::iterator tMotionBlurObjectSetIt;
91
93 tMotionBlurObjectSetIt>
95
96//-------------------------------------------------------------
97
99public:
100 bool operator()(iRenderable *pObjectA, iRenderable *pObjectB) const;
101};
102
104typedef tTransperantObjectSet::iterator tTransperantObjectSetIt;
105
107
108//-------------------------------------------------------------
109
111public:
112 cOcclusionQueryObject() : mpQuery(NULL), mpVtxBuffer(NULL), mpMatrix(NULL) {}
113
114 iOcclusionQuery *mpQuery;
115 iVertexBuffer *mpVtxBuffer;
116 cMatrixf *mpMatrix;
117 bool mbDepthTest;
118};
119
121public:
122 bool operator()(const cOcclusionQueryObject *pObjectA, const cOcclusionQueryObject *pObjectB) const;
123};
124
126typedef tOcclusionQueryObjectSet::iterator tOcclusionQueryObjectSetIt;
127
129 tOcclusionQueryObjectSetIt>
131
132//-------------------------------------------------------------
133
135typedef tRenderableSet::iterator tRenderableSetIt;
136
138typedef tLight3DSet::iterator tLight3DSetIt;
139
142
143//-------------------------------------------------------------
144
146public:
147 cRenderList(cGraphics *apGraphics);
148 ~cRenderList();
149
150 void SetCamera(cCamera3D *apCamera) { mpCamera = apCamera; }
151 cCamera3D *GetCamera() { return mpCamera; }
152
153 bool Add(iRenderable *apObject);
154 void Clear();
155
156 void AddOcclusionQuery(cOcclusionQueryObject *apObject);
157
158 cOcclusionQueryObjectIterator GetQueryIterator();
159
160 cMotionBlurObjectIterator GetMotionBlurIterator();
161
162 cTransperantObjectIterator GetTransperantIterator();
163
164 cLight3DIterator GetLightIt();
165 cRenderableIterator GetObjectIt();
166
167 int GetLightNum();
168 int GetObjectNum();
169
170 void Compile();
171
172 int GetRenderCount() { return mlRenderCount; }
173 int GetLastRenderCount() { return mlLastRenderCount; }
174
175 int GetLightObjects(int alLightIdx) { return mvObjectsPerLight[alLightIdx]; }
176
177 void SetFrameTime(float afTime) { mfFrameTime = afTime; }
178
179 cRenderNode *GetRootNode(eRenderListDrawType aObjectType, eMaterialRenderType aPassType, int alLightNum);
180
181 static inline int GetGlobalRenderCount() { return mlGlobalRenderCount; }
182
183private:
184 cRenderNode *InsertNode(cRenderNode *apListNode, cRenderNode *apTempNode);
185
186 void AddToTree(iRenderable *apObject, eRenderListDrawType aObjectType,
187 eMaterialRenderType mPassType, int alLightNum, iLight3D *apLight,
188 bool abUseDepth, int alPass);
189
190 static int mlGlobalRenderCount;
191
192 tLight3DSet m_setLights;
193 int mvObjectsPerLight[MAX_NUM_OF_LIGHTS];
194
195 tRenderableSet m_setObjects;
196
197 tOcclusionQueryObjectSet m_setQueries;
198
199 tMotionBlurObjectSet m_setMotionBlurObjects;
200 tTransperantObjectSet m_setTransperantObjects;
201
202 cRenderNode mRootNodeDepth;
203 cRenderNode mRootNodeDiffuse;
204 cRenderNode mRootNodeLight[MAX_NUM_OF_LIGHTS];
205 cRenderNode mRootNodeTrans;
206
207 cRenderNode mTempNode;
208
209 int mlRenderCount;
210 int mlLastRenderCount;
211
212 float mfFrameTime;
213
214 cMemoryPool<iRenderState> *m_poolRenderState;
215 cMemoryPool<cRenderNode> *m_poolRenderNode;
216
217 cCamera3D *mpCamera;
218
219 cGraphics *mpGraphics;
220};
221
222} // namespace hpl
223
224#endif // HPL_RENDER_LIST_H
Definition: Camera3D.h:53
Definition: Graphics.h:46
Definition: SystemTypes.h:262
Definition: RenderList.h:84
Definition: RenderList.h:120
Definition: RenderList.h:110
Definition: RenderList.h:145
Definition: RenderList.h:62
Definition: RenderList.h:70
Definition: Renderer3D.h:77
Definition: SystemTypes.h:411
Definition: RenderList.h:98
Definition: Light3D.h:117
Definition: OcclusionQuery.h:33
Definition: RenderState.h:62
Definition: Renderable.h:70
Definition: VertexBuffer.h:90