mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
spotlight fixes: make more consistent across opengl, dx8, dx9
This commit is contained in:
parent
018e01c326
commit
cca375c2f3
@ -2306,7 +2306,11 @@ bind_light(PointLight *light_obj, const NodePath &light, int light_id) {
|
||||
alight.Position = *(D3DVECTOR *)pos.get_data();
|
||||
|
||||
alight.Range = __D3DLIGHT_RANGE_MAX;
|
||||
alight.Falloff = 1.0f;
|
||||
|
||||
// Not sure why this factor of 60.0f is necessary; I determined it
|
||||
// empirically. It seems to successfully approximate the OpenGL
|
||||
// spotlight equation, at least for reasonably smallish FOV's.
|
||||
alight.Falloff = light_obj->get_exponent() / 60.0f;
|
||||
|
||||
const LVecBase3f &att = light_obj->get_attenuation();
|
||||
alight.Attenuation0 = att[0];
|
||||
|
@ -3456,7 +3456,12 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) {
|
||||
alight.Direction = *(D3DVECTOR *)dir.get_data();
|
||||
|
||||
alight.Range = __D3DLIGHT_RANGE_MAX;
|
||||
alight.Falloff = 1.0f;
|
||||
|
||||
// Not sure why this factor of 60.0f is necessary; I determined it
|
||||
// empirically. It seems to successfully approximate the OpenGL
|
||||
// spotlight equation, at least for reasonably smallish FOV's.
|
||||
alight.Falloff = light_obj->get_exponent() / 60.0f;
|
||||
|
||||
alight.Theta = 0.0f;
|
||||
alight.Phi = deg_2_rad(lens->get_hfov());
|
||||
|
||||
|
@ -3989,7 +3989,7 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) {
|
||||
GLP(Lightfv)(id, GL_SPOT_DIRECTION, dir.get_data());
|
||||
|
||||
GLP(Lightf)(id, GL_SPOT_EXPONENT, light_obj->get_exponent());
|
||||
GLP(Lightf)(id, GL_SPOT_CUTOFF, lens->get_hfov());
|
||||
GLP(Lightf)(id, GL_SPOT_CUTOFF, lens->get_hfov() * 0.5f);
|
||||
|
||||
const LVecBase3f &att = light_obj->get_attenuation();
|
||||
GLP(Lightf)(id, GL_CONSTANT_ATTENUATION, att[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user