Go to the documentation of this file.
37 return new CData(*
this);
44 void PlaneNode::CData::
46 _plane.write_datagram(dg);
53 void PlaneNode::CData::
55 _plane.read_datagram(scan);
62 PlaneNode(
const std::string &name,
const LPlane &plane) :
70 set_overall_hidden(
true);
81 _priority(copy._priority),
82 _clip_effect(copy._clip_effect),
91 output(std::ostream &out)
const {
92 PandaNode::output(out);
111 xform(
const LMatrix4 &mat) {
114 cdata->_plane = cdata->_plane * mat;
115 cdata->_front_viz =
nullptr;
116 cdata->_back_viz =
nullptr;
144 data.get_internal_transform(trav));
169 int &internal_vertices,
171 Thread *current_thread)
const {
172 CDStageReader cdata(_cycler, pipeline_stage, current_thread);
174 internal_vertices = 0;
182 CDLockedReader cdata(_cycler);
186 LPlane eye_plane = cdata->_plane * data.get_modelview_transform(trav)->get_mat();
187 bool front = (eye_plane.dist_to_plane(lens->
get_nodal_point()) >= 0.0f);
189 if (cdata->_front_viz !=
nullptr) {
190 return front ? cdata->_front_viz : cdata->_back_viz;
193 if (pgraph_cat.is_debug()) {
195 <<
"Recomputing viz for " << *
this <<
"\n";
198 CDWriter cdataw(_cycler, cdata,
false);
199 const LPlane &plane = cdataw->_plane;
209 if (fabs(plane[0]) > fabs(plane[1])) {
211 if (fabs(plane[0]) > fabs(plane[2])) {
222 if (fabs(plane[1]) > fabs(plane[2])) {
233 static const int num_segs = 10;
234 a *= cdataw->_viz_scale / (num_segs * 2);
235 b *= cdataw->_viz_scale / (num_segs * 2);
237 for (
int x = -num_segs; x <= num_segs; ++x) {
238 vertex.
add_data3(plane.project(a * x - b * num_segs));
239 vertex.
add_data3(plane.project(a * x + b * num_segs));
240 lines->add_next_vertices(2);
241 lines->close_primitive();
243 for (
int y = -num_segs; y <= num_segs; ++y) {
244 vertex.
add_data3(plane.project(b * y - a * num_segs));
245 vertex.
add_data3(plane.project(b * y + a * num_segs));
246 lines->add_next_vertices(2);
247 lines->close_primitive();
250 cdataw->_front_viz =
new Geom(vdata->set_color(LColor(1.0f, 1.0f, 0.0f, 1.0f)));
251 cdataw->_front_viz->add_primitive(lines);
253 cdataw->_back_viz =
new Geom(vdata->set_color(LColor(0.4, 0.4, 0.0f, 1.0f)));
254 cdataw->_back_viz->add_primitive(lines);
256 return front ? cdataw->_front_viz : cdataw->_back_viz;
291 node->fillin(scan, manager);
302 PandaNode::fillin(scan, manager);
A container for geometry primitives.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 a sequence number that increments monotonically.
A single page of data maintained by a PipelineCycler.
int32_t get_int32()
Extracts a signed 32-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
get_nodal_point
Returns the center point of the lens: the point from which the lens is viewing.
The smallest atom of cull.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
void add_uint8(uint8_t value)
Adds an unsigned 8-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.
A class to retrieve the individual data elements previously stored in a Datagram.
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...
SceneSetup * get_scene() const
Returns the SceneSetup object.
void add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
TypeHandle is the identifier used to differentiate C++ class types.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
const LPlane & get_plane() const
Returns the plane represented by the PlaneNode.
void read_cdata(DatagramIterator &scan, PipelineCyclerBase &cycler)
Reads in the indicated CycleData object.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
A base class for any number of different kinds of lenses, linear and otherwise.
PT(Geom) PlaneNode
Returns a Geom that represents the visualization of the PlaneNode.
static void register_with_read_factory()
Tells the BamReader how to create objects of type PlaneNode.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
void write_cdata(Datagram &packet, const PipelineCyclerBase &cycler)
Writes out the indicated CycleData object.
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
Defines a series of disconnected line segments.
A node that contains a plane.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
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.
A thread; that is, a lightweight process.
const Lens * get_lens() const
Returns the particular Lens used for rendering.
CullHandler * get_cull_handler() const
Returns the object that will receive the culled Geoms.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.