47 make_pos(
const LVecBase3 &pos) {
48 return make_pos_hpr_scale(pos,
49 LVecBase3(0.0f, 0.0f, 0.0f),
50 LVecBase3(1.0f, 1.0f, 1.0f));
57 make_hpr(
const LVecBase3 &hpr) {
58 return make_pos_hpr_scale(LVecBase3(0.0f, 0.0f, 0.0f),
60 LVecBase3(1.0f, 1.0f, 1.0f));
67 make_quat(
const LQuaternion &quat) {
68 return make_pos_quat_scale(LVecBase3(0.0f, 0.0f, 0.0f),
70 LVecBase3(1.0f, 1.0f, 1.0f));
77 make_pos_hpr(
const LVecBase3 &pos,
const LVecBase3 &hpr) {
78 return make_pos_hpr_scale(pos, hpr,
79 LVecBase3(1.0, 1.0f, 1.0f));
86 make_scale(PN_stdfloat scale) {
89 return make_scale2d(scale);
96 make_scale(
const LVecBase3 &scale) {
97 return make_pos_hpr_scale(LVecBase3(0.0f, 0.0f, 0.0f),
98 LVecBase3(0.0f, 0.0f, 0.0f),
106 make_shear(
const LVecBase3 &shear) {
107 return make_pos_hpr_scale_shear(LVecBase3(0.0f, 0.0f, 0.0f),
108 LVecBase3(0.0f, 0.0f, 0.0f),
109 LVecBase3(1.0f, 1.0f, 1.0f),
117 make_pos_hpr_scale(
const LVecBase3 &pos,
const LVecBase3 &hpr,
118 const LVecBase3 &scale) {
119 return make_pos_hpr_scale_shear(pos, hpr, scale, LVecBase3::zero());
126 make_pos_quat_scale(
const LVecBase3 &pos,
const LQuaternion &quat,
127 const LVecBase3 &scale) {
128 return make_pos_quat_scale_shear(pos, quat, scale, LVecBase3::zero());
135 make_pos2d(
const LVecBase2 &pos) {
136 return make_pos_rotate_scale2d(pos, 0.0f, LVecBase2(1.0f, 1.0f));
143 make_rotate2d(PN_stdfloat rotate) {
144 return make_pos_rotate_scale2d(LVecBase2(0.0f, 0.0f), rotate,
145 LVecBase2(1.0f, 1.0f));
152 make_pos_rotate2d(
const LVecBase2 &pos, PN_stdfloat rotate) {
153 return make_pos_rotate_scale2d(pos, rotate,
154 LVecBase2(1.0, 1.0f));
161 make_scale2d(PN_stdfloat scale) {
162 return make_pos_rotate_scale2d(LVecBase2(0.0f, 0.0f), 0.0f,
163 LVecBase2(scale, scale));
170 make_scale2d(
const LVecBase2 &scale) {
171 return make_pos_rotate_scale2d(LVecBase2(0.0f, 0.0f), 0.0f, scale);
178 make_shear2d(PN_stdfloat shear) {
179 return make_pos_rotate_scale_shear2d(LVecBase2(0.0f, 0.0f), 0.0f,
180 LVecBase2(1.0f, 1.0f), shear);
187 make_pos_rotate_scale2d(
const LVecBase2 &pos, PN_stdfloat rotate,
188 const LVecBase2 &scale) {
189 return make_pos_rotate_scale_shear2d(pos, rotate, scale, 0.0f);
198 return ((_flags & F_is_identity) != 0);
208 return ((_flags & F_is_invalid) != 0);
218 return ((_flags & F_is_singular) != 0);
228 return ((_flags & F_is_2d) != 0);
248 return ((_flags & F_has_components) != 0);
261 return ((_flags & F_components_given) != 0);
271 return ((_flags & F_hpr_given) != 0);
281 return ((_flags & F_quat_given) != 0);
330 return (_flags & F_identity_scale) != 0;
341 return (_flags & F_uniform_scale) != 0;
360 return (_flags & F_has_nonzero_shear) != 0;
376 INLINE
const LPoint3 &TransformState::
387 INLINE
const LVecBase3 &TransformState::
403 INLINE
const LQuaternion &TransformState::
416 INLINE
const LQuaternion &TransformState::
417 get_norm_quat()
const {
427 INLINE
const LVecBase3 &TransformState::
449 INLINE
const LVecBase3 &TransformState::
459 INLINE
const LMatrix4 &TransformState::
461 nassertr(
has_mat(), LMatrix4::ident_mat());
474 return LVecBase2(_pos[0], _pos[1]);
486 switch (get_default_coordinate_system()) {
507 return LVecBase2(_scale[0], _scale[1]);
529 return LMatrix3(_mat(0, 0), _mat(0, 1), _mat(0, 3),
530 _mat(1, 0), _mat(1, 1), _mat(1, 3),
531 _mat(3, 0), _mat(3, 1), _mat(3, 3));
540 get_inverse()
const {
541 return invert_compose(TransformState::make_identity());
562 INLINE
int TransformState::
563 get_geom_rendering(
int geom_rendering)
const {
564 if ((geom_rendering & GeomEnums::GR_point_perspective) != 0) {
566 geom_rendering |= GeomEnums::GR_point_scale;
570 return geom_rendering;
576 INLINE
void TransformState::
581 consider_update_pstats(old_referenced_bits);
590 INLINE
bool TransformState::
591 cache_unref()
const {
594 bool result = do_cache_unref();
595 consider_update_pstats(old_referenced_bits);
598 return do_cache_unref();
605 INLINE
void TransformState::
610 consider_update_pstats(old_referenced_bits);
619 INLINE
bool TransformState::
623 bool result = do_node_unref();
624 consider_update_pstats(old_referenced_bits);
627 return do_node_unref();
637 INLINE
size_t TransformState::
638 get_composition_cache_num_entries()
const {
649 INLINE
size_t TransformState::
650 get_invert_composition_cache_num_entries()
const {
664 INLINE
size_t TransformState::
665 get_composition_cache_size()
const {
679 get_composition_cache_source(
size_t n)
const {
681 return _composition_cache.
get_key(n);
696 get_composition_cache_result(
size_t n)
const {
698 return _composition_cache.
get_data(n)._result;
710 INLINE
size_t TransformState::
711 get_invert_composition_cache_size()
const {
725 get_invert_composition_cache_source(
size_t n)
const {
727 return _invert_composition_cache.
get_key(n);
742 get_invert_composition_cache_result(
size_t n)
const {
744 return _invert_composition_cache.
get_data(n)._result;
750 INLINE
void TransformState::
752 _node_counter.flush_level();
753 _cache_counter.flush_level();
760 INLINE
bool TransformState::
761 do_node_unref()
const {
770 INLINE
bool TransformState::
771 do_cache_unref()
const {
779 INLINE
void TransformState::
783 if ((_flags & F_hash_known) == 0) {
791 INLINE
void TransformState::
792 check_singular()
const {
795 if ((_flags & F_singular_known) == 0) {
804 INLINE
void TransformState::
805 check_components()
const {
808 if ((_flags & F_components_known) == 0) {
817 INLINE
void TransformState::
821 if ((_flags & F_hpr_known) == 0) {
830 INLINE
void TransformState::
834 if ((_flags & F_quat_known) == 0) {
843 INLINE
void TransformState::
844 check_norm_quat()
const {
847 if ((_flags & F_norm_quat_known) == 0) {
855 INLINE
void TransformState::
859 if ((_flags & F_mat_known) == 0) {
867 INLINE
void TransformState::
876 INLINE
void TransformState::
879 do_calc_components();
885 INLINE
void TransformState::
894 INLINE
void TransformState::
908 INLINE
void TransformState::
909 check_uniform_scale() {
910 if (IS_NEARLY_EQUAL(_scale[0], _scale[1]) &&
911 IS_NEARLY_EQUAL(_scale[0], _scale[2])) {
912 _flags |= F_uniform_scale;
913 if (IS_NEARLY_EQUAL(_scale[0], 1.0f)) {
914 _flags |= F_identity_scale;
918 if (!_shear.almost_equal(LVecBase3::zero())) {
919 _flags |= F_has_nonzero_shear;
931 INLINE
void TransformState::
932 check_uniform_scale2d() {
933 if (IS_NEARLY_EQUAL(_scale[0], _scale[1])) {
934 _scale[2] = _scale[0];
935 _flags |= F_uniform_scale;
936 if (IS_NEARLY_EQUAL(_scale[0], 1.0f)) {
937 _flags |= F_identity_scale;
941 if (!_shear.almost_equal(LVecBase3::zero())) {
942 _flags |= F_has_nonzero_shear;
951 INLINE
void TransformState::
954 _flags |= F_is_destructing;
963 INLINE
bool TransformState::
964 is_destructing()
const {
966 return (_flags & F_is_destructing) != 0;
976 INLINE
void TransformState::
977 consider_update_pstats(
int old_referenced_bits)
const {
980 if (old_referenced_bits != new_referenced_bits) {
981 update_pstats(old_referenced_bits, new_referenced_bits);
989 INLINE TransformState::Composition::
996 INLINE TransformState::Composition::
997 Composition(
const TransformState::Composition ©) :
998 _result(copy._result)
1005 INLINE TransformState::CompositionCycleDescEntry::
const Value & get_data(size_t n) const
Returns the data in the nth entry of the table.
void node_ref() const
Explicitly increments the reference count.
size_t get_num_entries() const
Returns the number of active entries in the table.
Similar to MutexHolder, but for a light mutex.
const Key & get_key(size_t n) const
Returns the key in the nth entry of the table.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
Similar to MutexHolder, but for a light reentrant mutex.
int get_referenced_bits() const
Returns the union of the values defined in the Referenced enum that represents the various things tha...