37 virtual void SetAmbient(cpu_vec_xyzw ambient) = 0;
38 virtual void SetDiffuse(cpu_vec_xyzw diffuse) = 0;
39 virtual void SetSpecular(cpu_vec_xyzw specular) = 0;
40 virtual void SetPosition(cpu_vec_xyzw position) = 0;
41 virtual void SetDirection(cpu_vec_xyzw direction) = 0;
42 virtual void SetSpotDirection(cpu_vec_xyzw dir) = 0;
43 virtual void SetSpotCutoff(
float cutoff) = 0;
44 virtual void SetSpotExponent(
float exp) = 0;
45 virtual void SetConstantAtten(
float atten) = 0;
46 virtual void SetLinearAtten(
float atten) = 0;
47 virtual void SetQuadAtten(
float atten) = 0;
49 virtual void SetEnabled(
bool yesNo) = 0;
57 cpu_vec_xyzw Ambient, Diffuse, Specular;
58 cpu_vec_xyzw Position, SpotDirection;
59 float SpotCutoff, SpotExponent;
60 float ConstantAtten, LinearAtten, QuadAtten;
66 static int NumLights[3];
68 inline void TellRendererLightPropChanged()
70 GLContext.LightPropChanged();
73 void CheckTypeChange(tLightType oldType);
78 void SetAmbient(cpu_vec_xyzw ambient)
81 TellRendererLightPropChanged();
83 void SetDiffuse(cpu_vec_xyzw diffuse)
86 TellRendererLightPropChanged();
88 void SetSpecular(cpu_vec_xyzw specular);
89 void SetPosition(cpu_vec_xyzw position);
90 void SetDirection(cpu_vec_xyzw direction);
92 void SetSpotDirection(cpu_vec_xyzw dir)
95 TellRendererLightPropChanged();
97 void SetSpotCutoff(
float cutoff)
99 tLightType oldType = Type;
100 if (Type != kDirectional)
101 Type = (cutoff == 180.0f) ? kPoint : kSpot;
102 CheckTypeChange(oldType);
104 TellRendererLightPropChanged();
106 void SetSpotExponent(
float exp)
109 TellRendererLightPropChanged();
112 void SetConstantAtten(
float atten)
114 ConstantAtten = atten;
115 TellRendererLightPropChanged();
117 void SetLinearAtten(
float atten)
120 TellRendererLightPropChanged();
122 void SetQuadAtten(
float atten)
125 TellRendererLightPropChanged();
128 void SetEnabled(
bool enabled);
130 inline cpu_vec_xyzw GetAmbient()
const {
return Ambient; }
131 inline cpu_vec_xyzw GetDiffuse()
const {
return Diffuse; }
132 inline cpu_vec_xyzw GetSpecular()
const {
return Specular; }
133 inline cpu_vec_xyzw GetPosition()
const {
return Position; }
135 inline cpu_vec_xyzw GetSpotDir()
const {
return SpotDirection; }
136 inline float GetSpotCutoff()
const {
return SpotCutoff; }
137 inline float GetSpotExponent()
const {
return SpotExponent; }
139 inline float GetConstantAtten()
const {
return ConstantAtten; }
140 inline float GetLinearAtten()
const {
return LinearAtten; }
141 inline float GetQuadAtten()
const {
return QuadAtten; }
143 inline bool IsEnabled()
const {
return bIsEnabled; }
144 inline bool IsDirectional()
const {
return (Type == kDirectional); }
145 inline bool IsPoint()
const {
return (Type == kPoint); }
146 inline bool IsSpot()
const {
return (Type == kSpot); }
154 inline void TellRendererLightPropChanged()
156 GLContext.LightPropChanged();
158 inline void TellRendererLightsEnabledChanged()
160 GLContext.NumLightsChanged();
165 :
CLight(context, lightNum)
169 void SetAmbient(cpu_vec_xyzw ambient);
170 void SetDiffuse(cpu_vec_xyzw diffuse);
171 void SetSpecular(cpu_vec_xyzw specular);
172 void SetPosition(cpu_vec_xyzw position);
173 void SetDirection(cpu_vec_xyzw direction);
175 void SetSpotDirection(cpu_vec_xyzw dir);
176 void SetSpotCutoff(
float cutoff);
177 void SetSpotExponent(
float exp);
179 void SetConstantAtten(
float atten);
180 void SetLinearAtten(
float atten);
181 void SetQuadAtten(
float atten);
183 void SetEnabled(
bool yesNo);
215 cpu_vec_xyzw CurrentColor;
216 cpu_vec_xyzw GlobalAmbient;
217 CImmLight Light0, Light1, Light2, Light3, Light4, Light5, Light6, Light7;
220 int NumLightsWithNonzeroSpecular;
222 inline void TellRendererLightPropChanged()
224 GLContext.LightPropChanged();
232 mAssert(num < NumLights);
235 CLight& GetLight(
int num) {
return GetImmLight(num); }
237 void SetLightingEnabled(
bool enabled)
239 GLContext.LightingEnabledChanged();
240 GLContext.GetImmGeomManager().GetRendererManager().LightingEnabledChanged(enabled);
243 bool GetLightingEnabled()
const {
return IsEnabled; }
245 void SetGlobalAmbient(cpu_vec_xyzw newAmb)
247 GlobalAmbient = newAmb;
248 TellRendererLightPropChanged();
250 cpu_vec_xyzw GetGlobalAmbient() {
return GlobalAmbient; }
252 void SpecularChanged();
253 void MaterialHasSpecular();
261 CDListLight Light0, Light1, Light2, Light3, Light4, Light5, Light6, Light7;
264 inline void TellRendererLightPropChanged()
266 GLContext.LightPropChanged();
274 mAssert(num < NumLights);
277 CLight& GetLight(
int num) {
return GetDListLight(num); }
279 void SetLightingEnabled(
bool enabled);
280 void SetGlobalAmbient(cpu_vec_xyzw newAmb);