Go to the documentation of this file.
40 return new CData(*
this);
47 void SheetNode::CData::
58 void SheetNode::CData::
69 SheetNode(
const std::string &name) :
131 if (surface !=
nullptr) {
134 if (result->get_num_u_segments() > 0 && result->get_num_v_segments() > 0) {
135 render_sheet(trav, data, result);
158 output(std::ostream &out)
const {
159 PandaNode::output(out);
161 if (surface !=
nullptr) {
162 out <<
" " << *surface;
164 out <<
" (no surface)";
172 write(std::ostream &out,
int indent_level)
const {
173 PandaNode::write(out, indent_level);
175 if (surface !=
nullptr) {
176 indent(out, indent_level + 2) << *surface <<
"\n";
178 indent(out, indent_level + 2) <<
"(no surface)\n";
191 do_recompute_bounds(rel_to, pipeline_stage, current_thread);
192 mark_internal_bounds_stale(current_thread);
202 int &internal_vertices,
204 Thread *current_thread)
const {
209 internal_bounds = bounds;
210 internal_vertices = 0;
217 do_recompute_bounds(
const NodePath &rel_to,
int pipeline_stage,
218 Thread *current_thread)
const {
227 if (surface !=
nullptr) {
232 DCAST_INTO_R(gbv, bound, bound);
233 gbv->
around(&verts[0], &verts[0] + verts.size());
252 if (use_vertex_color) {
258 (
"sheet", format, Geom::UH_stream);
259 int expected_num_vertices = num_u_segments * (num_u_verts + 1) * num_v_segments * num_v_verts;
260 vdata->reserve_num_rows(expected_num_vertices);
267 for (
int ui = 0; ui < num_u_segments; ui++) {
268 for (
int uni = 0; uni <= num_u_verts; uni++) {
269 PN_stdfloat u0 = (PN_stdfloat)uni / (PN_stdfloat)num_u_verts;
272 for (
int vi = 0; vi < num_v_segments; vi++) {
273 for (
int vni = 0; vni < num_v_verts; vni++) {
274 PN_stdfloat v = (PN_stdfloat)vni / (PN_stdfloat)(num_v_verts - 1);
281 vertex.add_data3(point);
282 normal.add_data3(norm);
283 texcoord.add_data2(u0_tc, v_tc);
285 if (use_vertex_color) {
294 nassertv(vdata->get_num_rows() == expected_num_vertices);
298 int expected_num_tristrips = num_u_segments * num_u_verts * num_v_segments;
299 int expected_verts_per_tristrip = num_v_verts * 2;
301 int expected_prim_vertices = (expected_num_tristrips - 1) * (expected_verts_per_tristrip + strip->get_num_unused_vertices_per_primitive()) + expected_verts_per_tristrip;
303 strip->reserve_num_vertices(expected_prim_vertices);
305 int verts_per_row = num_v_segments * num_v_verts;
307 for (
int ui = 0; ui < num_u_segments; ui++) {
308 for (
int uni = 0; uni < num_u_verts; uni++) {
309 int row_start_index = ((ui * (num_u_verts + 1)) + uni) * verts_per_row;
311 for (
int vi = 0; vi < num_v_segments; vi++) {
312 for (
int vni = 0; vni < num_v_verts; vni++) {
313 int vert_index_0 = row_start_index + (vi * num_v_verts) + vni;
314 int vert_index_1 = vert_index_0 + verts_per_row;
315 strip->add_vertex(vert_index_0);
316 strip->add_vertex(vert_index_1);
318 strip->close_primitive();
322 nassertv(strip->get_num_vertices() == expected_prim_vertices);
325 geom->add_primitive(strip);
328 if (use_vertex_color) {
329 state = state->add_attrib(ColorAttrib::make_vertex());
334 data.get_internal_transform(trav));
368 node->fillin(scan, manager);
379 PandaNode::fillin(scan, manager);
A container for geometry primitives.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
static void register_with_read_factory()
Tells the BamReader how to create objects of type SheetNode.
A single page of data maintained by a PipelineCycler.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void eval_segment_point(int ui, int vi, PN_stdfloat u, PN_stdfloat v, LVecBase3 &point) const
Evaluates the point on the surface corresponding to the indicated value in parametric time within the...
PT(BoundingVolume) SheetNode
Does the actual internal recompute.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of Node by calling the xform()...
The smallest atom of cull.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This defines a bounding sphere, consisting of a center and a radius.
int get_num_v_subdiv() const
Returns the number of subdivisions per cubic segment to draw in the V direction.
This class is an abstraction for evaluating NURBS surfaces.
int get_num_u_subdiv() const
Returns the number of subdivisions per cubic segment to draw in the U direction.
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...
NurbsSurfaceEvaluator * get_surface() const
Returns the surface represented by the SheetNode.
void reset_bound(const NodePath &rel_to)
Recomputes the bounding volume.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class draws a visible representation of the NURBS surface stored in its NurbsSurfaceEvaluator.
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 ...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
int get_num_u_segments() const
Returns the number of piecewise continuous segments within the surface in the U direction.
int get_num_v_segments() const
Returns the number of piecewise continuous segments within the surface in the V direction.
get_current_thread
Returns a pointer to the currently-executing Thread object.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
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.
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...
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.
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 another abstract class, for a general class of bounding volumes that actually enclose points ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that represents a single element that may be timed and/or counted via stats.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
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.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void skip_pointer(DatagramIterator &scan)
Reads and discards a pointer value from the Bam file.
bool around(const GeometricBoundingVolume **first, const GeometricBoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
Defines a series of triangle strips.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void eval_segment_extended_points(int ui, int vi, PN_stdfloat u, PN_stdfloat v, int d, PN_stdfloat result[], int num_values) const
Simultaneously performs eval_extended_point on a contiguous sequence of dimensions.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
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.
void eval_segment_normal(int ui, int vi, PN_stdfloat u, PN_stdfloat v, LVecBase3 &normal) const
As eval_segment_point, but computes the normal to the surface at the indicated point.
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
bool get_use_vertex_color() const
Returns the "use vertex color" flag.
A thread; that is, a lightweight process.
CullHandler * get_cull_handler() const
Returns the object that will receive the culled Geoms.
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,...
PN_stdfloat get_segment_v(int vi, PN_stdfloat v) const
Accepts a v value in the range [0, 1], and assumed to be relative to the indicated segment (as in eva...
The result of a NurbsSurfaceEvaluator.
PN_stdfloat get_segment_u(int ui, PN_stdfloat u) const
Accepts a u value in the range [0, 1], and assumed to be relative to the indicated segment (as in eva...