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 
00361 struct iSpriteCal3DState : public virtual iBase
00362 {
00363   SCF_INTERFACE (iSpriteCal3DState, 2, 0, 0);
00364 
00368 
00369   enum
00370   {
00371     C3D_ANIM_TYPE_NONE,
00372     C3D_ANIM_TYPE_IDLE,
00373     C3D_ANIM_TYPE_TRAVEL,
00374     C3D_ANIM_TYPE_CYCLE,
00375     C3D_ANIM_TYPE_STYLE_CYCLE,
00376     C3D_ANIM_TYPE_ACTION
00377   };
00378 
00380   virtual int GetAnimCount() = 0;
00381 
00386   virtual const char *GetAnimName(int idx) = 0;
00387 
00389   virtual int  GetAnimType(int idx) = 0;
00390 
00392   virtual int FindAnim(const char* name) = 0;
00393 
00395   virtual void ClearAllAnims() = 0;
00396 
00401   virtual bool SetAnimCycle(const char *name, float weight) = 0;
00402 
00407   virtual bool SetAnimCycle(int idx, float weight) = 0;
00408 
00417   virtual bool AddAnimCycle(const char *name, float weight, float delay) = 0;
00418 
00422   virtual bool AddAnimCycle(int idx, float weight, float delay) = 0;
00423 
00428   virtual bool ClearAnimCycle (int idx, float delay) = 0;
00429 
00435   virtual bool ClearAnimCycle (const char *name, float delay) = 0;
00436 
00441   virtual size_t GetActiveAnimCount() = 0;
00442 
00452   virtual bool GetActiveAnims(csSpriteCal3DActiveAnim* buffer, 
00453     size_t max_length) = 0;
00454 
00459   virtual void SetActiveAnims(const csSpriteCal3DActiveAnim* buffer,
00460         size_t anim_count) = 0;
00461 
00468   virtual bool SetAnimAction(const char *name, float delayIn,
00469                              float delayOut) = 0;
00470 
00477   virtual bool SetAnimAction(int idx, float delayIn,
00478                              float delayOut) = 0;
00479 
00488   virtual bool SetVelocity(float vel,csRandomGen *rng=0) = 0;
00489 
00493   virtual void SetDefaultIdleAnim(const char *name) = 0;
00502   virtual void SetLOD(float lod) = 0;
00511   virtual bool AttachCoreMesh(const char *meshname) = 0;
00512 
00519   virtual bool DetachCoreMesh(const char *meshname) = 0;
00520 
00529   virtual bool AttachCoreMesh(int mesh_id, iMaterialWrapper* iMatWrap = 0) = 0;
00536   virtual bool DetachCoreMesh(int mesh_id) = 0;
00550   virtual bool BlendMorphTarget(int morph_animation_id, float weight,
00551         float delay) = 0;
00552 
00561   virtual bool ClearMorphTarget(int morph_animation_id, float delay) = 0;
00566 
00567   virtual iSpriteCal3DSocket* FindSocket (iMeshWrapper *mesh) const = 0;
00568 
00570   virtual iSpriteCal3DSocket* FindSocket (const char* name) const = 0;
00573 
00574   virtual bool SetMaterial(const char *mesh_name,iMaterialWrapper *mat) = 0;
00575 
00578 
00579   virtual void SetTimeFactor(float timeFactor) = 0;
00580 
00582   virtual float GetTimeFactor() = 0;
00583 
00585   virtual float GetAnimationTime() = 0;
00586 
00588   virtual float GetAnimationDuration() = 0;
00589 
00591   virtual void SetAnimationTime(float animationTime) = 0;
00592 
00600   virtual void SetAnimTimeUpdateHandler(iAnimTimeUpdateHandler*) = 0;
00603 
00604   virtual void SetUserData(void *data) = 0;
00605   
00612   virtual iShaderVariableContext* GetCoreMeshShaderVarContext (
00613     const char* meshName) = 0;
00614 
00622 
00623   virtual CalModel *GetCal3DModel() = 0;
00625 };
00626 
00629 #endif// __CS_IMESH_SPRITECAL3D_H__

Generated for Crystal Space by doxygen 1.4.7