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