15 #include "modelNode.h"
17 #include "bamReader.h"
19 #include "datagramIterator.h"
55 if (_preserve_transform == PT_drop_node) {
74 return _preserve_transform == PT_drop_node;
86 return _preserve_transform != PT_no_touch;
99 return _preserve_transform == PT_none || _preserve_transform == PT_drop_node;
116 return _preserve_transform != PT_local && _preserve_transform != PT_no_touch;
131 return _preserve_transform == PT_drop_node;
143 return _preserve_transform != PT_drop_node && _preserve_transform != PT_no_touch;
159 return _preserve_attributes;
181 test_transform(
const TransformState *ts)
const {
183 nassertv(pos[0] < _transform_limit);
184 nassertv(pos[0] > -_transform_limit);
185 nassertv(pos[1] < _transform_limit);
186 nassertv(pos[1] > -_transform_limit);
187 nassertv(pos[2] < _transform_limit);
188 nassertv(pos[2] > -_transform_limit);
200 transform_changed() {
201 PandaNode::transform_changed();
203 CPT(TransformState) transform = get_transform();
205 if (_transform_limit > 0.0) {
206 test_transform(transform);
238 parse_params(params, scan, manager);
239 node->fillin(scan, manager);
253 PandaNode::fillin(scan, manager);
255 _preserve_transform = (PreserveTransform)scan.
get_uint8();
A basic node of the scene graph or data graph.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ModelNode.
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 safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of Node by calling the xform()...
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...
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of Node by duplicating insta...
virtual bool safe_to_modify_transform() const
Returns true if it is safe to automatically adjust the transform on this kind of 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.
Base class for objects that can be written to and read from Bam files.
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 ...
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
virtual bool safe_to_combine() const
Returns true if it is generally safe to combine this particular kind of PandaNode with other kinds of...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual PandaNode * combine_with(PandaNode *other)
Collapses this PandaNode with the other PandaNode, if possible, and returns a pointer to the combined...
virtual bool preserve_name() const
Returns true if the node's name has extrinsic meaning and must be preserved across a flatten operatio...
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
virtual bool safe_to_flatten_below() const
Returns true if a flatten operation may safely continue past this node, or false if nodes below this ...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
virtual int get_unsafe_to_apply_attribs() const
Returns the union of all attributes from SceneGraphReducer::AttribTypes that may not safely be applie...