imesh/bodymesh.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

imesh/bodymesh.h
Go to the documentation of this file.

    00001 /*
    00002   Copyright (C) 2009-10 Christian Van Brussel, Institute of Information
    00003       and Communication Technologies, Electronics and Applied Mathematics
    00004       at Universite catholique de Louvain, Belgium
    00005       http://www.uclouvain.be/en-icteam.html
    00006
    00007   This library is free software; you can redistribute it and/or
    00008   modify it under the terms of the GNU Library General Public
    00009   License as published by the Free Software Foundation; either
    00010   version 2 of the License, or (at your option) any later version.
    00011
    00012   This library is distributed in the hope that it will be useful,
    00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015   Library General Public License for more details.
    00016
    00017   You should have received a copy of the GNU Library General Public
    00018   License along with this library; if not, write to the Free
    00019   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00020 */
    00021 #ifndef __CS_IMESH_BODYMESH_H__
    00022 #define __CS_IMESH_BODYMESH_H__
    00023
    00028 #include "csutil/scf_interface.h"
    00029
    00030 #include "imesh/animnode/skeleton2anim.h"
    00031 #include "ivaria/dynamics.h"
    00032
    00036 namespace CS {
    00037 namespace Animation {
    00038
    00039 struct iSkeletonFactory;
    00040 struct iBodySkeleton;
    00041 struct iBodyBone;
    00042 struct iBodyChain;
    00043 struct iBodyChainNode;
    00044 struct iBodyBoneProperties;
    00045 struct iBodyBoneJoint;
    00046 struct iBodyBoneCollider;
    00047
    00051 struct iBodyManager : public virtual iBase
    00052 {
    00053   SCF_INTERFACE(CS::Animation::iBodyManager, 2, 0, 0);
    00054
    00058   virtual iBodySkeleton* CreateBodySkeleton
    00059     (const char *name, iSkeletonFactory* skeletonFactory) = 0;
    00060
    00064   virtual iBodySkeleton* FindBodySkeleton (const char *name) = 0;
    00065
    00069   virtual void ClearBodySkeletons () = 0;
    00070 };
    00071
    00078 struct iBodySkeleton : public virtual iBase
    00079 {
    00080   SCF_INTERFACE(CS::Animation::iBodySkeleton, 3, 0, 0);
    00081
    00085   virtual const char* GetName () const = 0;
    00086
    00090   virtual iSkeletonFactory* GetSkeletonFactory () const = 0;
    00091
    00095   virtual void ClearAll () = 0;
    00096
    00101   virtual iBodyBone* CreateBodyBone (BoneID boneID) = 0;
    00102
    00106   virtual iBodyBone* FindBodyBone (const char *name) const = 0;
    00107
    00111   virtual void ClearBodyBones () = 0;
    00112
    00119   virtual iBodyChain* CreateBodyChain (const char *name, BoneID rootBone) = 0;
    00120
    00124   virtual iBodyChain* FindBodyChain (const char *name) const = 0;
    00125
    00129   virtual void ClearBodyChains () = 0;
    00130
    00134   virtual iBodyBone* FindBodyBone (BoneID bone) const = 0;
    00135 };
    00136
    00140 struct iBodyBone : public virtual iBase
    00141 {
    00142   SCF_INTERFACE(CS::Animation::iBodyBone, 1, 0, 0);
    00143
    00147   virtual BoneID GetAnimeshBone () const = 0;
    00148
    00154   virtual iBodyBoneProperties* CreateBoneProperties () = 0;
    00155
    00160   virtual iBodyBoneProperties* GetBoneProperties () const = 0;
    00161
    00166   virtual iBodyBoneJoint* CreateBoneJoint () = 0;
    00167
    00172   virtual iBodyBoneJoint* GetBoneJoint () const = 0;
    00173
    00177   virtual iBodyBoneCollider* CreateBoneCollider () = 0;
    00178
    00182   virtual size_t GetBoneColliderCount () const = 0;
    00183
    00187   virtual iBodyBoneCollider* GetBoneCollider (size_t index) const = 0;
    00188 };
    00189
    00194 struct iBodyChain : public virtual iBase
    00195 {
    00196   SCF_INTERFACE(CS::Animation::iBodyChain, 2, 0, 0);
    00197
    00201   virtual const char* GetName () const = 0;
    00202
    00206   virtual iBodySkeleton* GetBodySkeleton () = 0;
    00207
    00211   virtual iBodyChainNode* GetRootNode () = 0;
    00212
    00221   virtual bool AddSubChain (CS::Animation::BoneID subBone) = 0;
    00222
    00227   virtual bool AddAllSubChains () = 0;
    00228
    00232   virtual void DebugPrint () const = 0;
    00233
    00239   virtual void PopulateBoneMask (csBitArray& boneMask) const = 0;
    00240 };
    00241
    00246 struct iBodyChainNode : public virtual iBase
    00247 {
    00248   SCF_INTERFACE(CS::Animation::iBodyChainNode, 2, 0, 1);
    00249
    00253   virtual BoneID GetAnimeshBone () const = 0;
    00254
    00258   virtual size_t GetChildCount () const = 0;
    00259
    00263   virtual iBodyChainNode* GetChild (size_t index) const = 0;
    00264
    00269   virtual iBodyChainNode* GetParent () const = 0;
    00270
    00275   virtual iBodyChainNode* FindSubChild (CS::Animation::BoneID child) const = 0;
    00276
    00280   virtual void DebugPrint () const = 0;
    00281 };
    00282
    00286 struct iBodyBoneProperties : public virtual iBase
    00287 {
    00288   SCF_INTERFACE(CS::Animation::iBodyBoneProperties, 1, 0, 0);
    00289
    00293   virtual void SetMass (float mass) = 0;
    00294
    00298   virtual float GetMass () const = 0;
    00299
    00303   virtual void SetCenter (const csVector3 &center) = 0;
    00304
    00308   virtual csVector3 GetCenter () const = 0;
    00309
    00313   virtual void SetInertia (const csMatrix3 &inertia) = 0;
    00314
    00318   virtual csMatrix3 GetInertia () const = 0;
    00319 };
    00320
    00325 struct iBodyBoneJoint : public virtual iBase
    00326 {
    00327   SCF_INTERFACE(CS::Animation::iBodyBoneJoint, 1, 0, 0);
    00328
    00332   virtual void SetBounce (const csVector3 &bounce) = 0;
    00333
    00337   virtual void SetMaximumAngle (const csVector3 &max) = 0;
    00338
    00342   virtual void SetMaximumDistance (const csVector3 &max) = 0;
    00343
    00347   virtual void SetMinimumAngle (const csVector3 &min) = 0;
    00348
    00352   virtual void SetMinimumDistance (const csVector3 &min) = 0;
    00353
    00357   virtual void SetRotConstraints (bool X, bool Y, bool Z) = 0;
    00358
    00362   virtual void SetTransConstraints (bool X, bool Y, bool Z) = 0;
    00363
    00367   virtual void SetTransform (const csOrthoTransform &transform) = 0;
    00368
    00372   virtual csVector3 GetBounce () const = 0;
    00373
    00377   virtual csVector3 GetMaximumAngle () const = 0;
    00378
    00382   virtual csVector3 GetMaximumDistance () const = 0;
    00383
    00387   virtual csVector3 GetMinimumAngle () const = 0;
    00388
    00392   virtual csVector3 GetMinimumDistance () const = 0;
    00393
    00397   virtual bool IsXRotConstrained () const = 0;
    00398
    00402   virtual bool IsXTransConstrained () const = 0;
    00403
    00407   virtual bool IsYRotConstrained () const = 0;
    00408
    00412   virtual bool IsYTransConstrained () const = 0;
    00413
    00417   virtual bool IsZRotConstrained () const = 0;
    00418
    00422   virtual bool IsZTransConstrained () const = 0;
    00423
    00427   virtual csOrthoTransform GetTransform () const = 0;
    00428 };
    00429
    00435 struct iBodyBoneCollider : public virtual iBase
    00436 {
    00437   SCF_INTERFACE(CS::Animation::iBodyBoneCollider, 2, 0, 1);
    00438
    00442   virtual bool SetBoxGeometry (const csVector3 &box_size) = 0;
    00443
    00447   virtual bool SetCapsuleGeometry (float length, float radius) = 0;
    00448
    00452   virtual bool SetConvexMeshGeometry (iMeshWrapper *mesh) = 0;
    00453
    00457   virtual bool SetCylinderGeometry (float length, float radius) = 0;
    00458
    00462   virtual bool SetMeshGeometry (iMeshWrapper *mesh) = 0;
    00463
    00467   virtual bool SetPlaneGeometry (const csPlane3 &plane) = 0;
    00468
    00472   virtual bool SetSphereGeometry (float radius) = 0;
    00473
    00477   virtual csColliderGeometryType GetGeometryType () const = 0;
    00478
    00483   virtual bool GetBoxGeometry (csVector3 &box_size) const = 0;
    00484
    00489   virtual bool GetCapsuleGeometry (float &length, float &radius) const = 0;
    00490
    00495   virtual bool GetConvexMeshGeometry (iMeshWrapper *&mesh) const = 0;
    00496
    00501   virtual bool GetCylinderGeometry (float &length, float &radius) const = 0;
    00502
    00507   virtual bool GetMeshGeometry (iMeshWrapper *&mesh) const = 0;
    00508
    00513   virtual bool GetPlaneGeometry (csPlane3 &plane) const = 0;
    00514
    00519   virtual bool GetSphereGeometry (float &radius) const = 0;
    00520
    00524   virtual void SetTransform (const csOrthoTransform &transform) = 0;
    00525
    00529   virtual csOrthoTransform GetTransform () const = 0;
    00530
    00534   virtual void SetFriction (float friction) = 0;
    00535
    00539   virtual float GetFriction () const = 0;
    00540
    00544   virtual void SetSoftness (float softness) = 0;
    00545
    00549   virtual float GetSoftness () const = 0;
    00550
    00554   virtual void SetElasticity (float elasticity) = 0;
    00555
    00559   virtual float GetElasticity () const = 0;
    00560
    00564   virtual void SetDensity (float density) = 0;
    00565
    00569   virtual float GetDensity () const = 0;
    00570 };
    00571
    00572 } // namespace Animation
    00573 } // namespace CS
    00574
    00577 #endif // __CS_IMESH_BODYMESH_H__