29LensNode(
const std::string &name,
Lens *lens) :
32 if (lens ==
nullptr) {
53xform(
const LMatrix4 &mat) {
76 nassertv(index >= 0 && index < max_lenses);
78 while (index >= (
int)_lenses.size()) {
80 slot._is_active =
false;
81 _lenses.push_back(slot);
84 _lenses[index]._lens = lens;
85 _lenses[index]._is_active =
true;
87 if (_shown_frustum !=
nullptr) {
100 nassertr(index >= 0 && index < max_lenses,
false);
102 while (index >= (
int)_lenses.size()) {
104 slot._is_active =
false;
105 _lenses.push_back(slot);
108 if (_lenses[index]._is_active == flag) {
112 _lenses[index]._is_active = flag;
114 if (_shown_frustum !=
nullptr) {
128 nassertr(lens !=
nullptr,
false);
144 if (_shown_frustum !=
nullptr) {
148 _shown_frustum = geom_node;
149 add_child(_shown_frustum);
151 for (Lenses::const_iterator li = _lenses.begin();
154 if ((*li)._is_active && (*li)._lens !=
nullptr) {
155 geom_node->add_geom((*li)._lens->make_geometry());
165 if (_shown_frustum !=
nullptr) {
167 _shown_frustum =
nullptr;
175output(std::ostream &out)
const {
176 PandaNode::output(out);
179 for (Lenses::const_iterator li = _lenses.begin();
182 if ((*li)._is_active && (*li)._lens !=
nullptr) {
184 (*li)._lens->output(out);
194write(std::ostream &out,
int indent_level)
const {
195 PandaNode::write(out, indent_level);
197 for (Lenses::const_iterator li = _lenses.begin();
200 if ((*li)._is_active && (*li)._lens !=
nullptr) {
201 (*li)._lens->write(out, indent_level + 2);
228 Lenses::const_iterator li;
229 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
245 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
246 (*li)._lens = DCAST(
Lens, p_list[pi++]);
249 if (_shown_frustum !=
nullptr) {
268 node->fillin(scan, manager);
279 PandaNode::fillin(scan, manager);
289 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A class to retrieve the individual data elements previously stored in a Datagram.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
bool get_bool()
Extracts a boolean value.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_bool(bool value)
Adds a boolean value to the datagram.
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
A node that holds Geom objects, renderable pieces of geometry.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
A node that contains a Lens.
void hide_frustum()
Disables the drawing of the lens's frustum to aid in visualization.
void set_lens(Lens *lens)
Sets up the LensNode using this particular Lens pointer.
void show_frustum()
Enables the drawing of the lens's frustum to aid in visualization.
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
static void register_with_read_factory()
Tells the BamReader how to create objects of type LensNode.
bool is_in_view(const LPoint3 &pos)
Returns true if the given point is within the bounds of the lens of the LensNode (i....
bool set_lens_active(int index, bool active)
Sets the active flag for the nth lens.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to 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...
A base class for any number of different kinds of lenses, linear and otherwise.
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.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
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 perspective-type lens: a normal camera.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
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().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.