Merge 'remotes/trunk'
[0ad.git] / source / renderer / Scene.h
blobb7ac24eb83adcb73a189dcacae55ab375e146c7b
1 /* Copyright (C) 2011 Wildfire Games.
2 * This file is part of 0 A.D.
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.
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.
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/>.
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.
25 * @note This file would fit just as well into the graphics/ subdirectory.
26 **/
28 #ifndef INCLUDED_SCENE
29 #define INCLUDED_SCENE
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;
40 struct SOverlayTexturedLine;
41 struct SOverlaySprite;
42 struct SOverlayQuad;
43 struct SOverlaySphere;
45 class SceneCollector;
47 /**
48 * This interface describes a scene to the renderer.
50 * @see CRenderer::RenderScene
52 class Scene
54 public:
55 virtual ~Scene() {}
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.
64 virtual void EnumerateObjects(const CFrustum& frustum, SceneCollector* c) = 0;
66 /**
67 * Return the LOS texture to be used for rendering this scene.
69 virtual CLOSTexture& GetLOSTexture() = 0;
71 /**
72 * Return the territory texture to be used for rendering this scene.
74 virtual CTerritoryTexture& GetTerritoryTexture() = 0;
78 /**
79 * This interface accepts renderable objects.
81 * @see Scene::EnumerateObjects
83 class SceneCollector
85 public:
86 virtual ~SceneCollector() {}
88 /**
89 * Submit a terrain patch that is part of the scene.
91 virtual void Submit(CPatch* patch) = 0;
93 /**
94 * Submit a line-based overlay.
96 virtual void Submit(SOverlayLine* overlay) = 0;
98 /**
99 * Submit a textured line overlay.
101 virtual void Submit(SOverlayTexturedLine* overlay) = 0;
104 * Submit a sprite overlay.
106 virtual void Submit(SOverlaySprite* overlay) = 0;
109 * Submit a textured quad overlay.
111 virtual void Submit(SOverlayQuad* overlay) = 0;
114 * Submit a sphere overlay.
116 virtual void Submit(SOverlaySphere* overlay) = 0;
119 * Submit a terrain decal.
121 virtual void Submit(CModelDecal* decal) = 0;
124 * Submit a particle emitter.
126 virtual void Submit(CParticleEmitter* emitter) = 0;
129 * Submit a model that is part of the scene,
130 * without submitting attached models.
132 virtual void SubmitNonRecursive(CModel* model) = 0;
135 * Submit a model that is part of the scene,
136 * including attached sub-models.
138 * @note This function is implemented using SubmitNonRecursive,
139 * so you shouldn't have to reimplement it.
141 virtual void SubmitRecursive(CModelAbstract* model);
145 #endif // INCLUDED_SCENE