imesh/animesh.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2008 by Marten Svanfeldt 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IMESH_ANIMESH_H__ 00020 #define __CS_IMESH_ANIMESH_H__ 00021 00022 #include "csutil/scf_interface.h" 00023 00024 #include "imesh/skeleton2.h" 00025 00026 #include "ivideo/graph3d.h" 00027 #include "ivideo/rendermesh.h" 00028 00029 struct iRenderBuffer; 00030 struct iMaterialWrapper; 00031 struct iShaderVariableContext; 00032 00033 class csReversibleTransform; 00034 00039 namespace CS 00040 { 00041 namespace Mesh 00042 { 00043 00044 struct iAnimatedMeshFactory; 00045 struct iAnimatedMeshSubMeshFactory; 00046 struct iAnimatedMesh; 00047 struct iAnimatedMeshSubMesh; 00048 struct iAnimatedMeshMorphTarget; 00049 00050 00054 struct AnimatedMeshBoneInfluence 00055 { 00057 CS::Animation::BoneID bone; 00058 00063 float influenceWeight; 00064 }; 00065 00069 struct iAnimatedMeshSocketFactory : public virtual iBase 00070 { 00071 public: 00072 SCF_INTERFACE(CS::Mesh::iAnimatedMeshSocketFactory, 2, 0, 0); 00073 00077 virtual const char* GetName () const = 0; 00078 00082 virtual void SetName (const char* name) = 0; 00083 00087 virtual const csReversibleTransform& GetTransform () const = 0; 00088 00092 virtual void SetTransform (csReversibleTransform& transform) = 0; 00093 00097 virtual CS::Animation::BoneID GetBone () const = 0; 00098 00102 virtual void SetBone (CS::Animation::BoneID boneID) = 0; 00103 00107 virtual iAnimatedMeshFactory* GetFactory () = 0; 00108 }; 00109 00114 struct iAnimatedMeshSocket : public virtual iBase 00115 { 00116 public: 00117 SCF_INTERFACE(CS::Mesh::iAnimatedMeshSocket, 1, 0, 0); 00118 00122 virtual const char* GetName () const = 0; 00123 00127 virtual iAnimatedMeshSocketFactory* GetFactory () = 0; 00128 00132 virtual const csReversibleTransform& GetTransform () const = 0; 00133 00137 virtual void SetTransform (csReversibleTransform& tf) = 0; 00138 00142 virtual const csReversibleTransform GetFullTransform () const = 0; 00143 00147 virtual CS::Animation::BoneID GetBone () const = 0; 00148 00152 virtual iAnimatedMesh* GetMesh () const = 0; 00153 00157 virtual iSceneNode* GetSceneNode () const = 0; 00158 00162 virtual void SetSceneNode (iSceneNode* sn) = 0; 00163 }; 00164 00165 00178 struct iAnimatedMeshFactory : public virtual iBase 00179 { 00180 SCF_INTERFACE(CS::Mesh::iAnimatedMeshFactory, 2, 2, 3); 00181 00191 virtual iAnimatedMeshSubMeshFactory* CreateSubMesh (iRenderBuffer* indices, 00192 const char* name, bool visible) = 0; 00193 00202 virtual iAnimatedMeshSubMeshFactory* CreateSubMesh ( 00203 const csArray<iRenderBuffer*>& indices, 00204 const csArray<csArray<unsigned int> >& boneIndices, 00205 const char* name, bool visible) = 0; 00206 00210 virtual iAnimatedMeshSubMeshFactory* GetSubMesh (size_t index) const = 0; 00211 00215 virtual size_t FindSubMesh (const char* name) const = 0; 00216 00220 virtual size_t GetSubMeshCount () const = 0; 00221 00225 virtual void DeleteSubMesh (iAnimatedMeshSubMeshFactory* mesh) = 0; 00226 00235 virtual uint GetVertexCount () const = 0; 00236 00242 virtual iRenderBuffer* GetVertices () = 0; 00243 00250 virtual bool SetVertices (iRenderBuffer* renderBuffer) = 0; 00251 00257 virtual iRenderBuffer* GetTexCoords () = 0; 00258 00264 virtual bool SetTexCoords (iRenderBuffer* renderBuffer) = 0; 00265 00271 virtual iRenderBuffer* GetNormals () = 0; 00272 00278 virtual bool SetNormals (iRenderBuffer* renderBuffer) = 0; 00279 00285 virtual iRenderBuffer* GetTangents () = 0; 00286 00292 virtual bool SetTangents (iRenderBuffer* renderBuffer) = 0; 00293 00299 virtual iRenderBuffer* GetBinormals () = 0; 00300 00306 virtual bool SetBinormals (iRenderBuffer* renderBuffer) = 0; 00307 00313 virtual iRenderBuffer* GetColors () = 0; 00314 00320 virtual bool SetColors (iRenderBuffer* renderBuffer) = 0; 00321 00334 virtual void Invalidate () = 0; 00335 00344 virtual void SetSkeletonFactory (CS::Animation::iSkeletonFactory* skeletonFactory) = 0; 00345 00349 virtual CS::Animation::iSkeletonFactory* GetSkeletonFactory () const = 0; 00350 00361 virtual void SetBoneInfluencesPerVertex (uint num) = 0; 00362 00366 virtual uint GetBoneInfluencesPerVertex () const = 0; 00367 00372 virtual AnimatedMeshBoneInfluence* GetBoneInfluences () = 0; 00373 00388 virtual iAnimatedMeshMorphTarget* CreateMorphTarget (const char* name) = 0; 00389 00393 virtual iAnimatedMeshMorphTarget* GetMorphTarget (uint target) = 0; 00394 00398 virtual uint GetMorphTargetCount () const = 0; 00399 00404 virtual void ClearMorphTargets () = 0; 00405 00410 virtual uint FindMorphTarget (const char* name) const = 0; 00411 00423 virtual void CreateSocket (CS::Animation::BoneID bone, 00424 const csReversibleTransform& transform, const char* name) = 0; 00425 00429 virtual size_t GetSocketCount () const = 0; 00430 00434 virtual iAnimatedMeshSocketFactory* GetSocket (size_t index) const = 0; 00435 00440 virtual uint FindSocket (const char* name) const = 0; 00441 00450 virtual void ComputeTangents () = 0; 00451 00479 virtual void SetBoneBoundingBox (CS::Animation::BoneID bone, const csBox3& box) = 0; 00480 00489 virtual const csBox3& GetBoneBoundingBox (CS::Animation::BoneID bone) const = 0; 00490 00510 virtual size_t AddSubset () = 0; 00511 00519 virtual void AddSubsetVertex (const size_t subset, const size_t vertexIndex) = 0; 00520 00527 virtual size_t GetSubsetVertex (const size_t subset, const size_t vertexIndex) const = 0; 00528 00532 virtual size_t GetSubsetVertexCount (const size_t subset) const = 0; 00533 00537 virtual size_t GetSubsetCount () const = 0; 00538 00544 virtual void ClearSubsets () = 0; 00545 00547 }; 00548 00553 struct iAnimatedMeshSubMeshFactory : public virtual iBase 00554 { 00555 SCF_INTERFACE(CS::Mesh::iAnimatedMeshSubMeshFactory, 1, 2, 1); 00556 00560 virtual iRenderBuffer* GetIndices (size_t set) = 0; 00561 00565 virtual uint GetIndexSetCount () const = 0; 00566 00570 virtual const csArray<unsigned int>& GetBoneIndices (size_t set) = 0; 00571 00575 virtual iMaterialWrapper* GetMaterial () const = 0; 00576 00580 virtual void SetMaterial (iMaterialWrapper* material) = 0; 00581 00585 virtual const char* GetName () const = 0; 00586 00590 virtual void SetRendering (bool doRender) = 0; 00591 00595 virtual bool IsRendering () const = 0; 00596 00600 virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0; 00601 00605 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00606 00610 virtual void SetZBufMode (csZBufMode mode) = 0; 00611 00615 virtual csZBufMode GetZBufMode () const = 0; 00616 }; 00617 00624 struct iAnimatedMesh : public virtual iBase 00625 { 00626 SCF_INTERFACE(CS::Mesh::iAnimatedMesh, 1, 0, 3); 00627 00634 virtual void SetSkeleton (CS::Animation::iSkeleton* skeleton) = 0; 00635 00639 virtual CS::Animation::iSkeleton* GetSkeleton () const = 0; 00640 00644 virtual iAnimatedMeshSubMesh* GetSubMesh (size_t index) const = 0; 00645 00649 virtual size_t GetSubMeshCount () const = 0; 00650 00654 virtual void SetMorphTargetWeight (uint target, float weight) = 0; 00655 00659 virtual float GetMorphTargetWeight (uint target) const = 0; 00660 00667 virtual size_t GetSocketCount () const = 0; 00668 00672 virtual iAnimatedMeshSocket* GetSocket (size_t index) const = 0; 00678 virtual iAnimatedMeshFactory* GetAnimatedMeshFactory () const = 0; 00679 00683 virtual iRenderBufferAccessor* GetRenderBufferAccessor () const = 0; 00684 00700 virtual void SetBoneBoundingBox (CS::Animation::BoneID bone, const csBox3& box) = 0; 00701 00714 virtual const csBox3& GetBoneBoundingBox (CS::Animation::BoneID bone) const = 0; 00715 00722 virtual void UnsetObjectBoundingBox () = 0; 00723 00727 virtual void ClearMorphTargetWeights () = 0; 00728 }; 00729 00734 struct iAnimatedMeshSubMesh : public virtual iBase 00735 { 00736 SCF_INTERFACE(CS::Mesh::iAnimatedMeshSubMesh, 1, 2, 0); 00737 00741 virtual iAnimatedMeshSubMeshFactory* GetFactorySubMesh () = 0; 00742 00746 virtual void SetRendering (bool doRender) = 0; 00747 00751 virtual bool IsRendering () const = 0; 00752 00756 virtual iShaderVariableContext* GetShaderVariableContext (size_t buffer) const = 0; 00757 00761 virtual iMaterialWrapper* GetMaterial () const = 0; 00762 00766 virtual void SetMaterial (iMaterialWrapper* material) = 0; 00767 }; 00768 00773 struct iAnimatedMeshMorphTarget : public virtual iBase 00774 { 00775 SCF_INTERFACE(CS::Mesh::iAnimatedMeshMorphTarget, 2, 0, 1); 00776 00784 virtual bool SetVertexOffsets (iRenderBuffer* renderBuffer) = 0; 00785 00790 virtual iRenderBuffer* GetVertexOffsets () = 0; 00791 00795 virtual void Invalidate () = 0; 00796 00800 virtual const char* GetName () const = 0; 00801 00807 virtual void AddSubset (const size_t subset) = 0; 00808 00812 virtual size_t GetSubset (const size_t index) const = 0; 00813 00817 virtual size_t GetSubsetCount () const = 0; 00818 }; 00819 00820 00825 } // namespace Mesh 00826 } // namespace CS 00827 00828 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::AnimatedMeshBoneInfluence instead") 00829 typedef CS::Mesh::AnimatedMeshBoneInfluence csAnimatedMeshBoneInfluence; 00830 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMesh instead") 00831 typedef CS::Mesh::iAnimatedMesh iAnimatedMesh; 00832 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMeshFactory instead") 00833 typedef CS::Mesh::iAnimatedMeshFactory iAnimatedMeshFactory; 00834 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMeshSocketFactory instead") 00835 typedef CS::Mesh::iAnimatedMeshSocketFactory iAnimatedMeshSocketFactory; 00836 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMeshSubMesh instead") 00837 typedef CS::Mesh::iAnimatedMeshSubMesh iAnimatedMeshSubMesh; 00838 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMeshSubMeshFactory instead") 00839 typedef CS::Mesh::iAnimatedMeshSubMeshFactory iAnimatedMeshFactorySubMesh; 00840 CS_DEPRECATED_METHOD_MSG("Use CS::Mesh::iAnimatedMeshMorphTarget instead") 00841 typedef CS::Mesh::iAnimatedMeshMorphTarget iAnimatedMeshMorphTarget; 00842 00843 #endif // __CS_IMESH_ANIMESH_H__
Generated for Crystal Space 2.0 by doxygen 1.6.1