16 #include "geometricBoundingVolume.h"
17 #include "bamWriter.h"
18 #include "bamReader.h"
20 #include "datagramIterator.h"
21 #include "perspectiveLens.h"
32 LensNode(
const string &name,
Lens *lens) :
91 nassertv(index >= 0 && index < max_lenses);
93 while (index >= (
int)_lenses.size()) {
95 slot._is_active =
false;
96 _lenses.push_back(slot);
99 _lenses[index]._lens = lens;
100 _lenses[index]._is_active =
true;
102 if (_shown_frustum != (
PandaNode *)NULL) {
118 nassertr(index >= 0 && index < max_lenses,
false);
120 while (index >= (
int)_lenses.size()) {
122 slot._is_active =
false;
123 _lenses.push_back(slot);
126 if (_lenses[index]._is_active == flag) {
130 _lenses[index]._is_active = flag;
132 if (_shown_frustum != (
PandaNode *)NULL) {
148 nassertr(lens != (
Lens *)NULL,
false);
167 if (_shown_frustum != (
PandaNode *)NULL) {
171 _shown_frustum = geom_node;
174 for (Lenses::const_iterator li = _lenses.begin();
177 if ((*li)._is_active && (*li)._lens != (
Lens *)NULL) {
178 geom_node->add_geom((*li)._lens->make_geometry());
191 if (_shown_frustum != (
PandaNode *)NULL) {
203 output(ostream &out)
const {
204 PandaNode::output(out);
207 for (Lenses::const_iterator li = _lenses.begin();
210 if ((*li)._is_active && (*li)._lens != (
Lens *)NULL) {
212 (*li)._lens->output(out);
224 write(ostream &out,
int indent_level)
const {
225 PandaNode::write(out, indent_level);
227 for (Lenses::const_iterator li = _lenses.begin();
230 if ((*li)._is_active && (*li)._lens != (
Lens *)NULL) {
231 (*li)._lens->write(out, indent_level + 2);
291 parse_params(params, scan, manager);
292 node->fillin(scan, manager);
306 PandaNode::fillin(scan, manager);
A basic node of the scene graph or data graph.
void remove_child(int child_index, Thread *current_thread=Thread::get_current_thread())
Removes the nth child from the node.
bool is_in_view(const LPoint3 &pos)
Returns true if the given point is within the bounds of the lens of the LensNode (i.e.
A base class for any number of different kinds of lenses, linear and otherwise.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void set_lens(Lens *lens)
Sets up the LensNode using this particular Lens pointer.
A node that contains a Lens.
void show_frustum()
Enables the drawing of the lens's frustum to aid in visualization.
Base class for objects that can be written to and read from Bam files.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
static void register_with_read_factory()
Tells the BamReader how to create objects of type LensNode.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
This is a 4-by-4 transform matrix.
A perspective-type lens: a normal camera.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
void hide_frustum()
Disables the drawing of the lens's frustum to aid in visualization.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
bool set_lens_active(int index, bool active)
Sets the active flag for the nth lens.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
A class to retrieve the individual data elements previously stored in a Datagram. ...
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
TypeHandle is the identifier used to differentiate C++ class types.
void add_child(PandaNode *child_node, int sort=0, Thread *current_thread=Thread::get_current_thread())
Adds a new child to the node.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
A node that holds Geom objects, renderable pieces of geometry.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
Lens * get_lens(int index=0) const
Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a...