ScummVM API documentation
Light3DSpot.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_LIGHT3D_SPOT_H
29#define HPL_LIGHT3D_SPOT_H
30
31#include "hpl1/engine/scene/Light3D.h"
32
33namespace hpl {
34
35class cResources;
36class iTexture;
37class cFrustum;
38
39//------------------------------------------
40
41kSaveData_ChildClass(iLight3D, cLight3DSpot) {
42 kSaveData_ClassInit(cLight3DSpot) public : tString msTexture;
43
44 float mfFOV;
45 float mfAspect;
46 float mfNearClipPlane;
47
48 virtual iSaveObject *CreateSaveObject(cSaveObjectHandler * apSaveObjectHandler, cGame * apGame);
49 virtual int GetSaveCreatePrio();
50};
51
52//------------------------------------------
53
54class cLight3DSpot : public iLight3D {
55 typedef iLight3D super;
56
57public:
58 cLight3DSpot(tString asName, cResources *apResources);
60
61 const cMatrixf &GetViewMatrix();
62 const cMatrixf &GetProjectionMatrix();
63 const cMatrixf &GetViewProjMatrix();
64
65 void SetTexture(iTexture *apTexture);
66 iTexture *GetTexture();
67
68 void SetFOV(float afAngle) {
69 mfFOV = afAngle;
70 mbProjectionUpdated = true;
71 }
72 float GetFOV() { return mfFOV; }
73
74 void SetAspect(float afAngle) {
75 mfAspect = afAngle;
76 mbProjectionUpdated = true;
77 }
78 float GetAspect() { return mfAspect; }
79
80 void SetNearClipPlane(float afX) {
81 mfNearClipPlane = afX;
82 mbProjectionUpdated = true;
83 }
84 float GetNearClipPlane() { return mfNearClipPlane; }
85
86 void SetFarAttenuation(float afX);
87 void SetNearAttenuation(float afX);
88
89 cFrustum *GetFrustum();
90
91 bool CollidesWithBV(cBoundingVolume *apBV);
92
93 // SaveObject implementation
95 virtual void SaveToSaveData(iSaveData *apSaveData);
96 virtual void LoadFromSaveData(iSaveData *apSaveData);
97 virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
98
99private:
100 cSectorVisibilityContainer *CreateSectorVisibility();
101 void ExtraXMLProperties(TiXmlElement *apMainElem);
102 void UpdateBoundingVolume();
103 bool CreateClipRect(cRect2l &aCliprect, cRenderSettings *apRenderSettings, iLowLevelGraphics *apLowLevelGraphics);
104
105 cMatrixf m_mtxProjection;
106 cMatrixf m_mtxViewProj;
107 cMatrixf m_mtxView;
108
109 cFrustum *mpFrustum;
110
111 iTexture *mpTexture;
112
113 float mfFOV;
114 float mfAspect;
115 float mfNearClipPlane;
116
117 bool mbProjectionUpdated;
118 bool mbViewProjUpdated;
119 bool mbFrustumUpdated;
120
121 int mlViewProjMatrixCount;
122 int mlViewMatrixCount;
123 int mlFrustumMatrixCount;
124};
125
126} // namespace hpl
127
128#endif // HPL_LIGHT3D_SPOT_H
Definition: str.h:59
Definition: tinyxml.h:864
Definition: BoundingVolume.h:71
Definition: Frustum.h:57
Definition: Game.h:91
Definition: Light3DSpot.h:54
virtual void SaveToSaveData(iSaveData *apSaveData)
virtual iSaveData * CreateSaveData()
virtual void LoadFromSaveData(iSaveData *apSaveData)
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
Definition: Renderer3D.h:77
Definition: Resources.h:160
Definition: SaveGame.h:183
Definition: SectorVisibility.h:136
Definition: Entity3D.h:81
Definition: Light3D.h:117
Definition: LowLevelGraphics.h:200
Definition: SaveGame.h:111
Definition: Texture.h:88