17 INLINE EggTransform::Component::
18 Component(EggTransform::ComponentType type,
double number) :
31 INLINE EggTransform::Component::
32 Component(
const EggTransform::Component ©) :
40 if (copy._vec2 !=
nullptr) {
41 _vec2 =
new LVector2d(*copy._vec2);
43 if (copy._vec3 !=
nullptr) {
44 _vec3 =
new LVector3d(*copy._vec3);
46 if (copy._mat3 !=
nullptr) {
47 _mat3 =
new LMatrix3d(*copy._mat3);
49 if (copy._mat4 !=
nullptr) {
50 _mat4 =
new LMatrix4d(*copy._mat4);
57 INLINE
void EggTransform::Component::
58 operator = (
const EggTransform::Component ©) {
60 _number = copy._number;
61 if (_vec2 !=
nullptr) {
65 if (_vec3 !=
nullptr) {
69 if (_mat3 !=
nullptr) {
73 if (_mat4 !=
nullptr) {
77 if (copy._vec2 !=
nullptr) {
78 _vec2 =
new LVecBase2d(*copy._vec2);
80 if (copy._vec3 !=
nullptr) {
81 _vec3 =
new LVecBase3d(*copy._vec3);
83 if (copy._mat3 !=
nullptr) {
84 _mat3 =
new LMatrix3d(*copy._mat3);
86 if (copy._mat4 !=
nullptr) {
87 _mat4 =
new LMatrix4d(*copy._mat4);
94 INLINE EggTransform::Component::
96 if (_vec2 !=
nullptr) {
99 if (_vec3 !=
nullptr) {
102 if (_mat3 !=
nullptr) {
105 if (_mat4 !=
nullptr) {
115 internal_clear_transform();
124 internal_add_matrix(mat);
133 internal_add_matrix(mat);
144 return !_components.empty();
166 internal_set_transform(mat);
189 internal_set_transform(mat);
200 const LMatrix4d &t = _transform;
201 return LMatrix3d(t(0, 0), t(0, 1), t(0, 3),
202 t(1, 0), t(1, 1), t(1, 3),
203 t(3, 0), t(3, 1), t(3, 3));
221 return _components.empty() ||
222 _transform.almost_equal(LMatrix4d::ident_mat(), 0.0001);
230 return _components.size();
238 nassertr(n >= 0 && n < (
int)_components.size(), CT_invalid);
239 return _components[n]._type;
250 nassertr(n >= 0 && n < (
int)_components.size(), 0.0);
251 return _components[n]._number;
261 nassertr(n >= 0 && n < (
int)_components.size(), LVector2d::zero());
262 nassertr(_components[n]._vec2 !=
nullptr, LVector2d::zero());
263 return *_components[n]._vec2;
273 nassertr(n >= 0 && n < (
int)_components.size(), LVector3d::zero());
274 nassertr(_components[n]._vec3 !=
nullptr, LVector3d::zero());
275 return *_components[n]._vec3;
284 nassertr(n >= 0 && n < (
int)_components.size(), LMatrix3d::ident_mat());
285 nassertr(_components[n]._mat3 !=
nullptr, LMatrix3d::ident_mat());
286 return *_components[n]._mat3;
295 nassertr(n >= 0 && n < (
int)_components.size(), LMatrix4d::ident_mat());
296 nassertr(_components[n]._mat4 !=
nullptr, LMatrix4d::ident_mat());
297 return *_components[n]._mat4;
303 INLINE
void EggTransform::
304 internal_set_transform(
const LMatrix3d &mat) {
305 internal_clear_transform();
306 internal_add_matrix(mat);
312 INLINE
void EggTransform::
313 internal_set_transform(
const LMatrix4d &mat) {
314 internal_clear_transform();
315 internal_add_matrix(mat);