14 #ifndef TRANSFORMSTATE_H
15 #define TRANSFORMSTATE_H
70 INLINE
size_t get_hash()
const;
76 INLINE
static CPT(
TransformState) make_quat(
const LQuaternion &quat);
77 INLINE
static CPT(
TransformState) make_pos_hpr(
const LVecBase3 &pos,
78 const LVecBase3 &hpr);
80 INLINE
static CPT(
TransformState) make_scale(
const LVecBase3 &scale);
81 INLINE
static CPT(
TransformState) make_shear(
const LVecBase3 &shear);
82 INLINE
static CPT(
TransformState) make_pos_hpr_scale(
const LVecBase3 &pos,
84 const LVecBase3 &scale);
85 INLINE
static CPT(
TransformState) make_pos_quat_scale(
const LVecBase3 &pos,
86 const LQuaternion &quat,
87 const LVecBase3 &scale);
88 static CPT(
TransformState) make_pos_hpr_scale_shear(
const LVecBase3 &pos,
90 const LVecBase3 &scale,
91 const LVecBase3 &shear);
92 static CPT(
TransformState) make_pos_quat_scale_shear(
const LVecBase3 &pos,
93 const LQuaternion &quat,
94 const LVecBase3 &scale,
95 const LVecBase3 &shear);
99 INLINE
static CPT(
TransformState) make_pos2d(
const LVecBase2 &pos);
100 INLINE
static CPT(
TransformState) make_rotate2d(PN_stdfloat rotate);
101 INLINE
static CPT(
TransformState) make_pos_rotate2d(
const LVecBase2 &pos,
103 INLINE
static CPT(
TransformState) make_scale2d(PN_stdfloat scale);
104 INLINE
static CPT(
TransformState) make_scale2d(
const LVecBase2 &scale);
105 INLINE
static CPT(
TransformState) make_shear2d(PN_stdfloat shear);
106 INLINE
static CPT(
TransformState) make_pos_rotate_scale2d(
const LVecBase2 &pos,
108 const LVecBase2 &scale);
109 static CPT(
TransformState) make_pos_rotate_scale_shear2d(
const LVecBase2 &pos,
111 const LVecBase2 &scale,
116 INLINE
bool is_identity()
const;
117 INLINE
bool is_invalid()
const;
118 INLINE
bool is_singular()
const;
119 INLINE
bool is_2d()
const;
121 INLINE
bool has_components()
const;
122 INLINE
bool components_given()
const;
123 INLINE
bool hpr_given()
const;
124 INLINE
bool quat_given()
const;
125 INLINE
bool has_pos()
const;
126 INLINE
bool has_hpr()
const;
127 INLINE
bool has_quat()
const;
128 INLINE
bool has_scale()
const;
129 INLINE
bool has_identity_scale()
const;
130 INLINE
bool has_uniform_scale()
const;
131 INLINE
bool has_shear()
const;
132 INLINE
bool has_nonzero_shear()
const;
133 INLINE
bool has_mat()
const;
135 INLINE
const LPoint3 &get_pos()
const;
136 INLINE
const LVecBase3 &get_hpr()
const;
137 INLINE
const LQuaternion &get_quat()
const;
138 INLINE
const LQuaternion &get_norm_quat()
const;
139 INLINE
const LVecBase3 &get_scale()
const;
140 INLINE PN_stdfloat get_uniform_scale()
const;
141 INLINE
const LVecBase3 &get_shear()
const;
142 INLINE
const LMatrix4 &get_mat()
const;
144 INLINE LVecBase2 get_pos2d()
const;
145 INLINE PN_stdfloat get_rotate2d()
const;
146 INLINE LVecBase2 get_scale2d()
const;
147 INLINE PN_stdfloat get_shear2d()
const;
148 INLINE LMatrix3 get_mat3()
const;
150 MAKE_PROPERTY(pos, get_pos);
151 MAKE_PROPERTY(hpr, get_hpr);
152 MAKE_PROPERTY(quat, get_quat);
153 MAKE_PROPERTY(norm_quat, get_norm_quat);
154 MAKE_PROPERTY(scale, get_scale);
155 MAKE_PROPERTY(shear, get_shear);
156 MAKE_PROPERTY(mat, get_mat);
175 INLINE
int get_geom_rendering(
int geom_rendering)
const;
184 INLINE
size_t get_composition_cache_num_entries()
const;
185 INLINE
size_t get_invert_composition_cache_num_entries()
const;
187 INLINE
size_t get_composition_cache_size()
const;
188 INLINE
const TransformState *get_composition_cache_source(
size_t n)
const;
189 INLINE
const TransformState *get_composition_cache_result(
size_t n)
const;
190 INLINE
size_t get_invert_composition_cache_size()
const;
191 INLINE
const TransformState *get_invert_composition_cache_source(
size_t n)
const;
192 INLINE
const TransformState *get_invert_composition_cache_result(
size_t n)
const;
193 bool validate_composition_cache()
const;
194 EXTENSION(PyObject *get_composition_cache()
const);
195 EXTENSION(PyObject *get_invert_composition_cache()
const);
197 void output(std::ostream &out)
const;
198 void write(std::ostream &out,
int indent_level)
const;
199 void write_composition_cache(std::ostream &out,
int indent_level)
const;
201 static int get_num_states();
202 static int get_num_unused_states();
203 static int clear_cache();
204 static int garbage_collect();
205 static void list_cycles(std::ostream &out);
206 static void list_states(std::ostream &out);
207 static bool validate_states();
208 EXTENSION(
static PyObject *get_states());
209 EXTENSION(
static PyObject *get_unused_states());
212 static void init_states();
214 INLINE
static void flush_level();
219 INLINE
void cache_unref_only()
const;
222 INLINE
bool do_cache_unref()
const;
223 INLINE
bool do_node_unref()
const;
225 class CompositionCycleDescEntry {
242 void detect_and_break_cycles();
246 CompositionCycleDesc *cycle_desc);
247 static bool r_detect_reverse_cycles(
const TransformState *start_state,
250 CompositionCycleDesc *cycle_desc);
253 void remove_cache_pointers();
261 static States *_states;
282 INLINE Composition();
283 INLINE Composition(
const Composition ©);
291 mutable CompositionCache _composition_cache;
292 mutable CompositionCache _invert_composition_cache;
300 static size_t _garbage_index;
302 static bool _uniquify_matrix;
319 INLINE
void check_hash()
const;
320 INLINE
void check_singular()
const;
321 INLINE
void check_components()
const;
322 INLINE
void check_hpr()
const;
323 INLINE
void check_quat()
const;
324 INLINE
void check_norm_quat()
const;
325 INLINE
void check_mat()
const;
326 INLINE
void calc_hash();
328 void calc_singular();
329 INLINE
void calc_components();
330 void do_calc_components();
331 INLINE
void calc_hpr();
334 void calc_norm_quat();
335 INLINE
void calc_mat();
338 INLINE
void check_uniform_scale();
339 INLINE
void check_uniform_scale2d();
341 INLINE
void set_destructing();
342 INLINE
bool is_destructing()
const;
344 INLINE
void consider_update_pstats(
int old_referenced_bits)
const;
345 static void update_pstats(
int old_referenced_bits,
int new_referenced_bits);
348 F_is_identity = 0x00000001,
349 F_is_singular = 0x00000002,
350 F_singular_known = 0x00000004,
351 F_components_given = 0x00000008,
352 F_components_known = 0x00000010,
353 F_has_components = 0x00000020,
354 F_mat_known = 0x00000040,
355 F_is_invalid = 0x00000080,
356 F_quat_given = 0x00000100,
357 F_quat_known = 0x00000200,
358 F_hpr_given = 0x00000400,
359 F_hpr_known = 0x00000800,
360 F_uniform_scale = 0x00001000,
361 F_identity_scale = 0x00002000,
362 F_has_nonzero_shear = 0x00004000,
363 F_is_destructing = 0x00008000,
364 F_is_2d = 0x00010000,
365 F_hash_known = 0x00020000,
366 F_norm_quat_known = 0x00040000,
369 LVecBase3 _hpr, _scale, _shear;
370 LQuaternion _quat, _norm_quat;
383 static void register_with_read_factory();
395 static void init_type() {
396 NodeCachedReferenceCount::init_type();
398 NodeCachedReferenceCount::get_class_type());
401 return get_class_type();
403 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
415 INLINE std::ostream &operator << (std::ostream &out,
const TransformState &state) {
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...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is used to track the utilization of the TransformState and RenderState caches,...
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.
void cache_ref_only() const
Decrements the cache reference count without affecting the normal reference count.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
The default class template does not define any methods.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
This is a standard, non-reentrant mutex, similar to the Mutex class.
A lightweight reentrant mutex.
This class further specializes CachedTypedWritableReferenceCount to also add a node_ref_count,...
bool node_unref() const
Explicitly decrements the node reference count and the normal reference count simultaneously.
void node_ref() const
Explicitly increments the reference count.
A lightweight class that represents a single element that may be timed and/or counted via stats.
This is the base class for PointerTo and ConstPointerTo.
This template class implements an unordered map of keys to data, implemented as a hashtable.
TypeHandle is the identifier used to differentiate C++ class types.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Base class for objects that can be written to and read from Bam files.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
This is a sequence number that increments monotonically.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This is our own Panda specialization on the default STL vector.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.