Go to the documentation of this file.
29 LensNode(
const std::string &name,
Lens *lens) :
32 if (lens ==
nullptr) {
53 xform(
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) {
127 nassertr(lens !=
nullptr,
false);
143 if (_shown_frustum !=
nullptr) {
147 _shown_frustum = geom_node;
148 add_child(_shown_frustum);
150 for (Lenses::const_iterator li = _lenses.begin();
153 if ((*li)._is_active && (*li)._lens !=
nullptr) {
154 geom_node->add_geom((*li)._lens->make_geometry());
164 if (_shown_frustum !=
nullptr) {
166 _shown_frustum =
nullptr;
174 output(std::ostream &out)
const {
175 PandaNode::output(out);
178 for (Lenses::const_iterator li = _lenses.begin();
181 if ((*li)._is_active && (*li)._lens !=
nullptr) {
183 (*li)._lens->output(out);
193 write(std::ostream &out,
int indent_level)
const {
194 PandaNode::write(out, indent_level);
196 for (Lenses::const_iterator li = _lenses.begin();
199 if ((*li)._is_active && (*li)._lens !=
nullptr) {
200 (*li)._lens->write(out, indent_level + 2);
227 Lenses::const_iterator li;
228 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
244 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
245 (*li)._lens = DCAST(
Lens, p_list[pi++]);
248 if (_shown_frustum !=
nullptr) {
267 node->fillin(scan, manager);
278 PandaNode::fillin(scan, manager);
288 for (li = _lenses.begin(); li != _lenses.end(); ++li) {
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type LensNode.
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
A class to retrieve the individual data elements previously stored in a Datagram.
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 the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void hide_frustum()
Disables 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.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
TypeHandle is the identifier used to differentiate C++ class types.
A node that holds Geom objects, renderable pieces of geometry.
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
bool get_bool()
Extracts a boolean value.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
void remove_child(int child_index, Thread *current_thread=Thread::get_current_thread())
Removes the nth child from the node.
void set_lens(Lens *lens)
Sets up the LensNode using this particular Lens pointer.
A base class for any number of different kinds of lenses, linear and otherwise.
bool is_in_view(const LPoint3 &pos)
Returns true if the given point is within the bounds of the lens of the LensNode (i....
A perspective-type lens: a normal camera.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that contains a Lens.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
void show_frustum()
Enables the drawing of the lens's frustum to aid in visualization.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
void add_bool(bool value)
Adds a boolean value to the datagram.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
bool set_lens_active(int index, bool active)
Sets the active flag for the nth lens.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
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.