21 INLINE
bool TransformState::
22 operator != (
const TransformState &other)
const {
23 return !(operator == (other));
37 INLINE
int TransformState::
38 compare_to(
const TransformState &other)
const {
47 INLINE
size_t TransformState::
59 INLINE CPT(TransformState) TransformState::
61 return make_pos_hpr_scale(pos,
72 INLINE CPT(TransformState) TransformState::
74 return make_pos_hpr_scale(
LVecBase3(0.0f, 0.0f, 0.0f),
85 INLINE CPT(TransformState) TransformState::
87 return make_pos_quat_scale(
LVecBase3(0.0f, 0.0f, 0.0f),
98 INLINE CPT(TransformState) TransformState::
100 return make_pos_hpr_scale(pos, hpr,
110 INLINE CPT(TransformState) TransformState::
111 make_scale(PN_stdfloat scale) {
114 return make_scale2d(scale);
123 INLINE CPT(TransformState) TransformState::
125 return make_pos_hpr_scale(
LVecBase3(0.0f, 0.0f, 0.0f),
136 INLINE CPT(TransformState) TransformState::
138 return make_pos_hpr_scale_shear(
LVecBase3(0.0f, 0.0f, 0.0f),
150 INLINE CPT(TransformState) TransformState::
162 INLINE CPT(TransformState) TransformState::
174 INLINE CPT(TransformState) TransformState::
176 return make_pos_rotate_scale2d(pos, 0.0f,
LVecBase2(1.0f, 1.0f));
185 INLINE CPT(TransformState) TransformState::
186 make_rotate2d(PN_stdfloat rotate) {
187 return make_pos_rotate_scale2d(
LVecBase2(0.0f, 0.0f), rotate,
197 INLINE CPT(TransformState) TransformState::
198 make_pos_rotate2d(const
LVecBase2 &pos, PN_stdfloat rotate) {
199 return make_pos_rotate_scale2d(pos, rotate,
209 INLINE CPT(TransformState) TransformState::
210 make_scale2d(PN_stdfloat scale) {
211 return make_pos_rotate_scale2d(
LVecBase2(0.0f, 0.0f), 0.0f,
221 INLINE CPT(TransformState) TransformState::
223 return make_pos_rotate_scale2d(
LVecBase2(0.0f, 0.0f), 0.0f, scale);
232 INLINE CPT(TransformState) TransformState::
233 make_shear2d(PN_stdfloat shear) {
234 return make_pos_rotate_scale_shear2d(
LVecBase2(0.0f, 0.0f), 0.0f,
244 INLINE CPT(TransformState) TransformState::
245 make_pos_rotate_scale2d(const
LVecBase2 &pos, PN_stdfloat rotate,
247 return make_pos_rotate_scale_shear2d(pos, rotate, scale, 0.0f);
256 INLINE
bool TransformState::
257 is_identity()
const {
258 return ((_flags & F_is_identity) != 0);
268 INLINE
bool TransformState::
270 return ((_flags & F_is_invalid) != 0);
280 INLINE
bool TransformState::
281 is_singular()
const {
283 return ((_flags & F_is_singular) != 0);
294 INLINE
bool TransformState::
296 return ((_flags & F_is_2d) != 0);
318 INLINE
bool TransformState::
319 has_components()
const {
321 return ((_flags & F_has_components) != 0);
337 INLINE
bool TransformState::
338 components_given()
const {
339 return ((_flags & F_components_given) != 0);
350 INLINE
bool TransformState::
352 return ((_flags & F_hpr_given) != 0);
363 INLINE
bool TransformState::
365 return ((_flags & F_quat_given) != 0);
376 INLINE
bool TransformState::
378 return !is_invalid();
389 INLINE
bool TransformState::
391 return has_components();
402 INLINE
bool TransformState::
404 return has_components();
414 INLINE
bool TransformState::
416 return has_components();
425 INLINE
bool TransformState::
426 has_identity_scale()
const {
428 return (_flags & F_identity_scale) != 0;
439 INLINE
bool TransformState::
440 has_uniform_scale()
const {
442 return (_flags & F_uniform_scale) != 0;
452 INLINE
bool TransformState::
454 return has_components();
464 INLINE
bool TransformState::
465 has_nonzero_shear()
const {
467 return (_flags & F_has_nonzero_shear) != 0;
477 INLINE
bool TransformState::
479 return !is_invalid();
488 INLINE
const LPoint3 &TransformState::
491 nassertr(has_pos(), _pos);
505 nassertr(!is_invalid(), _hpr);
526 nassertr(!is_invalid(), _quat);
540 get_norm_quat()
const {
542 nassertr(!is_invalid(), _norm_quat);
556 nassertr(!is_invalid(), _scale);
567 INLINE PN_stdfloat TransformState::
568 get_uniform_scale()
const {
570 nassertr(has_uniform_scale(), _scale[0]);
584 nassertr(!is_invalid(), _shear);
593 INLINE
const LMatrix4 &TransformState::
622 INLINE PN_stdfloat TransformState::
623 get_rotate2d()
const {
625 nassertr(!is_invalid() && is_2d(), 0);
626 switch (get_default_coordinate_system()) {
647 get_scale2d()
const {
660 INLINE PN_stdfloat TransformState::
661 get_shear2d()
const {
663 nassertr(!is_invalid() && is_2d(), 0.0f);
678 return LMatrix3(_mat(0, 0), _mat(0, 1), _mat(0, 3),
679 _mat(1, 0), _mat(1, 1), _mat(1, 3),
680 _mat(3, 0), _mat(3, 1), _mat(3, 3));
691 INLINE CPT(TransformState) TransformState::
692 get_inverse()
const {
693 return invert_compose(TransformState::make_identity());
706 INLINE CPT(TransformState) TransformState::
708 return return_unique((TransformState *)
this);
721 INLINE
int TransformState::
722 get_geom_rendering(
int geom_rendering)
const {
723 if ((geom_rendering & GeomEnums::GR_point_perspective) != 0) {
724 if (!has_identity_scale()) {
725 geom_rendering |= GeomEnums::GR_point_scale;
729 return geom_rendering;
737 INLINE
void TransformState::
740 int old_referenced_bits = get_referenced_bits();
742 consider_update_pstats(old_referenced_bits);
753 INLINE
bool TransformState::
754 cache_unref()
const {
756 int old_referenced_bits = get_referenced_bits();
757 bool result = do_cache_unref();
758 consider_update_pstats(old_referenced_bits);
761 return do_cache_unref();
770 INLINE
void TransformState::
773 int old_referenced_bits = get_referenced_bits();
775 consider_update_pstats(old_referenced_bits);
786 INLINE
bool TransformState::
789 int old_referenced_bits = get_referenced_bits();
790 bool result = do_node_unref();
791 consider_update_pstats(old_referenced_bits);
794 return do_node_unref();
807 INLINE
int TransformState::
808 get_composition_cache_num_entries()
const {
810 return _composition_cache.get_num_entries();
822 INLINE
int TransformState::
823 get_invert_composition_cache_num_entries()
const {
825 return _invert_composition_cache.get_num_entries();
840 INLINE
int TransformState::
841 get_composition_cache_size()
const {
843 return _composition_cache.get_size();
857 INLINE
const TransformState *TransformState::
858 get_composition_cache_source(
int n)
const {
860 if (!_composition_cache.has_element(n)) {
863 return _composition_cache.get_key(n);
880 INLINE
const TransformState *TransformState::
881 get_composition_cache_result(
int n)
const {
883 if (!_composition_cache.has_element(n)) {
886 return _composition_cache.get_data(n)._result;
901 INLINE
int TransformState::
902 get_invert_composition_cache_size()
const {
904 return _invert_composition_cache.get_size();
918 INLINE
const TransformState *TransformState::
919 get_invert_composition_cache_source(
int n)
const {
921 if (!_invert_composition_cache.has_element(n)) {
924 return _invert_composition_cache.get_key(n);
942 INLINE
const TransformState *TransformState::
943 get_invert_composition_cache_result(
int n)
const {
945 if (!_invert_composition_cache.has_element(n)) {
948 return _invert_composition_cache.get_data(n)._result;
956 INLINE
void TransformState::
958 _node_counter.flush_level();
959 _cache_counter.flush_level();
968 INLINE
bool TransformState::
969 do_node_unref()
const {
981 INLINE
bool TransformState::
982 do_cache_unref()
const {
992 INLINE
void TransformState::
996 if ((_flags & F_hash_known) == 0) {
997 ((TransformState *)
this)->calc_hash();
1006 INLINE
void TransformState::
1007 check_singular()
const {
1010 if ((_flags & F_singular_known) == 0) {
1011 ((TransformState *)
this)->calc_singular();
1021 INLINE
void TransformState::
1022 check_components()
const {
1025 if ((_flags & F_components_known) == 0) {
1026 ((TransformState *)
this)->calc_components();
1036 INLINE
void TransformState::
1040 if ((_flags & F_hpr_known) == 0) {
1041 ((TransformState *)
this)->calc_hpr();
1051 INLINE
void TransformState::
1052 check_quat()
const {
1055 if ((_flags & F_quat_known) == 0) {
1056 ((TransformState *)
this)->calc_quat();
1066 INLINE
void TransformState::
1067 check_norm_quat()
const {
1070 if ((_flags & F_norm_quat_known) == 0) {
1071 ((TransformState *)
this)->calc_norm_quat();
1080 INLINE
void TransformState::
1084 if ((_flags & F_mat_known) == 0) {
1085 ((TransformState *)
this)->calc_mat();
1094 INLINE
void TransformState::
1105 INLINE
void TransformState::
1108 do_calc_components();
1117 INLINE
void TransformState::
1128 INLINE
void TransformState::
1145 INLINE
void TransformState::
1146 check_uniform_scale() {
1147 if (IS_NEARLY_EQUAL(_scale[0], _scale[1]) &&
1148 IS_NEARLY_EQUAL(_scale[0], _scale[2])) {
1149 _flags |= F_uniform_scale;
1150 if (IS_NEARLY_EQUAL(_scale[0], 1.0f)) {
1151 _flags |= F_identity_scale;
1156 _flags |= F_has_nonzero_shear;
1171 INLINE
void TransformState::
1172 check_uniform_scale2d() {
1173 if (IS_NEARLY_EQUAL(_scale[0], _scale[1])) {
1174 _scale[2] = _scale[0];
1175 _flags |= F_uniform_scale;
1176 if (IS_NEARLY_EQUAL(_scale[0], 1.0f)) {
1177 _flags |= F_identity_scale;
1182 _flags |= F_has_nonzero_shear;
1195 INLINE
void TransformState::
1198 _flags |= F_is_destructing;
1211 INLINE
bool TransformState::
1212 is_destructing()
const {
1214 return (_flags & F_is_destructing) != 0;
1226 INLINE
void TransformState::
1227 consider_update_pstats(
int old_referenced_bits)
const {
1229 int new_referenced_bits = get_referenced_bits();
1230 if (old_referenced_bits != new_referenced_bits) {
1231 update_pstats(old_referenced_bits, new_referenced_bits);
1241 INLINE TransformState::Composition::
1250 INLINE TransformState::Composition::
1251 Composition(
const TransformState::Composition ©) :
1252 _result(copy._result)
1261 INLINE TransformState::CompositionCycleDescEntry::
1262 CompositionCycleDescEntry(
const TransformState *obj,
1263 const TransformState *result,
static const LMatrix4f & ident_mat()
Returns an identity matrix.
This is the base class for all three-component vectors and points.
static const LMatrix3f & ident_mat()
Returns an identity matrix.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
static const LVecBase2f & zero()
Returns a zero-length vector.
static const LVecBase3f & zero()
Returns a zero-length vector.
This is a 4-by-4 transform matrix.
Similar to MutexHolder, but for a light mutex.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
This is the base class for all two-component vectors and points.
void node_ref() const
Explicitly increments the reference count.
Similar to MutexHolder, but for a light reentrant mutex.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This is the base quaternion class.
This is a 3-by-3 transform matrix.