IKJoint.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.
00006 // Use of this software is subject to the terms of the Autodesk license agreement
00007 // provided at the time of installation or download, or which otherwise accompanies
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 #ifndef _IKJOINT_H
00013 #define _IKJOINT_H
00014 
00015 #include "IK.h"
00016 
00017 
00021 class XSIEXPORT CSLIKResolutionPlane
00022     : public CSLTemplate
00023 {
00024 public:
00026     enum EIKResPlaneType
00027     {
00028         SI_IKRPTYPE_DEFAULT,            
00029         SI_IKRPTYPE_PREFAXIS,           
00030         SI_IKRPTYPE_UPVECTOR,           
00031     };
00032 
00039     CSLIKResolutionPlane(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00040 
00043     virtual ~CSLIKResolutionPlane();
00044 
00048     EIKResPlaneType GetResolutionPlaneType();
00049 
00054     SI_Void SetResolutionPlaneType(EIKResPlaneType in_Type);
00055 
00059     SI_Float GetRoll();
00060 
00065     SI_Void SetRoll(SI_Float in_fValue);
00066 
00070     SI_Bool GetPrefRotXAsRoll();
00071 
00076     SI_Void SetPrefRotXAsRoll(SI_Bool in_bValue);
00077 
00081     CSIBCVector3D GetUpVector();
00082 
00087     SI_Void SetUpVector(CSIBCVector3D &in_rValue);
00088 
00092     SI_Bool GetUpVectorRelativeToRoot();
00093 
00098     SI_Void SetUpVectorRelativeToRoot(SI_Bool in_bValue);
00099 
00100 
00104     CSIBCVector3D GetPreferredRotation();
00105 
00110     SI_Void SetPreferredRotation(CSIBCVector3D &in_rValue);
00111 
00115     SI_Bool GetPreferredRotationRelativeToRoot();
00116 
00121     SI_Void SetPreferredRotationRelativeToRoot(SI_Bool in_bValue);
00122 
00127     virtual SI_Error Synchronize();
00128 
00132     virtual ETemplateType Type();
00133 
00138     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
00139 
00144     virtual SI_Bool ValidateParent(CSLModel *in_pNewParent);
00145 
00146     CSLIntProxy*        GetTypeProxy() { return &m_Type; };
00147     CSLFloatProxy*      GetRollProxy() { return & m_Roll; };
00148     CSLBoolProxy*       GetPrefRotXAsRollProxy() { return & m_PrefRotXAsRoll; };
00149     CSLVector3DProxy*   GetUpVectorProxy() { return & m_UpVector; };
00150     CSLBoolProxy*       GetUpVectorRelativeToRootProxy() { return & m_UpVectorRelativeToRoot; };
00151     CSLVector3DProxy*   GetPreferredRotationProxy() { return & m_PreferredRotation; };
00152     CSLBoolProxy*       GetPrefRotRelativeToRootProxy() { return & m_PrefRotRelativeToRoot; };
00153 
00154 private:
00155 
00156     CSLIntProxy m_Type;
00157     CSLFloatProxy m_Roll;
00158     CSLBoolProxy m_PrefRotXAsRoll;
00159     CSLVector3DProxy m_UpVector;
00160     CSLBoolProxy m_UpVectorRelativeToRoot;
00161     CSLVector3DProxy m_PreferredRotation;
00162     CSLBoolProxy m_PrefRotRelativeToRoot;
00163 
00164     void *m_pReserved;  // reserved for future extension
00165 };
00166 
00167 
00171 class XSIEXPORT CSLIKJoint
00172     : public CSLIK
00173 {
00174 public:
00176     enum EJointSolverType
00177     {
00178         SI_DEFAULT,         
00179         SI_2D,              
00180         SI_3D,              
00181     };
00182 
00190     CSLIKJoint(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate, CSLModel* in_pRoot);
00191 
00194     virtual ~CSLIKJoint();
00195 
00199     SI_Float GetLength();
00200 
00205     SI_Void SetLength(SI_Float in_fValue);
00206 
00210     CSIBCVector3D GetPreferredRotation();
00211 
00216     SI_Void SetPreferredRotation(CSIBCVector3D &in_rValue);
00217 
00221     SI_Bool GetPseudoRoot();
00222 
00227     SI_Void SetPseudoRoot(SI_Bool in_bValue);
00228 
00232     SI_Bool GetRotationLimitActivation();
00233 
00238     SI_Void SetRotationLimitActivation(SI_Bool in_bValue);
00239 
00243     CSIBCVector3D GetRotationLimitMaximum();
00244 
00249     SI_Void SetRotationLimitMaximum(CSIBCVector3D &in_rValue);
00250 
00254     CSIBCVector3D GetRotationLimitMinimum();
00255 
00260     SI_Void SetRotationLimitMinimum(CSIBCVector3D &in_rValue);
00261 
00265     EJointSolverType GetSolverType();
00266 
00271     SI_Void SetSolverType(EJointSolverType in_Type);
00272 
00276     SI_Float GetStiffness();
00277 
00282     SI_Void SetStiffness(SI_Float in_fValue);
00283 
00287     SI_Bool GetStiffnessActivation();
00288 
00293     SI_Void SetStiffnessActivation(SI_Bool in_bValue);
00294 
00298     CSLIKResolutionPlane* GetResolutionPlane();
00299 
00303     CSLIKResolutionPlane* CreateResolutionPlane();
00304 
00309     SI_Void ConnectResolutionPlane(CSLIKResolutionPlane *in_pResPlane);
00310 
00315     virtual SI_Error Synchronize();
00316 
00320     virtual ETemplateType Type();
00321 
00326     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
00327 
00332     virtual SI_Bool ValidateParent(CSLModel *in_pNewParent);
00333 
00334     CSLVector3DProxy*   GetPreferredRotationProxy(){ return &m_PreferredRotation;};
00335     CSLBoolProxy*       GetLimitActivationProxy(){ return &m_RotationLimitActivation;};
00336     CSLVector3DProxy*   GetRotationLimitMinimumProxy(){ return &m_RotationLimitMinimum;};
00337     CSLVector3DProxy*   GetRotationLimitMaximumProxy(){ return &m_RotationLimitMaximum;};
00338     CSLBoolProxy*       GetPseudoRootProxy(){ return &m_PseudoRoot;};
00339     CSLBoolProxy*       GetStiffnessActivationProxy(){ return &m_StiffnessActivation;};
00340     CSLFloatProxy*      GetStiffnessProxy(){ return &m_Stiffness;};
00341     CSLFloatProxy*      GetLengthProxy(){ return &m_Length;};
00342 
00343 private:
00344     CSLStrEnumProxy<EJointSolverType, SI_3D> m_SolverType;
00345     CSLVector3DProxy m_PreferredRotation;
00346     CSLBoolProxy m_RotationLimitActivation;
00347     CSLVector3DProxy m_RotationLimitMinimum;
00348     CSLVector3DProxy m_RotationLimitMaximum;
00349     CSLBoolProxy m_PseudoRoot;
00350     CSLBoolProxy m_StiffnessActivation;
00351     CSLFloatProxy m_Stiffness;
00352     CSLFloatProxy m_Length;
00353 
00354     CSLIKResolutionPlane *m_pResolutionPlane;
00355 
00356     void *m_pReserved;  // reserved for future extension
00357 };
00358 
00359 #endif