imesh/spritecal3d.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/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, 2, 0, 0);
    00100
    00102   virtual bool Create(const char *name) = 0;
    00103
    00109   virtual void ReportLastError () = 0;
    00110
    00114   CS_DEPRECATED_METHOD_MSG("Pass load flags to Load*() functions instead")
    00115   virtual void SetLoadFlags(int flags) = 0;
    00116
    00121   virtual void SetBasePath(const char *path) = 0;
    00122
    00127   virtual bool LoadCoreSkeleton (iVFS *vfs,const char *filename,
    00128                                  int loadFlags = 0) = 0;
    00129
    00134   virtual void RescaleFactory(float factor) = 0;
    00135
    00168   virtual int LoadCoreAnimation(
    00169         iVFS *vfs,
    00170         const char *filename,
    00171         const char *name,
    00172         int type,
    00173         float base_velocity,
    00174         float min_velocity,
    00175         float max_velocity,
    00176         int min_interval,
    00177         int max_interval,
    00178         int idle_pct,
    00179         bool lock,
    00180         int loadFlags = 0) = 0;
    00181
    00194   virtual int LoadCoreMesh(iVFS *vfs,const char *filename,
    00195         const char *name,bool attach,iMaterialWrapper *defmat,
    00196         int loadFlags = 0) = 0;
    00197
    00210   virtual int LoadCoreMorphTarget(iVFS *vfs, int mesh_index,
    00211         const char *filename, const char *name,
    00212         int loadFlags = 0) = 0;
    00213
    00220   virtual int AddMorphAnimation(const char *name) = 0;
    00221
    00231   virtual bool AddMorphTarget(int morphanimation_index,
    00232                               const char *mesh_name,
    00233                               const char *morphtarget_name) = 0;
    00234
    00239   virtual bool AddCoreMaterial(iMaterialWrapper *mat) = 0;
    00240
    00242   virtual void CalculateAllBoneBoundingBoxes() = 0;
    00243
    00248   virtual void BindMaterials() = 0;
    00249
    00254   virtual int  GetMeshCount() = 0;
    00255
    00259   virtual int GetMorphAnimationCount() = 0;
    00260
    00269   virtual int GetMorphTargetCount(int mesh_id) = 0;
    00270
    00274   virtual const char *GetMeshName(int idx) = 0;
    00275
    00279   virtual int  FindMeshName(const char *meshName) = 0;
    00280
    00284   virtual const char* GetDefaultMaterial( const char* meshName ) = 0;
    00285
    00286
    00291   virtual const char *GetMorphAnimationName(int idx) = 0;
    00292
    00297   virtual int  FindMorphAnimationName(const char *meshName) = 0;
    00298
    00302   virtual bool IsMeshDefault(int idx) = 0;
    00303
    00305   virtual iSpriteCal3DSocket* AddSocket () = 0;
    00307   virtual iSpriteCal3DSocket* FindSocket (const char * name) const = 0;
    00309   virtual iSpriteCal3DSocket* FindSocket (iMeshWrapper *mesh) const = 0;
    00311   virtual int GetSocketCount () const = 0;
    00313   virtual iSpriteCal3DSocket* GetSocket (int f) const = 0;
    00314
    00320   virtual CalCoreModel *GetCal3DCoreModel() = 0;
    00321
    00326   virtual bool RegisterAnimCallback(const char *anim,
    00327         CalAnimationCallback *callback, float min_interval) = 0;
    00328
    00333   virtual bool RemoveAnimCallback(const char *anim,
    00334         CalAnimationCallback *callback) = 0;
    00335
    00341   virtual void AbsoluteRescaleFactory(float factor) = 0;
    00342
    00343 };
    00344
    00353 struct iAnimTimeUpdateHandler : public virtual iBase
    00354 {
    00355   SCF_INTERFACE (iAnimTimeUpdateHandler, 1, 0, 0);
    00356
    00363   virtual void UpdatePosition (float delta, CalModel*) = 0;
    00364 };
    00365
    00366 struct csSpriteCal3DActiveAnim
    00367 {
    00368   int index;
    00369   float weight;
    00370 };
    00371
    00372 struct iSkeleton;
    00373
    00378 struct iSpriteCal3DState : public virtual iBase
    00379 {
    00380   SCF_INTERFACE (iSpriteCal3DState, 2, 1, 1);
    00381
    00385
    00386   enum
    00387   {
    00388     C3D_ANIM_TYPE_NONE,
    00389     C3D_ANIM_TYPE_IDLE,
    00390     C3D_ANIM_TYPE_TRAVEL,
    00391     C3D_ANIM_TYPE_CYCLE,
    00392     C3D_ANIM_TYPE_STYLE_CYCLE,
    00393     C3D_ANIM_TYPE_ACTION
    00394   };
    00395
    00397   virtual int GetAnimCount() = 0;
    00398
    00403   virtual const char *GetAnimName(int idx) = 0;
    00404
    00406   virtual int  GetAnimType(int idx) = 0;
    00407
    00409   virtual int FindAnim(const char* name) = 0;
    00410
    00412   virtual void ClearAllAnims() = 0;
    00413
    00418   virtual bool SetAnimCycle(const char *name, float weight) = 0;
    00419
    00424   virtual bool SetAnimCycle(int idx, float weight) = 0;
    00425
    00434   virtual bool AddAnimCycle(const char *name, float weight, float delay) = 0;
    00435
    00439   virtual bool AddAnimCycle(int idx, float weight, float delay) = 0;
    00440
    00445   virtual bool ClearAnimCycle (int idx, float delay) = 0;
    00446
    00452   virtual bool ClearAnimCycle (const char *name, float delay) = 0;
    00453
    00458   virtual size_t GetActiveAnimCount() = 0;
    00459
    00469   virtual bool GetActiveAnims(csSpriteCal3DActiveAnim* buffer,
    00470     size_t max_length) = 0;
    00471
    00476   virtual void SetActiveAnims(const csSpriteCal3DActiveAnim* buffer,
    00477         size_t anim_count) = 0;
    00478
    00485   virtual bool SetAnimAction(const char *name, float delayIn,
    00486                              float delayOut) = 0;
    00487
    00494   virtual bool SetAnimAction(int idx, float delayIn,
    00495                              float delayOut) = 0;
    00496
    00505   virtual bool SetVelocity(float vel,csRandomGen *rng=0) = 0;
    00506
    00510   virtual void SetDefaultIdleAnim(const char *name) = 0;
    00511
    00516   virtual void SetCyclicBlendFactor(float factor) = 0;
    00517
    00526   virtual void SetLOD(float lod) = 0;
    00535   virtual bool AttachCoreMesh(const char *meshname) = 0;
    00536
    00543   virtual bool DetachCoreMesh(const char *meshname) = 0;
    00544
    00553   virtual bool AttachCoreMesh(int mesh_id, iMaterialWrapper* iMatWrap = 0) = 0;
    00560   virtual bool DetachCoreMesh(int mesh_id) = 0;
    00574   virtual bool BlendMorphTarget(int morph_animation_id, float weight,
    00575         float delay) = 0;
    00576
    00585   virtual bool ClearMorphTarget(int morph_animation_id, float delay) = 0;
    00590
    00591   virtual iSpriteCal3DSocket* FindSocket (iMeshWrapper *mesh) const = 0;
    00592
    00594   virtual iSpriteCal3DSocket* FindSocket (const char* name) const = 0;
    00597
    00598   virtual bool SetMaterial(const char *mesh_name,iMaterialWrapper *mat) = 0;
    00599
    00601   virtual iMaterialWrapper* GetMaterial(const char *mesh_name) = 0;
    00602
    00605
    00606   virtual void SetTimeFactor(float timeFactor) = 0;
    00607
    00609   virtual float GetTimeFactor() = 0;
    00610
    00612   virtual float GetAnimationTime() = 0;
    00613
    00615   virtual float GetAnimationDuration() = 0;
    00616
    00618   virtual void SetAnimationTime(float animationTime) = 0;
    00619
    00627   virtual void SetAnimTimeUpdateHandler(iAnimTimeUpdateHandler*) = 0;
    00630
    00631   virtual void SetUserData(void *data) = 0;
    00632
    00639   virtual iShaderVariableContext* GetCoreMeshShaderVarContext (
    00640     const char* meshName) = 0;
    00641
    00643   virtual csPtr<iSkeleton> GetSkeleton () = 0;
    00644
    00652
    00653   virtual CalModel *GetCal3DModel() = 0;
    00655 };
    00656
    00659 #endif// __CS_IMESH_SPRITECAL3D_H__