CrystalSpace

Public API Reference

imesh/spritecal3d.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 by Keith Fulton
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_SPRITECAL3D_H__
00020 #define __CS_IMESH_SPRITECAL3D_H__
00021 
00026 #include "csutil/scf.h"
00027 #include "imesh/sprite3d.h"
00028 
00032 struct iMaterialWrapper;
00033 struct iMeshObject;
00034 struct iMeshWrapper;
00035 struct iMeshObjectFactory;
00036 struct iRenderView;
00037 struct iShaderVariableContext;
00038 struct iVFS;
00039 
00040 class csColor;
00041 class csRandomGen;
00042 class csReversibleTransform;
00043 class csString;
00044 
00045 class CalModel;
00046 class CalCoreModel;
00047 
00051 struct iSpriteCal3DSocket : public virtual iSpriteSocket
00052 {
00053   SCF_INTERFACE (iSpriteCal3DSocket, 1, 0, 0);
00054 
00056   virtual void SetSubmeshIndex (int subm_index) = 0;
00058   virtual int GetSubmeshIndex () const = 0;
00059 
00061   virtual void SetMeshIndex (int m_index) = 0;
00063   virtual int GetMeshIndex () const = 0;
00064 
00066   virtual void SetTransform (const csReversibleTransform & trans) = 0;
00068   virtual csReversibleTransform GetTransform () const = 0;
00069 
00074   virtual size_t GetSecondaryCount () const = 0;
00076   virtual iMeshWrapper * GetSecondaryMesh (size_t index) = 0;
00078   virtual csReversibleTransform GetSecondaryTransform (size_t index) = 0;
00080   virtual void SetSecondaryTransform (size_t index, csReversibleTransform) = 0;
00082   virtual size_t AttachSecondary (iMeshWrapper*, csReversibleTransform) = 0;
00084   virtual void DetachSecondary (const char* mesh_name) = 0;
00086   virtual void DetachSecondary (size_t index) = 0;
00088   virtual size_t FindSecondary (const char* mesh_name) = 0;
00089 };
00090 
00091 
00092 struct CalAnimationCallback;
00093 
00097 struct iSpriteCal3DFactoryState : public virtual iBase
00098 {
00099   SCF_INTERFACE (iSpriteCal3DFactoryState, 1, 0, 0);
00100 
00102   virtual bool Create(const char *name) = 0;
00103 
00109   virtual void ReportLastError () = 0;
00110 
00115   virtual void SetLoadFlags(int flags) = 0;
00116 
00121   virtual void SetBasePath(const char *path) = 0;
00122 
00126   virtual bool LoadCoreSkeleton(iVFS *vfs,const char *filename) = 0;
00127 
00132   virtual void RescaleFactory(float factor) = 0;
00133 
00165   virtual int LoadCoreAnimation(
00166         iVFS *vfs,
00167         const char *filename,
00168         const char *name,
00169         int type,
00170         float base_velocity,
00171         float min_velocity,
00172         float max_velocity,
00173         int min_interval,
00174         int max_interval,
00175         int idle_pct,
00176         bool lock) = 0;
00177 
00189   virtual int LoadCoreMesh(iVFS *vfs,const char *filename,
00190         const char *name,bool attach,iMaterialWrapper *defmat) = 0;
00191 
00203   virtual int LoadCoreMorphTarget(iVFS *vfs, int mesh_index,
00204         const char *filename, const char *name) = 0;
00205 
00212   virtual int AddMorphAnimation(const char *name) = 0;
00213   
00223   virtual bool AddMorphTarget(int morphanimation_index,
00224                               const char *mesh_name,
00225                               const char *morphtarget_name) = 0;
00226   
00231   virtual bool AddCoreMaterial(iMaterialWrapper *mat) = 0;
00232 
00234   virtual void CalculateAllBoneBoundingBoxes() = 0;
00235 
00240   virtual void BindMaterials() = 0;
00241 
00246   virtual int  GetMeshCount() = 0;
00247 
00251   virtual int GetMorphAnimationCount() = 0;
00252   
00261   virtual int GetMorphTargetCount(int mesh_id) = 0;
00262 
00266   virtual const char *GetMeshName(int idx) = 0;
00267 
00271   virtual int  FindMeshName(const char *meshName) = 0;
00272 
00276   virtual const char* GetDefaultMaterial( const char* meshName ) = 0;
00277   
00278   
00283   virtual const char *GetMorphAnimationName(int idx) = 0;
00284 
00289   virtual int  FindMorphAnimationName(const char *meshName) = 0;
00290 
00294   virtual bool IsMeshDefault(int idx) = 0;
00295 
00297   virtual iSpriteCal3DSocket* AddSocket () = 0;
00299   virtual iSpriteCal3DSocket* FindSocket (const char * name) const = 0;
00301   virtual iSpriteCal3DSocket* FindSocket (iMeshWrapper *mesh) const = 0;
00303   virtual int GetSocketCount () const = 0;
00305   virtual iSpriteCal3DSocket* GetSocket (int f) const = 0;
00306 
00312   virtual CalCoreModel *GetCal3DCoreModel() = 0;
00313 
00318   virtual bool RegisterAnimCallback(const char *anim,
00319         CalAnimationCallback *callback, float min_interval) = 0;
00320 
00325   virtual bool RemoveAnimCallback(const char *anim,
00326         CalAnimationCallback *callback) = 0;
00327 
00328 };
00329 
00338 struct iAnimTimeUpdateHandler : public virtual iBase
00339 {
00340   SCF_INTERFACE (iAnimTimeUpdateHandler, 1, 0, 0); 
00341 
00348   virtual void UpdatePosition (float delta, CalModel*) = 0;
00349 };
00350 
00351 struct csSpriteCal3DActiveAnim
00352 {
00353   int index;
00354   float weight;
00355 };
00356 
00357 struct iSkeleton;
00358 
00363 struct iSpriteCal3DState : public virtual iBase
00364 {
00365   SCF_INTERFACE (iSpriteCal3DState, 2, 0, 0);
00366 
00370 
00371   enum
00372   {
00373     C3D_ANIM_TYPE_NONE,
00374     C3D_ANIM_TYPE_IDLE,
00375     C3D_ANIM_TYPE_TRAVEL,
00376     C3D_ANIM_TYPE_CYCLE,
00377     C3D_ANIM_TYPE_STYLE_CYCLE,
00378     C3D_ANIM_TYPE_ACTION
00379   };
00380 
00382   virtual int GetAnimCount() = 0;
00383 
00388   virtual const char *GetAnimName(int idx) = 0;
00389 
00391   virtual int  GetAnimType(int idx) = 0;
00392 
00394   virtual int FindAnim(const char* name) = 0;
00395 
00397   virtual void ClearAllAnims() = 0;
00398 
00403   virtual bool SetAnimCycle(const char *name, float weight) = 0;
00404 
00409   virtual bool SetAnimCycle(int idx, float weight) = 0;
00410 
00419   virtual bool AddAnimCycle(const char *name, float weight, float delay) = 0;
00420 
00424   virtual bool AddAnimCycle(int idx, float weight, float delay) = 0;
00425 
00430   virtual bool ClearAnimCycle (int idx, float delay) = 0;
00431 
00437   virtual bool ClearAnimCycle (const char *name, float delay) = 0;
00438 
00443   virtual size_t GetActiveAnimCount() = 0;
00444 
00454   virtual bool GetActiveAnims(csSpriteCal3DActiveAnim* buffer, 
00455     size_t max_length) = 0;
00456 
00461   virtual void SetActiveAnims(const csSpriteCal3DActiveAnim* buffer,
00462         size_t anim_count) = 0;
00463 
00470   virtual bool SetAnimAction(const char *name, float delayIn,
00471                              float delayOut) = 0;
00472 
00479   virtual bool SetAnimAction(int idx, float delayIn,
00480                              float delayOut) = 0;
00481 
00490   virtual bool SetVelocity(float vel,csRandomGen *rng=0) = 0;
00491 
00495   virtual void SetDefaultIdleAnim(const char *name) = 0;
00504   virtual void SetLOD(float lod) = 0;
00513   virtual bool AttachCoreMesh(const char *meshname) = 0;
00514 
00521   virtual bool DetachCoreMesh(const char *meshname) = 0;
00522 
00531   virtual bool AttachCoreMesh(int mesh_id, iMaterialWrapper* iMatWrap = 0) = 0;
00538   virtual bool DetachCoreMesh(int mesh_id) = 0;
00552   virtual bool BlendMorphTarget(int morph_animation_id, float weight,
00553         float delay) = 0;
00554 
00563   virtual bool ClearMorphTarget(int morph_animation_id, float delay) = 0;
00568 
00569   virtual iSpriteCal3DSocket* FindSocket (iMeshWrapper *mesh) const = 0;
00570 
00572   virtual iSpriteCal3DSocket* FindSocket (const char* name) const = 0;
00575 
00576   virtual bool SetMaterial(const char *mesh_name,iMaterialWrapper *mat) = 0;
00577 
00580 
00581   virtual void SetTimeFactor(float timeFactor) = 0;
00582 
00584   virtual float GetTimeFactor() = 0;
00585 
00587   virtual float GetAnimationTime() = 0;
00588 
00590   virtual float GetAnimationDuration() = 0;
00591 
00593   virtual void SetAnimationTime(float animationTime) = 0;
00594 
00602   virtual void SetAnimTimeUpdateHandler(iAnimTimeUpdateHandler*) = 0;
00605 
00606   virtual void SetUserData(void *data) = 0;
00607   
00614   virtual iShaderVariableContext* GetCoreMeshShaderVarContext (
00615     const char* meshName) = 0;
00616 
00618   virtual csPtr<iSkeleton> GetSkeleton () = 0;
00619 
00627 
00628   virtual CalModel *GetCal3DModel() = 0;
00630 };
00631 
00634 #endif// __CS_IMESH_SPRITECAL3D_H__

Generated for Crystal Space 1.2.1 by doxygen 1.5.3