xoreos  0.0.5
renderman.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "glm/gtc/type_ptr.hpp"
26 
28 
30 
31 namespace Graphics {
32 
33 namespace Render {
34 
35 RenderManager::RenderManager() : _sortingHints(SORT_HINT_NORMAL) {
36 }
37 
39 }
40 
42  _sortingHints = hint;
43 }
44 
45 void RenderManager::setCameraReference(const glm::vec3 &reference) {
51 }
52 
53 void RenderManager::queueRenderable(Shader::ShaderRenderable *renderable, const glm::mat4 *transform, float alpha) {
54  uint32 flags = renderable->getMaterial()->getFlags();
56  _queueColorSolidDecal.queueItem(renderable, transform, alpha);
59  _queueColorTransparentSecondary.queueItem(renderable, transform, alpha);
60  } else {
61  _queueColorTransparentPrimary.queueItem(renderable, transform, alpha);
62  }
63  } else {
65  _queueColorSolidPrimary.queueItem(renderable, transform, alpha);
66  } else if (renderable->getMesh()->getVertexBuffer()->getCount() > 6) {
67  _queueColorSolidSecondary.queueItem(renderable, transform, alpha);
68  } else {
69  _queueColorSolidDecal.queueItem(renderable, transform, alpha);
70  }
71  }
72 }
73 
75  switch (_sortingHints) {
76  case SORT_HINT_NORMAL:
82  break;
83  case SORT_HINT_ALLDEPTH:
89  break;
90  default: break;
91  }
92 }
93 
100 }
101 
108 }
109 
110 } // namespace Render
111 
112 } // namespace Graphics
uint32 getCount() const
Get vertex count.
void clear()
Clear the queue of all items.
VertexBuffer * getVertexBuffer()
Definition: mesh.cpp:39
void setSortingHint(SortingHints hint)
Definition: renderman.cpp:41
Render hint; material has no transparency.
void setCameraReference(const glm::vec3 &reference)
Definition: renderman.cpp:45
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
Definition: singleton.h:122
RenderQueue _queueColorTransparentPrimary
Definition: renderman.h:70
Material definitely has transparency.
void sortShader()
Sort queue elements by shader program.
Definition: renderqueue.cpp:92
void queueItem(Shader::ShaderProgram *program, Shader::ShaderSurface *surface, Shader::ShaderMaterial *material, Mesh::Mesh *mesh, const glm::mat4 *transform, float alpha)
Definition: renderqueue.cpp:71
RenderQueue _queueColorSolidPrimary
Definition: renderman.h:67
Material definitely has transparency.
Render queue manager.
void sortDepth()
Sort queue elements by depth.
Definition: renderqueue.cpp:98
uint32_t uint32
Definition: types.h:204
RenderQueue _queueColorTransparentSecondary
Definition: renderman.h:71
void queueRenderable(Shader::ShaderRenderable *renderable, const glm::mat4 *transform, float alpha)
Definition: renderman.cpp:53
void render()
Render all queued items.
void setCameraReference(const glm::vec3 &reference)
Definition: renderqueue.cpp:67
RenderQueue _queueColorSolidSecondary
Definition: renderman.h:68