17 #include "geomTransformer.h"
18 #include "sceneGraphReducer.h"
19 #include "accumulatedAttribs.h"
20 #include "colorAttrib.h"
21 #include "colorScaleAttrib.h"
22 #include "cullFaceAttrib.h"
23 #include "texMatrixAttrib.h"
24 #include "textureAttrib.h"
25 #include "shaderAttrib.h"
26 #include "bamReader.h"
27 #include "bamWriter.h"
28 #include "cullableObject.h"
29 #include "cullHandler.h"
30 #include "cullTraverser.h"
31 #include "cullTraverserData.h"
33 #include "datagramIterator.h"
36 #include "config_pgraph.h"
37 #include "graphicsStateGuardianBase.h"
38 #include "boundingBox.h"
39 #include "boundingSphere.h"
40 #include "config_mathutil.h"
44 (
"allow-flatten-color",
false,
45 PRC_DESC(
"allows color to always be flattened to vertices"));
55 GeomNode(
const string &name) :
58 _preserved = preserve_geom_nodes;
61 set_into_collide_mask(get_default_collide_mask());
72 _preserved(copy._preserved),
115 if (pgraph_cat.is_debug()) {
117 <<
"Transforming geometry:\n";
118 attribs.write(pgraph_cat.debug(
false), attrib_types, 2);
121 if ((attrib_types & SceneGraphReducer::TT_transform) != 0) {
122 if (!attribs._transform->is_identity()) {
128 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
129 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
130 GeomList::iterator gi;
131 PT(
GeomList) geoms = cdata->modify_geoms();
137 size_t num_geoms = geoms->size();
138 for (
size_t i = 0; i < num_geoms; ++i) {
140 PT(
Geom) new_geom = entry->_geom.get_read_pointer()->make_copy();
143 entry->_state = geom_attribs.
collect(entry->_state, attrib_types);
145 bool any_changed =
false;
147 if ((attrib_types & SceneGraphReducer::TT_color) != 0) {
150 int override = geom_attribs._color_override;
151 entry->_state = entry->_state->add_attrib(ra,
override);
154 ra = entry->_state->get_attrib_def(ColorAttrib::get_class_slot());
156 if (ca->get_color_type() != ColorAttrib::T_vertex) {
157 if(allow_flatten_color) {
158 if(transformer.
set_color(new_geom, ca->get_color())) {
160 entry->_state = entry->_state->set_attrib(ColorAttrib::make_vertex());
163 if (transformer.
remove_column(new_geom, InternalName::get_color())) {
169 if ((attrib_types & SceneGraphReducer::TT_color_scale) != 0) {
170 if (geom_attribs._color_scale != (
const RenderAttrib *)NULL) {
172 if (csa->get_scale() !=
LVecBase4(1.0f, 1.0f, 1.0f, 1.0f)) {
178 CPT(
RenderAttrib) ra = entry->_state->get_attrib_def(ColorAttrib::get_class_slot());
180 if(allow_flatten_color) {
185 if (ca->get_color_type() == ColorAttrib::T_off) {
186 entry->_state = entry->_state->set_attrib(ColorAttrib::make_vertex());
189 entry->_state = entry->_state->set_attrib(ColorAttrib::make_flat(csa->get_scale()));
191 }
else if (ca->get_color_type() == ColorAttrib::T_flat) {
194 const LColor &c1 = ca->get_color();
197 c1[2] * c2[2], c1[3] * c2[3]);
198 entry->_state = entry->_state->set_attrib(ColorAttrib::make_flat(color));
206 entry->_state = entry->_state->set_attrib(ColorAttrib::make_vertex());
213 if ((attrib_types & SceneGraphReducer::TT_tex_matrix) != 0) {
214 if (geom_attribs._tex_matrix != (
const RenderAttrib *)NULL) {
226 for (
int si = 0; si < num_on_stages; si++) {
229 count_name(name_count, name);
239 for (
int i = 0; i < num_stages; i++) {
242 if (get_name_count(name_count, name) > 1) {
245 new_tma = DCAST(
TexMatrixAttrib, new_tma->add_stage(stage, tma->get_transform(stage)));
256 if (!new_tma->is_empty()) {
257 entry->_state = entry->_state->add_attrib(new_tma);
262 if ((attrib_types & SceneGraphReducer::TT_other) != 0) {
263 entry->_state = geom_attribs._other->compose(entry->_state);
270 if ((attrib_types & SceneGraphReducer::TT_cull_face) != 0) {
271 if (geom_attribs._cull_face != (
const RenderAttrib *)NULL) {
275 case CullFaceAttrib::M_cull_none:
278 bool has_normals = (new_geom->get_vertex_data()->has_column(InternalName::get_normal()));
282 PT(
Geom) dup_geom = new_geom->reverse();
285 geoms->push_back(
GeomEntry(dup_geom, entry->_state));
290 entry = &(*geoms)[i];
295 new_geom->doubleside_in_place();
301 case CullFaceAttrib::M_cull_counter_clockwise:
303 new_geom->reverse_in_place();
315 entry->_geom = new_geom;
319 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
321 if ((attrib_types & SceneGraphReducer::TT_apply_texture_color) != 0) {
398 CDReader cdata(_cycler, current_thread);
399 GeomList::const_iterator gi;
400 CPT(
GeomList) geoms = cdata->get_geoms();
401 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
403 CPT(
RenderState) geom_state = node_state->compose(entry._state);
404 CPT(
Geom) geom = entry._geom.get_read_pointer();
407 PT(
GeomMunger) munger = gsg->get_geom_munger(geom_state, current_thread);
408 geom = transformer.premunge_geom(geom, munger);
411 CPT(
GeomVertexData) vdata = geom->get_vertex_data(current_thread);
412 vdata = vdata->animate_vertices(
false, current_thread);
414 int num_arrays = vdata_reader.get_num_arrays();
415 for (
int i = 0; i < num_arrays; ++i) {
421 int num_primitives = geom->get_num_primitives();
422 for (
int i = 0; i < num_primitives; ++i) {
429 geom_state->get_attrib(TextureAttrib::get_class_slot());
432 DCAST_INTO_V(ta, attrib);
434 for (
int i = 0; i < num_stages; ++i) {
437 if (texture != (
Texture *)NULL) {
438 texture->
prepare(prepared_objects);
444 attrib = geom_state->get_attrib(ShaderAttrib::get_class_slot());
447 DCAST_INTO_V(sa, attrib);
449 if (shader != (
Shader *)NULL) {
450 shader->
prepare(prepared_objects);
506 calc_tight_bounds(
LPoint3 &min_point,
LPoint3 &max_point,
bool &found_any,
507 const TransformState *transform,
Thread *current_thread)
const {
508 CPT(TransformState) next_transform =
509 PandaNode::calc_tight_bounds(min_point, max_point, found_any, transform,
512 const
LMatrix4 &mat = next_transform->get_mat();
514 CDReader cdata(_cycler, current_thread);
515 GeomList::const_iterator gi;
516 CPT(GeomList) geoms = cdata->get_geoms();
517 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
518 CPT(
Geom) geom = (*gi)._geom.get_read_pointer();
519 geom->calc_tight_bounds(min_point, max_point, found_any,
520 geom->get_vertex_data(current_thread)->animate_vertices(true, current_thread),
521 !next_transform->is_identity(), mat,
525 return next_transform;
539 is_renderable()
const {
553 trav->_geom_nodes_pcollector.add_level(1);
555 if (pgraph_cat.is_spam()) {
557 <<
"Found " << *
this <<
" in state " << *data._state
558 <<
" draw_mask = " << data._draw_mask <<
"\n";
564 trav->_geoms_pcollector.add_level(num_geoms);
565 CPT(TransformState) internal_transform = data.get_internal_transform(trav);
567 for (
int i = 0; i < num_geoms; i++) {
568 const Geom *geom = geoms.get_geom(i);
574 if (state->has_cull_callback() && !state->cull_callback(trav, data)) {
591 int result = data._view_frustum->contains(geom_gbv);
592 if (result == BoundingVolume::IF_no_intersection) {
597 if (!data._cull_planes->is_empty()) {
603 data._cull_planes->do_cull(result, state, geom_gbv);
604 if (result == BoundingVolume::IF_no_intersection) {
643 nassertv(geom != (
Geom *)NULL);
648 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
649 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
651 cdata->modify_geoms()->push_back(
GeomEntry(geom, state));
653 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
667 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
668 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
669 CDStageReader cdata_other(other->_cycler, pipeline_stage, current_thread);
671 GeomList::const_iterator gi;
672 CPT(
GeomList) other_geoms = cdata_other->get_geoms();
673 PT(
GeomList) this_geoms = cdata->modify_geoms();
674 for (gi = other_geoms->begin(); gi != other_geoms->end(); ++gi) {
676 nassertv(entry._geom.get_read_pointer()->check_valid());
677 this_geoms->push_back(entry);
680 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
700 nassertv(geom != (
Geom *)NULL);
704 PT(
GeomList) geoms = cdata->modify_geoms();
705 nassertv(n >= 0 && n < (
int)geoms->size());
706 (*geoms)[n]._geom = geom;
722 for (
int i = 0; i < num_geoms; i++) {
723 const Geom *geom = get_geom(i);
749 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
750 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
752 GeomList::iterator gi;
753 PT(
GeomList) geoms = cdata->modify_geoms();
754 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
756 nassertv(entry._geom.test_ref_count_integrity());
757 PT(
Geom) geom = entry._geom.get_write_pointer();
758 geom->decompose_in_place();
761 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
789 unify(
int max_indices,
bool preserve_order) {
790 bool any_changed =
false;
793 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
794 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
801 GeomList::const_iterator gi;
802 CPT(
GeomList) old_geoms = cdata->get_geoms();
803 for (gi = old_geoms->begin(); gi != old_geoms->end(); ++gi) {
806 bool unified =
false;
809 GeomList::reverse_iterator gj;
810 for (gj = new_geoms->rbegin(); gj != new_geoms->rend() && !unified; ++gj) {
812 if (old_entry._state == new_entry._state) {
814 CPT(
Geom) old_geom = old_entry._geom.get_read_pointer();
815 PT(
Geom) new_geom = new_entry._geom.get_write_pointer();
816 if (new_geom->copy_primitives_from(old_geom)) {
823 if (preserve_order) {
833 new_geoms->push_back(old_entry);
838 cdata->set_geoms(new_geoms);
841 GeomList::iterator wgi;
842 for (wgi = new_geoms->begin(); wgi != new_geoms->end(); ++wgi) {
844 nassertv(entry._geom.test_ref_count_integrity());
845 PT(
Geom) geom = entry._geom.get_write_pointer();
846 geom->unify_in_place(max_indices, preserve_order);
849 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
865 write(out, indent_level);
866 GeomList::const_iterator gi;
867 CPT(
GeomList) geoms = cdata->get_geoms();
868 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
870 indent(out, indent_level + 2)
871 << *entry._geom.get_read_pointer() <<
" " << *entry._state <<
"\n";
884 write(out, indent_level);
885 GeomList::const_iterator gi;
886 CPT(
GeomList) geoms = cdata->get_geoms();
887 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
889 CPT(
Geom) geom = entry._geom.get_read_pointer();
890 indent(out, indent_level + 2)
891 << *geom <<
" " << *entry._state <<
"\n";
892 geom->write(out, indent_level + 4);
902 output(ostream &out)
const {
908 CDReader cdata(_cycler);
912 GeomList::const_iterator gi;
915 CPT(GeomList) geoms = cdata->get_geoms();
916 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
917 const GeomEntry &entry = (*gi);
918 common = common->compose(entry._state);
921 PandaNode::output(out);
922 out <<
" (" << geoms->size() <<
" geoms";
924 if (!common->is_empty()) {
925 out <<
": " << *common;
960 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
961 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
963 GeomList::iterator gi;
964 PT(
GeomList) geoms = cdata->modify_geoms();
965 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
967 CPT(
RenderState) geom_state = node_state->compose(entry._state);
968 CPT(
Geom) geom = entry._geom.get_read_pointer();
969 PT(
GeomMunger) munger = gsg->get_geom_munger(geom_state, current_thread);
970 entry._geom = transformer.premunge_geom(geom, munger);
973 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
983 r_mark_geom_bounds_stale(
Thread *current_thread) {
984 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
985 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
987 GeomList::iterator gi;
988 PT(GeomList) geoms = cdata->modify_geoms();
989 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
990 GeomEntry &entry = (*gi);
991 entry._geom.get_read_pointer()->mark_bounds_stale();
994 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
997 PandaNode::r_mark_geom_bounds_stale(current_thread);
1010 int &internal_vertices,
1012 Thread *current_thread)
const {
1013 int num_vertices = 0;
1015 CDLockedStageReader cdata(_cycler, pipeline_stage, current_thread);
1019 bool all_box =
true;
1021 GeomList::const_iterator gi;
1022 CPT(GeomList) geoms = cdata->get_geoms();
1023 child_volumes.reserve(geoms->size());
1024 child_volumes_ref.reserve(geoms->size());
1026 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
1027 const GeomEntry &entry = (*gi);
1028 CPT(
Geom) geom = entry._geom.get_read_pointer();
1031 if (!volume->is_empty()) {
1032 child_volumes.push_back(volume);
1033 child_volumes_ref.push_back(volume);
1034 if (!volume->is_exact_type(BoundingBox::get_class_type())) {
1038 num_vertices += geom->get_nested_vertices();
1045 btype = bounds_type;
1048 if (btype == BoundingVolume::BT_box ||
1049 (btype != BoundingVolume::BT_sphere && all_box)) {
1058 if (child_volumes.size() > 0) {
1060 const BoundingVolume **child_end = child_begin + child_volumes.size();
1064 internal_bounds = gbv;
1065 internal_vertices = num_vertices;
1109 CPT(InternalName)
color = InternalName::get_color();
1110 CPT(
RenderAttrib) vertex_color = ColorAttrib::make_vertex();
1113 OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) {
1114 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
1116 GeomList::iterator gi;
1117 PT(
GeomList) geoms = cdata->modify_geoms();
1118 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
1120 CPT(
Geom) geom = entry._geom.get_read_pointer();
1125 CPT(
GeomVertexData) vdata = geom->get_vertex_data(current_thread);
1126 CPT(GeomVertexFormat) vformat = vdata->
get_format();
1127 for (
int i = 0; i < vformat->get_num_arrays(); ++i) {
1128 const GeomVertexArrayFormat *varray = vformat->get_array(i);
1129 manager->
finalize_now((GeomVertexArrayFormat *)varray);
1133 !entry._state->has_attrib(ColorAttrib::get_class_slot())) {
1137 aux_data->_hold_state = entry._state;
1140 entry._state = entry._state->add_attrib(vertex_color, -1);
1144 CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
1162 parse_params(params, scan, manager);
1163 node->fillin(scan, manager);
1181 PandaNode::fillin(scan, manager);
1191 CData(
const GeomNode::CData ©) :
1203 return new CData(*
this);
1212 void GeomNode::CData::
1214 CPT(GeomList) geoms = _geoms.get_read_pointer();
1215 int num_geoms = geoms->size();
1216 nassertv(num_geoms == (
int)(PN_uint16)num_geoms);
1217 dg.add_uint16(num_geoms);
1219 GeomList::const_iterator gi;
1220 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
1221 const GeomEntry &entry = (*gi);
1234 int GeomNode::CData::
1239 GeomList::iterator gi;
1240 PT(GeomList) geoms = _geoms.get_write_pointer();
1241 for (gi = geoms->begin(); gi != geoms->end(); ++gi) {
1242 GeomEntry &entry = (*gi);
1243 entry._geom = DCAST(
Geom, p_list[pi++]);
1257 void GeomNode::CData::
1261 PT(GeomList) geoms = new GeomList;
1262 geoms->reserve(num_geoms);
1263 for (
int i = 0; i < num_geoms; i++) {
1266 geoms->push_back(GeomEntry(NULL, NULL));
virtual bool is_geom_node() const
A simple downcast check.
void write_verbose(ostream &out, int indent_level) const
Writes a detailed description of all the Geoms in the node.
void set_geom(int n, Geom *geom)
Replaces the nth Geom of the node with a new pointer.
void write_geoms(ostream &out, int indent_level) const
Writes a short description of all the Geoms in the node.
A basic node of the scene graph or data graph.
bool has_column(const InternalName *name) const
Returns true if the data has the named column, false otherwise.
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
This is our own Panda specialization on the default STL map.
bool is_empty() const
Returns true if there appear to be no vertices to be rendered by this Geom, false if has some actual ...
This is the base class for a number of render attributes (other than transform) that may be set on sc...
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 add_geoms_from(const GeomNode *other)
Copies the Geoms (and their associated RenderStates) from the indicated GeomNode into this one...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
virtual PandaNode * combine_with(PandaNode *other)
Collapses this PandaNode with the other PandaNode, if possible, and returns a pointer to the combined...
void read_cdata(DatagramIterator &scan, PipelineCyclerBase &cycler)
Reads in the indicated CycleData object.
static BitMask< WType, nbits > all_on()
Returns a BitMask whose bits are all on.
virtual void r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, GeomTransformer &transformer, Thread *current_thread)
The recursive implementation of prepare_scene().
void collect(PandaNode *node, int attrib_types)
Collects the state and transform from the indicated node and adds it to the accumulator, removing it from the node.
TextureStage * get_stage(int n) const
Returns the nth stage that is represented by this attrib.
This is a convenience class to specialize ConfigVariable as a boolean type.
virtual CollideMask get_legal_collide_mask() const
Returns the subset of CollideMask bits that may be set for this particular type of PandaNode...
This defines a bounding sphere, consisting of a center and a radius.
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
A single page of data maintained by a PipelineCycler.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Base class for objects that can be written to and read from Bam files.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
void write_cdata(Datagram &packet, const PipelineCyclerBase &cycler)
Writes out the indicated CycleData object.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
int get_num_on_stages() const
Returns the number of stages that are turned on by the attribute.
bool is_exact_type(TypeHandle handle) const
Returns true if the current object is the indicated type exactly.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Geoms get_geoms(Thread *current_thread=Thread::get_current_thread()) const
Returns an object that can be used to walk through the list of geoms of the node. ...
int get_num_stages() const
Returns the number of stages that are represented by this attrib.
void decompose()
Calls decompose() on each Geom with the GeomNode.
A table of objects that are saved within the graphics context for reference by handle later...
TextureStage * get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
const Shader * get_shader() const
Returns the shader object associated with the node.
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
virtual void r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, GeomTransformer &transformer, Thread *current_thread)
The recursive implementation of prepare_scene().
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Indicates which faces should be culled based on their vertex ordering.
This is our own Panda specialization on the default STL vector.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
BoundingVolume::BoundsType get_bounds_type() const
Returns the bounding volume type set with set_bounds_type().
InternalName * get_texcoord_name() const
See set_texcoord_name.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
Mode get_effective_mode() const
Returns the effective culling mode.
void mark_internal_bounds_stale(Thread *current_thread=Thread::get_current_thread())
Should be called by a derived class to mark the internal bounding volume stale, so that compute_inter...
void do_premunge(GraphicsStateGuardianBase *gsg, const RenderState *node_state, GeomTransformer &transformer)
Uses the indicated GSG to premunge the Geoms in this node to optimize them for eventual rendering...
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
The smallest atom of cull.
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
bool check_valid() const
Verifies that the all of the primitives within the geom reference vertices that actually exist within...
const RenderState * get_geom_state(int n) const
Returns the RenderState associated with the nth geom of the node.
This is a 4-by-4 transform matrix.
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.
CullHandler * get_cull_handler() const
Returns the object that will receive the culled Geoms.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
const GeomVertexFormat * get_format() const
Returns a pointer to the GeomVertexFormat structure that defines this data.
virtual PandaNode * combine_with(PandaNode *other)
Collapses this node with the other node, if possible, and returns a pointer to the combined node...
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 int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
Texture * get_on_texture(TextureStage *stage) const
Returns the texture associated with the indicated stage, or NULL if no texture is associated...
void register_finalize(TypedWritable *whom)
Should be called by an object reading itself from the Bam file to indicate that this particular objec...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
virtual void add_for_draw(CullTraverser *trav, CullTraverserData &data)
Adds the node's contents to the CullResult we are building up during the cull traversal, so that it will be drawn at render time.
void finalize_now(TypedWritable *whom)
Forces the finalization of a particular object.
void prepare(PreparedGraphicsObjects *prepared_objects)
Indicates that the shader should be enqueued to be prepared in the indicated prepared_objects at the ...
Applies a scale to colors in the scene graph and on vertices.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
Thread * get_current_thread() const
Returns the currently-executing thread object, as passed to the CullTraverser constructor.
const LMatrix4 & get_mat() const
Returns the transformation matrix associated with the default texture stage.
This is the base class for all three-component vectors and points.
Applies a transform matrix to UV's before they are rendered.
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
static void register_with_read_factory()
Tells the BamReader how to create objects of type GeomNode.
virtual bool safe_to_combine() const
Returns true if it is generally safe to combine this particular kind of PandaNode with other kinds of...
virtual void apply_attribs_to_vertices(const AccumulatedAttribs &attribs, int attrib_types, GeomTransformer &transformer)
Applies whatever attributes are specified in the AccumulatedAttribs object (and by the attrib_types b...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A thread; that is, a lightweight process.
void prepare(PreparedGraphicsObjects *prepared_objects)
Indicates that the texture should be enqueued to be prepared in the indicated prepared_objects at the...
This is similar to RefCountObj, but it implements a CopyOnWriteObject inheritance instead of a Refere...
int get_num_geoms() const
Returns the number of geoms of the node.
void unify(int max_indices, bool preserve_order)
Attempts to unify all of the Geoms contained within this node into a single Geom, or at least as few ...
Indicates what color should be applied to renderable geometry.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
This is our own Panda specialization on the default STL set.
A class to retrieve the individual data elements previously stored in a Datagram. ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this node by the indicated matrix, if it means anything to do so...
TypeHandle is the identifier used to differentiate C++ class types.
bool check_valid() const
Verifies that the each Geom within the GeomNode reference vertices that actually exist within its Geo...
Defines the properties of a named stage of the multitexture pipeline.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void set_aux_data(TypedWritable *obj, const string &name, AuxData *data)
Associates an arbitrary block of data with the indicated object (or NULL), and the indicated name...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
A node that holds Geom objects, renderable pieces of geometry.
void add_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
int get_num_geoms() const
Returns the number of geoms in the node.
This is the data for one array of a GeomVertexData structure.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.