From c9434c5b8506c64014eee6544c847ce51402e0c2 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 10 Sep 2015 15:30:24 +0200 Subject: [PATCH] Fix shadowed light copy constructor, fix point light lens orientations --- panda/src/pgraphnodes/lightLensNode.cxx | 13 +++++------ panda/src/pgraphnodes/pointLight.cxx | 29 +++++-------------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/panda/src/pgraphnodes/lightLensNode.cxx b/panda/src/pgraphnodes/lightLensNode.cxx index bead7ecf01..c26f0cd9c4 100644 --- a/panda/src/pgraphnodes/lightLensNode.cxx +++ b/panda/src/pgraphnodes/lightLensNode.cxx @@ -62,15 +62,12 @@ LightLensNode:: LightLensNode:: LightLensNode(const LightLensNode ©) : Light(copy), - Camera(copy) + Camera(copy), + _shadow_caster(copy._shadow_caster), + _sb_xsize(copy._sb_xsize), + _sb_ysize(copy._sb_ysize), + _sb_sort(-10) { - _shadow_caster = false; - _sb_xsize = 512; - _sb_ysize = 512; - _sb_sort = -10; - // Backface culling helps eliminating artifacts. - set_initial_state(RenderState::make(CullFaceAttrib::make_reverse(), - ColorWriteAttrib::make(ColorWriteAttrib::C_off))); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraphnodes/pointLight.cxx b/panda/src/pgraphnodes/pointLight.cxx index 5ac0c8885c..20fb1dbd1e 100644 --- a/panda/src/pgraphnodes/pointLight.cxx +++ b/panda/src/pgraphnodes/pointLight.cxx @@ -69,22 +69,22 @@ PointLight(const string &name) : { PT(Lens) lens; lens = new PerspectiveLens(90, 90); - lens->set_view_vector(1, 0, 0, 0, 0, 1); + lens->set_view_vector(1, 0, 0, 0, -1, 0); set_lens(0, lens); lens = new PerspectiveLens(90, 90); - lens->set_view_vector(-1, 0, 0, 0, 0, 1); + lens->set_view_vector(-1, 0, 0, 0, -1, 0); set_lens(1, lens); lens = new PerspectiveLens(90, 90); lens->set_view_vector(0, 1, 0, 0, 0, 1); set_lens(2, lens); lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, -1, 0, 0, 0, 1); + lens->set_view_vector(0, -1, 0, 0, 0, -1); set_lens(3, lens); lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, 0, 1, 0, 0, 1); + lens->set_view_vector(0, 0, 1, 0, -1, 0); set_lens(4, lens); lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, 0, -1, 0, 0, 1); + lens->set_view_vector(0, 0, -1, 0, -1, 0); set_lens(5, lens); } @@ -100,25 +100,6 @@ PointLight(const PointLight ©) : LightLensNode(copy), _cycler(copy._cycler) { - PT(Lens) lens; - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(1, 0, 0, 0, 0, 1); - set_lens(0, lens); - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(-1, 0, 0, 0, 0, 1); - set_lens(1, lens); - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, 1, 0, 0, 0, 1); - set_lens(2, lens); - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, -1, 0, 0, 0, 1); - set_lens(3, lens); - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, 0, 1, 0, 0, 1); - set_lens(4, lens); - lens = new PerspectiveLens(90, 90); - lens->set_view_vector(0, 0, -1, 0, 0, 1); - set_lens(5, lens); } ////////////////////////////////////////////////////////////////////