33make(
const NodePath &reference,
int properties) {
35 effect->_reference = reference;
36 effect->_properties = (properties & P_all);
37 return return_new(effect);
53output(std::ostream &out)
const {
54 out << get_type() <<
":";
55 if (_properties == 0) {
58 if ((_properties & P_pos) == P_pos) {
61 if ((_properties & P_x) != 0) {
64 if ((_properties & P_y) != 0) {
67 if ((_properties & P_z) != 0) {
71 if ((_properties & P_rot) != 0) {
74 if ((_properties & P_scale) == P_scale) {
77 if ((_properties & P_sx) != 0) {
80 if ((_properties & P_sy) != 0) {
83 if ((_properties & P_sz) != 0) {
88 out <<
" reference " << _reference;
118 if (_properties == 0) {
123 CPT(
TransformState) true_net_transform = data.get_net_transform(trav);
130 true_net_transform->invert_compose(want_net_transform);
136 node_transform = compass_transform->compose(node_transform);
146 return (_properties != 0);
161 if (_properties == 0) {
170 ref_transform = TransformState::make_identity();
172 ref_transform = _reference.get_net_transform();
180 if (_properties == P_all) {
182 want_net_transform = ref_transform;
187 LVecBase3 want_pos = net_transform->
get_pos();
188 const LVecBase3 &ref_pos = ref_transform->get_pos();
189 if ((_properties & P_x) != 0) {
190 want_pos[0] = ref_pos[0];
192 if ((_properties & P_y) != 0) {
193 want_pos[1] = ref_pos[1];
195 if ((_properties & P_z) != 0) {
196 want_pos[2] = ref_pos[2];
199 if ((_properties & ~P_pos) == 0) {
201 want_net_transform = net_transform->set_pos(want_pos);
203 }
else if ((_properties & (P_rot | P_scale)) == (P_rot | P_scale)) {
205 want_net_transform = ref_transform->set_pos(want_pos);
211 !ref_transform->has_components()) {
214 want_net_transform = ref_transform->set_pos(want_pos);
218 LQuaternion want_quat = net_transform->
get_quat();
219 if ((_properties & P_rot) != 0) {
220 want_quat = ref_transform->get_quat();
223 LVecBase3 want_scale = net_transform->
get_scale();
224 const LVecBase3 &ref_scale = ref_transform->get_scale();
225 if ((_properties & P_sx) != 0) {
226 want_scale[0] = ref_scale[0];
228 if ((_properties & P_sy) != 0) {
229 want_scale[1] = ref_scale[1];
231 if ((_properties & P_sz) != 0) {
232 want_scale[2] = ref_scale[2];
236 TransformState::make_pos_quat_scale(want_pos, want_quat, want_scale);
241 net_transform = want_net_transform;
259 DCAST_INTO_R(ta, other, 0);
261 if (_properties != ta->_properties) {
262 return _properties - ta->_properties;
264 int compare = _reference.
compare_to(ta->_reference);
320 effect->fillin(scan, manager);
331 RenderEffect::fillin(scan, manager);
335 _reference.
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.
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.
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 ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
A CompassEffect causes a node to inherit its rotation (or pos or scale, if specified) from some other...
virtual void cull_callback(CullTraverser *trav, CullTraverserData &data, CPT(TransformState) &node_transform, CPT(RenderState) &node_state) const
If has_cull_callback() returns true, this function will be called during the cull traversal to perfor...
virtual bool has_adjust_transform() const
Should be overridden by derived classes to return true if adjust_transform() has been defined,...
virtual void adjust_transform(CPT(TransformState) &net_transform, CPT(TransformState) &node_transform, const PandaNode *node) const
Performs some operation on the node's apparent net and/or local transforms.
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CompassEffect.
virtual bool has_cull_callback() const
Should be overridden by derived classes to return true if cull_callback() has been defined.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of RenderEffect by calling the...
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,...
A class to retrieve the individual data elements previously stored in a Datagram.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_uint16(uint16_t value)
Adds an unsigned 16-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.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is called by make_from_bam to read in all of the relevant data from the BamFil...
bool is_empty() const
Returns true if the NodePath contains no nodes.
int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
int compare_to(const NodePath &other) const
Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it ...
void write_datagram(BamWriter *manager, Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
A basic node of the scene graph or data graph.
This is the base class for a number of special render effects that may be set on scene graph nodes to...
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 represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
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().
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.