00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc. 00008 * 477 Richmond Street West, Suite 1001 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __SIM_PositionSimple_h__ 00015 #define __SIM_PositionSimple_h__ 00016 00017 #include "SIM_API.h" 00018 #include "SIM_Position.h" 00019 #include "SIM_OptionsUser.h" 00020 00021 /// This is the simplest implementation for standard positional data. 00022 /// Positional data is not exactly the same as a transform in that it 00023 /// does not permit scales, and the rotation is always applied before 00024 /// the translation. 00025 class SIM_API SIM_PositionSimple : public SIM_Position, 00026 public SIM_OptionsUser 00027 { 00028 public: 00029 /// TODO: These accessors are shadowing the SIM_Position versions. 00030 /// This is a bad thing as getPivot() will not invoke getPivotSubclass 00031 /// and anyone trying to chase the call graph will see an apparent 00032 /// infinite loop. We need to rename these to RawPosition, I think. 00033 00034 /// Control the translation attribute of the position. 00035 GETSET_DATA_FUNCS_V3(SIM_NAME_POSITION, Position); 00036 /// Control the pivot point which the orientation is applied to. 00037 GETSET_DATA_FUNCS_V3(SIM_NAME_PIVOT, Pivot); 00038 /// Control the orientation attribute of the position. 00039 GETSET_DATA_FUNCS_Q(SIM_NAME_ORIENTATION, Orientation); 00040 00041 protected: 00042 explicit SIM_PositionSimple(const SIM_DataFactory *factory); 00043 virtual ~SIM_PositionSimple(); 00044 00045 /// Override this function so that we can understand an option 00046 /// called rotation. Although this attribute isn't supported directly, 00047 /// it can be reinterpreted into the orientation option. 00048 virtual void optionChangedSubclass(const char *name); 00049 00050 /// Gets a transform matrix from our position and rotation data. 00051 virtual void getTransformSubclass(UT_DMatrix4 &xform) const; 00052 00053 /// Gets the inverse transform matrix from our position and rotation. 00054 /// Because we build our transform matrices just in time, this is 00055 /// faster than getTransform() & invert(). 00056 virtual void getInverseTransformSubclass(UT_DMatrix4 &xform) const; 00057 00058 /// Gets a rotation matrix from our position data. 00059 virtual void getOrientationSubclass(UT_Quaternion &q) const; 00060 00061 /// Gets a translation vector from our position data. 00062 virtual void getPositionSubclass(UT_Vector3 &t) const; 00063 00064 /// Gets pivot info from our position data. 00065 virtual void getPivotSubclass(UT_Vector3 &p) const; 00066 00067 /// Transforms a point into worldspace from object space. 00068 /// This is the same as multiplying by getTransform() 00069 virtual UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const; 00070 00071 /// Transforms a point into object space from world space. 00072 /// This is the same as multiplying by getInverseTransform() 00073 virtual UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const; 00074 00075 /// Interpolation of positions can't be done in a componentwise 00076 /// fashion. If pivot is changing over time it is important 00077 /// that we adjust the rotation/translation to account for it. 00078 virtual void interpolateSubclass(const SIM_Data *source1, 00079 const SIM_Data *source2, 00080 fpreal interp); 00081 00082 private: 00083 static const SIM_DopDescription *getPositionSimpleDopDescription(); 00084 00085 DECLARE_STANDARD_GETCASTTOTYPE(); 00086 DECLARE_DATAFACTORY(SIM_PositionSimple, 00087 SIM_Position, 00088 "Position", 00089 getPositionSimpleDopDescription()); 00090 }; 00091 00092 #endif 00093
1.5.9