Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Scene.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /**
19  * File : Scene.h
20  * Project : graphics
21  * Description : This file contains the interfaces that are used to send a
22  * : scene to the renderer, and for the renderer to query objects
23  * : in that scene.
24  *
25  * @note This file would fit just as well into the graphics/ subdirectory.
26  **/
27 
28 #ifndef INCLUDED_SCENE
29 #define INCLUDED_SCENE
30 
31 class CFrustum;
32 class CModel;
33 class CModelAbstract;
34 class CModelDecal;
35 class CParticleEmitter;
36 class CPatch;
37 class CLOSTexture;
38 class CTerritoryTexture;
39 struct SOverlayLine;
41 struct SOverlaySprite;
42 struct SOverlayQuad;
43 
44 class SceneCollector;
45 
46 /**
47  * This interface describes a scene to the renderer.
48  *
49  * @see CRenderer::RenderScene
50  */
51 class Scene
52 {
53 public:
54  virtual ~Scene() {}
55 
56  /**
57  * Send all objects that can be seen when rendering the given frustum
58  * to the scene collector.
59  * @param frustum The frustum that will be used for rendering.
60  * @param c The scene collector that should receive objects inside the frustum
61  * that are visible.
62  */
63  virtual void EnumerateObjects(const CFrustum& frustum, SceneCollector* c) = 0;
64 
65  /**
66  * Return the LOS texture to be used for rendering this scene.
67  */
68  virtual CLOSTexture& GetLOSTexture() = 0;
69 
70  /**
71  * Return the territory texture to be used for rendering this scene.
72  */
74 };
75 
76 
77 /**
78  * This interface accepts renderable objects.
79  *
80  * @see Scene::EnumerateObjects
81  */
83 {
84 public:
85  virtual ~SceneCollector() {}
86 
87  /**
88  * Submit a terrain patch that is part of the scene.
89  */
90  virtual void Submit(CPatch* patch) = 0;
91 
92  /**
93  * Submit a line-based overlay.
94  */
95  virtual void Submit(SOverlayLine* overlay) = 0;
96 
97  /**
98  * Submit a textured line overlay.
99  */
100  virtual void Submit(SOverlayTexturedLine* overlay) = 0;
101 
102  /**
103  * Submit a sprite overlay.
104  */
105  virtual void Submit(SOverlaySprite* overlay) = 0;
106 
107  /**
108  * Submit a textured quad overlay.
109  */
110  virtual void Submit(SOverlayQuad* overlay) = 0;
111 
112  /**
113  * Submit a terrain decal.
114  */
115  virtual void Submit(CModelDecal* decal) = 0;
116 
117  /**
118  * Submit a particle emitter.
119  */
120  virtual void Submit(CParticleEmitter* emitter) = 0;
121 
122  /**
123  * Submit a model that is part of the scene,
124  * without submitting attached models.
125  */
126  virtual void SubmitNonRecursive(CModel* model) = 0;
127 
128  /**
129  * Submit a model that is part of the scene,
130  * including attached sub-models.
131  *
132  * @note This function is implemented using SubmitNonRecursive,
133  * so you shouldn't have to reimplement it.
134  */
135  virtual void SubmitRecursive(CModelAbstract* model);
136 };
137 
138 
139 #endif // INCLUDED_SCENE
Line-based overlay, with world-space coordinates, rendered in the world potentially behind other obje...
Definition: Overlay.h:36
Particle emitter.
Billboard sprite overlay, with world-space coordinates, rendered on top of all other objects...
Definition: Overlay.h:137
virtual CLOSTexture & GetLOSTexture()=0
Return the LOS texture to be used for rendering this scene.
virtual ~Scene()
Definition: Scene.h:54
virtual ~SceneCollector()
Definition: Scene.h:85
virtual void SubmitRecursive(CModelAbstract *model)
Submit a model that is part of the scene, including attached sub-models.
Definition: Scene.cpp:37
virtual void SubmitNonRecursive(CModel *model)=0
Submit a model that is part of the scene, without submitting attached models.
This interface accepts renderable objects.
Definition: Scene.h:82
Textured line overlay, with world-space coordinates, rendered in the world onto the terrain...
Definition: Overlay.h:62
Definition: Patch.h:48
Rectangular single-quad terrain overlay, in world space coordinates.
Definition: Overlay.h:149
Abstract base class for graphical objects that are used by units, or as props attached to other CMode...
Definition: ModelAbstract.h:36
virtual CTerritoryTexture & GetTerritoryTexture()=0
Return the territory texture to be used for rendering this scene.
static size_t model
Definition: x86_x64.cpp:211
This interface describes a scene to the renderer.
Definition: Scene.h:51
Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap...
Definition: LOSTexture.h:32
Definition: Model.h:50
virtual void Submit(CPatch *patch)=0
Submit a terrain patch that is part of the scene.
Maintains the territory boundary texture, used for rendering and for the minimap. ...
virtual void EnumerateObjects(const CFrustum &frustum, SceneCollector *c)=0
Send all objects that can be seen when rendering the given frustum to the scene collector.