mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Add shadow interfaces to PointLight - actual implementation not complete yet
This commit is contained in:
parent
30565b916a
commit
bf444742fe
@ -21,6 +21,16 @@ INLINE PerspectiveLens::
|
|||||||
PerspectiveLens() {
|
PerspectiveLens() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PerspectiveLens::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PerspectiveLens::
|
||||||
|
PerspectiveLens(float hfov, float vfov) {
|
||||||
|
_fov.set(hfov, vfov);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: PerspectiveLens::Copy Constructor
|
// Function: PerspectiveLens::Copy Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens {
|
class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE PerspectiveLens();
|
INLINE PerspectiveLens();
|
||||||
|
INLINE PerspectiveLens(float hfov, float vfov);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INLINE PerspectiveLens(const PerspectiveLens ©);
|
INLINE PerspectiveLens(const PerspectiveLens ©);
|
||||||
|
@ -65,8 +65,27 @@ fillin(DatagramIterator &scan, BamReader *) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PointLight::
|
PointLight::
|
||||||
PointLight(const string &name) :
|
PointLight(const string &name) :
|
||||||
LightNode(name)
|
LightLensNode(name)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -78,9 +97,28 @@ PointLight(const string &name) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PointLight::
|
PointLight::
|
||||||
PointLight(const PointLight ©) :
|
PointLight(const PointLight ©) :
|
||||||
LightNode(copy),
|
LightLensNode(copy),
|
||||||
_cycler(copy._cycler)
|
_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -106,7 +144,7 @@ make_copy() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PointLight::
|
void PointLight::
|
||||||
xform(const LMatrix4f &mat) {
|
xform(const LMatrix4f &mat) {
|
||||||
LightNode::xform(mat);
|
LightLensNode::xform(mat);
|
||||||
CDWriter cdata(_cycler);
|
CDWriter cdata(_cycler);
|
||||||
cdata->_point = cdata->_point * mat;
|
cdata->_point = cdata->_point * mat;
|
||||||
mark_viz_stale();
|
mark_viz_stale();
|
||||||
@ -199,7 +237,7 @@ register_with_read_factory() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PointLight::
|
void PointLight::
|
||||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||||
LightNode::write_datagram(manager, dg);
|
LightLensNode::write_datagram(manager, dg);
|
||||||
manager->write_cdata(dg, _cycler);
|
manager->write_cdata(dg, _cycler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,6 +270,6 @@ make_from_bam(const FactoryParams ¶ms) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PointLight::
|
void PointLight::
|
||||||
fillin(DatagramIterator &scan, BamReader *manager) {
|
fillin(DatagramIterator &scan, BamReader *manager) {
|
||||||
LightNode::fillin(scan, manager);
|
LightLensNode::fillin(scan, manager);
|
||||||
manager->read_cdata(scan, _cycler);
|
manager->read_cdata(scan, _cycler);
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
|
|
||||||
#include "lightNode.h"
|
#include "lightLensNode.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : PointLight
|
// Class : PointLight
|
||||||
// Description : A light originating from a single point in space, and
|
// Description : A light originating from a single point in space, and
|
||||||
// shining in all directions.
|
// shining in all directions.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDA_PGRAPHNODES PointLight : public LightNode {
|
class EXPCL_PANDA_PGRAPHNODES PointLight : public LightLensNode {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
PointLight(const string &name);
|
PointLight(const string &name);
|
||||||
|
|
||||||
@ -91,9 +91,9 @@ public:
|
|||||||
return _type_handle;
|
return _type_handle;
|
||||||
}
|
}
|
||||||
static void init_type() {
|
static void init_type() {
|
||||||
LightNode::init_type();
|
LightLensNode::init_type();
|
||||||
register_type(_type_handle, "PointLight",
|
register_type(_type_handle, "PointLight",
|
||||||
LightNode::get_class_type());
|
LightLensNode::get_class_type());
|
||||||
}
|
}
|
||||||
virtual TypeHandle get_type() const {
|
virtual TypeHandle get_type() const {
|
||||||
return get_class_type();
|
return get_class_type();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user