Pyrogenesis  trunk
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 struct SOverlaySphere;
44 
45 class SceneCollector;
46 
47 /**
48  * This interface describes a scene to the renderer.
49  *
50  * @see CRenderer::RenderScene
51  */
52 class Scene
53 {
54 public:
55  virtual ~Scene() {}
56 
57  /**
58  * Send all objects that can be seen when rendering the given frustum
59  * to the scene collector.
60  * @param frustum The frustum that will be used for rendering.
61  * @param c The scene collector that should receive objects inside the frustum
62  * that are visible.
63  */
64  virtual void EnumerateObjects(const CFrustum& frustum, SceneCollector* c) = 0;
65 
66  /**
67  * Return the LOS texture to be used for rendering this scene.
68  */
69  virtual CLOSTexture& GetLOSTexture() = 0;
70 
71  /**
72  * Return the territory texture to be used for rendering this scene.
73  */
75 };
76 
77 
78 /**
79  * This interface accepts renderable objects.
80  *
81  * @see Scene::EnumerateObjects
82  */
84 {
85 public:
86  virtual ~SceneCollector() {}
87 
88  /**
89  * Submit a terrain patch that is part of the scene.
90  */
91  virtual void Submit(CPatch* patch) = 0;
92 
93  /**
94  * Submit a line-based overlay.
95  */
96  virtual void Submit(SOverlayLine* overlay) = 0;
97 
98  /**
99  * Submit a textured line overlay.
100  */
101  virtual void Submit(SOverlayTexturedLine* overlay) = 0;
102 
103  /**
104  * Submit a sprite overlay.
105  */
106  virtual void Submit(SOverlaySprite* overlay) = 0;
107 
108  /**
109  * Submit a textured quad overlay.
110  */
111  virtual void Submit(SOverlayQuad* overlay) = 0;
112 
113  /**
114  * Submit a sphere overlay.
115  */
116  virtual void Submit(SOverlaySphere* overlay) = 0;
117 
118  /**
119  * Submit a terrain decal.
120  */
121  virtual void Submit(CModelDecal* decal) = 0;
122 
123  /**
124  * Submit a particle emitter.
125  */
126  virtual void Submit(CParticleEmitter* emitter) = 0;
127 
128  /**
129  * Submit a model that is part of the scene,
130  * without submitting attached models.
131  */
132  virtual void SubmitNonRecursive(CModel* model) = 0;
133 
134  /**
135  * Submit a model that is part of the scene,
136  * including attached sub-models.
137  *
138  * @note This function is implemented using SubmitNonRecursive,
139  * so you shouldn't have to reimplement it.
140  */
141  virtual void SubmitRecursive(CModelAbstract* model);
142 };
143 
144 
145 #endif // INCLUDED_SCENE
Line-based overlay, with world-space coordinates, rendered in the world potentially behind other obje...
Definition: Overlay.h:35
Particle emitter.
Definition: ParticleEmitter.h:67
Definition: Frustum.h:39
Billboard sprite overlay, with world-space coordinates, rendered on top of all other objects...
Definition: Overlay.h:136
virtual CLOSTexture & GetLOSTexture()=0
Return the LOS texture to be used for rendering this scene.
virtual ~Scene()
Definition: Scene.h:55
virtual ~SceneCollector()
Definition: Scene.h:86
This interface accepts renderable objects.
Definition: Scene.h:83
Textured line overlay, with world-space coordinates, rendered in the world onto the terrain...
Definition: Overlay.h:61
Definition: Patch.h:48
Rectangular single-quad terrain overlay, in world space coordinates.
Definition: Overlay.h:149
Definition: Decal.h:50
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:221
This interface describes a scene to the renderer.
Definition: Scene.h:52
Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap...
Definition: LOSTexture.h:32
Definition: Model.h:48
Maintains the territory boundary texture, used for rendering and for the minimap. ...
Definition: TerritoryTexture.h:29
Definition: Overlay.h:157
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.