mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
better dx / gl equivalence
This commit is contained in:
parent
9eb3e9fa24
commit
0ba777cc0f
@ -2406,13 +2406,14 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) {
|
|||||||
|
|
||||||
alight.Range = __D3DLIGHT_RANGE_MAX;
|
alight.Range = __D3DLIGHT_RANGE_MAX;
|
||||||
|
|
||||||
// Not sure why this factor of 60.0f is necessary; I determined it
|
// I determined this formular empirically. It seems to mostly
|
||||||
// empirically. It seems to successfully approximate the OpenGL
|
// approximate the OpenGL spotlight equation, for a reasonable range
|
||||||
// spotlight equation, at least for reasonably smallish FOV's.
|
// of values for FOV.
|
||||||
alight.Falloff = light_obj->get_exponent() / 60.0f;
|
float fov = lens->get_hfov();
|
||||||
|
alight.Falloff = light_obj->get_exponent() * (fov * fov * fov) / 1620000.0f;
|
||||||
|
|
||||||
alight.Theta = 0.0f;
|
alight.Theta = 0.0f;
|
||||||
alight.Phi = deg_2_rad(lens->get_hfov());
|
alight.Phi = deg_2_rad(fov);
|
||||||
|
|
||||||
const LVecBase3f &att = light_obj->get_attenuation();
|
const LVecBase3f &att = light_obj->get_attenuation();
|
||||||
alight.Attenuation0 = att[0];
|
alight.Attenuation0 = att[0];
|
||||||
|
@ -3457,13 +3457,14 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) {
|
|||||||
|
|
||||||
alight.Range = __D3DLIGHT_RANGE_MAX;
|
alight.Range = __D3DLIGHT_RANGE_MAX;
|
||||||
|
|
||||||
// Not sure why this factor of 60.0f is necessary; I determined it
|
// I determined this formular empirically. It seems to mostly
|
||||||
// empirically. It seems to successfully approximate the OpenGL
|
// approximate the OpenGL spotlight equation, for a reasonable range
|
||||||
// spotlight equation, at least for reasonably smallish FOV's.
|
// of values for FOV.
|
||||||
alight.Falloff = light_obj->get_exponent() / 60.0f;
|
float fov = lens->get_hfov();
|
||||||
|
alight.Falloff = light_obj->get_exponent() * (fov * fov * fov) / 1620000.0f;
|
||||||
|
|
||||||
alight.Theta = 0.0f;
|
alight.Theta = 0.0f;
|
||||||
alight.Phi = deg_2_rad(lens->get_hfov());
|
alight.Phi = deg_2_rad(fov);
|
||||||
|
|
||||||
const LVecBase3f &att = light_obj->get_attenuation();
|
const LVecBase3f &att = light_obj->get_attenuation();
|
||||||
alight.Attenuation0 = att[0];
|
alight.Attenuation0 = att[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user