37 return new CData(*
this);
44void PlaneNode::CData::
46 _plane.write_datagram(dg);
53void PlaneNode::CData::
55 _plane.read_datagram(scan);
62PlaneNode(
const std::string &name,
const LPlane &plane) :
70 set_overall_hidden(
true);
81 _priority(copy._priority),
82 _clip_effect(copy._clip_effect),
91output(std::ostream &out)
const {
92 PandaNode::output(out);
111xform(
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);
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.
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...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
void read_cdata(DatagramIterator &scan, PipelineCyclerBase &cycler)
Reads in the indicated CycleData object.
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_cdata(Datagram &packet, const PipelineCyclerBase &cycler)
Writes out the indicated CycleData object.
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
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 ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
CullHandler * get_cull_handler() const
Returns the object that will receive the culled Geoms.
SceneSetup * get_scene() const
Returns the SceneSetup object.
The smallest atom of cull.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A single page of data maintained by a PipelineCycler.
A class to retrieve the individual data elements previously stored in a Datagram.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
int32_t get_int32()
Extracts a signed 32-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
void add_uint8(uint8_t value)
Adds an unsigned 8-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.
Defines a series of disconnected line segments.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
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.
A container for geometry primitives.
A base class for any number of different kinds of lenses, linear and otherwise.
get_nodal_point
Returns the center point of the lens: the point from which the lens is viewing.
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.
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 node that contains a plane.
static void register_with_read_factory()
Tells the BamReader how to create objects of type PlaneNode.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
get_plane
Returns the plane represented by the PlaneNode.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
const Lens * get_lens() const
Returns the particular Lens used for rendering.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
This is a sequence number that increments monotonically.
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.
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.