ScummVM API documentation
Light.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_LIGHT_H
29 #define HPL_LIGHT_H
30 
31 #include "hpl1/engine/graphics/GraphicsTypes.h"
32 
33 namespace hpl {
34 
35 class iLowLevelGraphics;
36 class cWorld3D;
37 
38 class iLight {
39 public:
40  iLight();
41  virtual ~iLight() = default;
42 
44  // Fading
45  void FadeTo(const cColor &aCol, float afRadius, float afTime);
46  bool IsFading();
47  cColor GetDestColor() { return mDestCol; }
48  float GetDestRadius() { return mfDestRadius; }
49 
51  // FLickering
52  void SetFlickerActive(bool abX);
53  bool GetFlickerActive() { return mbFlickering; }
54 
55  void SetFlicker(const cColor &aOffCol, float afOffRadius,
56  float afOnMinLength, float afOnMaxLength, const tString &asOnSound, const tString &asOnPS,
57  float afOffMinLength, float afOffMaxLength, const tString &asOffSound, const tString &asOffPS,
58  bool abFade, float afOnFadeLength, float afOffFadeLength);
59 
60  tString GetFlickerOffSound() { return msFlickerOffSound; }
61  tString GetFlickerOnSound() { return msFlickerOnSound; }
62  tString GetFlickerOffPS() { return msFlickerOffPS; }
63  tString GetFlickerOnPS() { return msFlickerOnPS; }
64  float GetFlickerOnMinLength() { return mfFlickerOnMinLength; }
65  float GetFlickerOffMinLength() { return mfFlickerOffMinLength; }
66  float GetFlickerOnMaxLength() { return mfFlickerOnMaxLength; }
67  float GetFlickerOffMaxLength() { return mfFlickerOffMaxLength; }
68  cColor GetFlickerOffColor() { return mFlickerOffColor; }
69  float GetFlickerOffRadius() { return mfFlickerOffRadius; }
70  bool GetFlickerFade() { return mbFlickerFade; }
71  float GetFlickerOnFadeLength() { return mfFlickerOnFadeLength; }
72  float GetFlickerOffFadeLength() { return mfFlickerOffFadeLength; }
73 
74  cColor GetFlickerOnColor() { return mFlickerOnColor; }
75  float GetFlickerOnRadius() { return mfFlickerOnRadius; }
76 
78  // Properties
79  const cColor &GetDiffuseColor() { return mDiffuseColor; }
80  void SetDiffuseColor(cColor aColor);
81  const cColor &GetSpecularColor() { return mSpecularColor; }
82  void SetSpecularColor(cColor aColor) { mSpecularColor = aColor; }
83 
84  float GetIntensity() { return mfIntensity; }
85  void SetIntensity(float afX) { mfIntensity = afX; }
86  bool GetCastShadows() { return mbCastShadows; }
87  void SetCastShadows(bool afX) { mbCastShadows = afX; }
88 
89  bool GetAffectMaterial() { return mbAffectMaterial; }
90  void SetAffectMaterial(bool afX) { mbAffectMaterial = afX; }
91 
92  float GetFarAttenuation() { return mfFarAttenuation; }
93  float GetNearAttenuation() { return mfNearAttenuation; }
94 
95  virtual void SetFarAttenuation(float afX) = 0;
96  virtual void SetNearAttenuation(float afX) = 0;
97 
98  float GetSourceRadius() { return mfSourceRadius; }
99  void SetSourceRadius(float afX) { mfSourceRadius = afX; }
100 
101  virtual cVector3f GetLightPosition() = 0;
102 
103  void UpdateLight(float afTimeStep);
104 
105  void SetWorld3D(cWorld3D *apWorld) { mpWorld3D = apWorld; }
106 
107 protected:
108  virtual void OnFlickerOff() {}
109  virtual void OnFlickerOn() {}
110  virtual void OnSetDiffuse() {}
111 
112  cColor mDiffuseColor;
113  cColor mSpecularColor;
114  float mfIntensity;
115  float mfFarAttenuation;
116  float mfNearAttenuation;
117  float mfSourceRadius;
118 
119  bool mbCastShadows;
120  bool mbAffectMaterial;
121 
122  cWorld3D *mpWorld3D;
123 
125  // Fading.
126  cColor mColAdd;
127  float mfRadiusAdd;
128  cColor mDestCol;
129  float mfDestRadius;
130  float mfFadeTime;
131 
133  // Flicker
134  bool mbFlickering;
135  tString msFlickerOffSound;
136  tString msFlickerOnSound;
137  tString msFlickerOffPS;
138  tString msFlickerOnPS;
139  float mfFlickerOnMinLength;
140  float mfFlickerOffMinLength;
141  float mfFlickerOnMaxLength;
142  float mfFlickerOffMaxLength;
143  cColor mFlickerOffColor;
144  float mfFlickerOffRadius;
145  bool mbFlickerFade;
146  float mfFlickerOnFadeLength;
147  float mfFlickerOffFadeLength;
148 
149  cColor mFlickerOnColor;
150  float mfFlickerOnRadius;
151 
152  bool mbFlickerOn;
153  float mfFlickerTime;
154  float mfFlickerStateLength;
155 };
156 
157 } // namespace hpl
158 
159 #endif // HPL_LIGHT_H
Definition: AI.h:36
Definition: str.h:59
Definition: Light.h:38
Definition: World3D.h:179
Definition: Color.h:37