- TransformModifier(const Callback& changed, const Callback& apply) :
- m_translation(c_translation_identity),
- m_rotation(c_quaternion_identity),
- m_scale(c_scale_identity),
- m_changed(changed),
- m_apply(apply),
- m_type(TRANSFORM_PRIMITIVE)
- {
- }
- void setType(TransformModifierType type)
- {
- m_type = type;
- }
- TransformModifierType getType() const
- {
- return m_type;
- }
- void setTranslation(const Translation& value)
- {
- m_translation = value;
- m_changed();
- }
- void setRotation(const Rotation& value)
- {
- m_rotation = value;
- m_changed();
- }
- void setScale(const Scale& value)
- {
- m_scale = value;
- m_changed();
- }
- void freezeTransform()
- {
- if(m_translation != c_translation_identity
- || m_rotation != c_rotation_identity
- || m_scale != c_scale_identity)
- {
- m_apply();
- m_translation = c_translation_identity;
- m_rotation = c_rotation_identity;
- m_scale = c_scale_identity;
- m_changed();
- }
- }
- const Translation& getTranslation() const
- {
- return m_translation;
- }
- const Rotation& getRotation() const
- {
- return m_rotation;
- }
- const Scale& getScale() const
- {
- return m_scale;
- }
- Matrix4 calculateTransform() const
- {
- return matrix4_transform_for_components(getTranslation(), getRotation(), getScale());
- }
+TransformModifier( const Callback& changed, const Callback& apply ) :
+ m_translation( c_translation_identity ),
+ m_rotation( c_quaternion_identity ),
+ m_scale( c_scale_identity ),
+ m_changed( changed ),
+ m_apply( apply ),
+ m_type( TRANSFORM_PRIMITIVE ){
+}
+void setType( TransformModifierType type ){
+ m_type = type;
+}
+TransformModifierType getType() const {
+ return m_type;
+}
+void setTranslation( const Translation& value ){
+ m_translation = value;
+ m_changed();
+}
+void setRotation( const Rotation& value ){
+ m_rotation = value;
+ m_changed();
+}
+void setScale( const Scale& value ){
+ m_scale = value;
+ m_changed();
+}
+void freezeTransform(){
+ if ( m_translation != c_translation_identity
+ || m_rotation != c_rotation_identity
+ || m_scale != c_scale_identity ) {
+ m_apply();
+ m_translation = c_translation_identity;
+ m_rotation = c_rotation_identity;
+ m_scale = c_scale_identity;
+ m_changed();
+ }
+}
+const Translation& getTranslation() const {
+ return m_translation;
+}
+const Rotation& getRotation() const {
+ return m_rotation;
+}
+const Scale& getScale() const {
+ return m_scale;
+}
+Matrix4 calculateTransform() const {
+ return matrix4_transform_for_components( getTranslation(), getRotation(), getScale() );
+}