## Public API Reference

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

- File List
- File Members

# imesh/sprite3d.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2000-2001 by Jorrit Tyberghein
    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_SPRITE3D_H__
    00020 #define __CS_IMESH_SPRITE3D_H__
    00021
    00026 #include "csutil/scf.h"
    00027
    00031 struct iMaterialWrapper;
    00032 struct iMeshObject;
    00033 struct iMeshObjectFactory;
    00034 struct iMeshWrapper;
    00035 struct iRenderView;
    00036
    00037 class csColor;
    00038 class csVector2;
    00039 class csVector3;
    00040 struct csTriangle;
    00041
    00045 enum
    00046 {
    00047   CS_SPR_LIGHTING_HQ = 0,
    00048   CS_SPR_LIGHTING_LQ = 1,
    00049   CS_SPR_LIGHTING_FAST = 2,
    00050   CS_SPR_LIGHTING_RANDOM = 3
    00051 };
    00052
    00057 #define CS_SPR_LIGHT_GLOBAL 0
    00058
    00063 #define CS_SPR_LIGHT_TEMPLATE 1
    00064
    00069 #define CS_SPR_LIGHT_LOCAL 2
    00070
    00075 #define CS_SPR_LOD_GLOBAL 0
    00076
    00080 #define CS_SPR_LOD_TEMPLATE 1
    00081
    00085 #define CS_SPR_LOD_LOCAL 2
    00086
    00087 // @@@ CONFIG TODO: global_lighting_quality
    00088 // @@@ CONFIG TODO: global_lod_level
    00089
    00093 struct iSpriteFrame : public virtual iBase
    00094 {
    00095   SCF_INTERFACE (iSpriteFrame, 1, 0, 0);
    00096
    00098   virtual void SetName (char const*) = 0;
    00100   virtual char const* GetName () const = 0;
    00102   virtual int GetAnmIndex () const = 0;
    00104   virtual int GetTexIndex () const = 0;
    00105 };
    00106
    00110 struct iSpriteAction : public virtual iBase
    00111 {
    00112   SCF_INTERFACE (iSpriteAction, 1, 0, 0);
    00113
    00115   virtual void SetName (char const*) = 0;
    00117   virtual char const* GetName () const = 0;
    00119   virtual int GetFrameCount () = 0;
    00121   virtual iSpriteFrame* GetFrame (int f) = 0;
    00123   virtual iSpriteFrame* GetNextFrame (int f) = 0;
    00125   virtual int GetFrameDelay (int f) = 0;
    00127   virtual float GetFrameDisplacement (int f) = 0;
    00129   virtual void AddFrame (iSpriteFrame* frame, int delay,
    00130         float displacement) = 0;
    00131 };
    00132
    00137 struct iSpriteSocket : public virtual iBase
    00138 {
    00139   SCF_INTERFACE (iSpriteSocket, 1, 0, 0);
    00140
    00142   virtual void SetName (char const*) = 0;
    00144   virtual char const* GetName () const = 0;
    00145
    00147   virtual void SetMeshWrapper (iMeshWrapper* mesh) = 0;
    00149   virtual iMeshWrapper* GetMeshWrapper () const = 0;
    00150
    00152   virtual void SetTriangleIndex (int tri_index) = 0;
    00154   virtual int GetTriangleIndex () const = 0;
    00155 };
    00156
    00160 struct iSprite3DFactoryState : public virtual iBase
    00161 {
    00162   SCF_INTERFACE (iSprite3DFactoryState, 1, 0, 0);
    00163
    00165   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
    00167   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
    00168
    00177   virtual void AddVertices (int num) = 0;
    00179   virtual int GetVertexCount () const = 0;
    00180
    00182   virtual const csVector3& GetVertex (int frame, int vertex) const = 0;
    00184   virtual void SetVertex (int frame, int vertex, const csVector3 &Value) = 0;
    00186   virtual csVector3* GetVertices (int frame) const = 0;
    00191   virtual void SetVertices (csVector3 const* vert, int frame) = 0;
    00192
    00194   virtual const csVector2& GetTexel (int frame, int vertex) const = 0;
    00196   virtual void SetTexel (int frame, int vertex, const csVector2 &Value) = 0;
    00198   virtual csVector2* GetTexels (int frame) const = 0;
    00203   virtual void SetTexels (csVector2 const* tex, int frame) = 0;
    00204
    00206   virtual const csVector3& GetNormal (int frame, int vertex) const = 0;
    00208   virtual void SetNormal (int frame, int vertex, const csVector3 &Value) = 0;
    00210   virtual csVector3* GetNormals (int frame) const = 0;
    00215   virtual void SetNormals (csVector3 const* norms, int frame) = 0;
    00216
    00221   virtual void AddTriangle (int a, int b, int c) = 0;
    00223   virtual csTriangle GetTriangle (int x) const = 0;
    00225   virtual csTriangle* GetTriangles () const = 0;
    00227   virtual int GetTriangleCount () const = 0;
    00229   virtual void SetTriangleCount (int count) = 0;
    00231   virtual void SetTriangles( csTriangle const* trigs, int count) = 0;
    00232
    00234   virtual iSpriteFrame* AddFrame () = 0;
    00236   virtual iSpriteFrame* FindFrame (const char* name) const = 0;
    00238   virtual int GetFrameCount () const = 0;
    00240   virtual iSpriteFrame* GetFrame (int f) const = 0;
    00241
    00243   virtual iSpriteAction* AddAction () = 0;
    00245   virtual iSpriteAction* FindAction (const char* name) const = 0;
    00247   virtual iSpriteAction* GetFirstAction () const = 0;
    00249   virtual int GetActionCount () const = 0;
    00251   virtual iSpriteAction* GetAction (int No) const = 0;
    00252
    00254   virtual iSpriteSocket* AddSocket () = 0;
    00256   virtual iSpriteSocket* FindSocket (const char * name) const = 0;
    00258   virtual iSpriteSocket* FindSocket (iMeshWrapper *mesh) const = 0;
    00260   virtual int GetSocketCount () const = 0;
    00262   virtual iSpriteSocket* GetSocket (int f) const = 0;
    00263
    00265   virtual void EnableTweening (bool en) = 0;
    00267   virtual bool IsTweeningEnabled () const = 0;
    00269   virtual void SetLightingQuality (int qual) = 0;
    00271   virtual int GetLightingQuality () const = 0;
    00280   virtual void SetLightingQualityConfig (int qual) = 0;
    00282   virtual int GetLightingQualityConfig () const = 0;
    00283
    00292   virtual void SetLodLevelConfig (int config_flag) = 0;
    00293
    00295   virtual int GetLodLevelConfig () const = 0;
    00296
    00302   virtual void MergeNormals (int base, int frame) = 0;
    00303
    00309   virtual void MergeNormals (int base) = 0;
    00310
    00316   virtual void MergeNormals () = 0;
    00317
    00319   virtual void SetMixMode (uint mode) = 0;
    00321   virtual uint GetMixMode () const = 0;
    00322 };
    00323
    00327 struct iSprite3DState : public virtual iBase
    00328 {
    00329   SCF_INTERFACE (iSprite3DState, 1, 0, 0);
    00330
    00332   virtual void SetMixMode (uint mode) = 0;
    00334   virtual uint GetMixMode () const = 0;
    00336   virtual void SetLighting (bool l) = 0;
    00338   virtual bool IsLighting () const = 0;
    00339
    00340   // @@@ TODO: what about convenience functions to set colors for verts?
    00341
    00343   virtual void SetFrame (int f) = 0;
    00344
    00346   virtual int GetCurFrame () const = 0;
    00347
    00349   virtual int GetFrameCount () const = 0;
    00350
    00355   virtual bool SetAction (const char * name,
    00356         bool loop = true, float speed = 1) = 0;
    00357
    00362   virtual bool SetAction (int index,
    00363         bool loop = true, float speed = 1) = 0;
    00364
    00366   virtual void SetReverseAction(bool reverse) = 0;
    00367
    00369   virtual void SetSingleStepAction(bool singlestep) = 0;
    00370
    00375   virtual bool SetOverrideAction(const char *name,
    00376         float speed = 1) = 0;
    00377
    00382   virtual bool SetOverrideAction(int index,
    00383         float speed = 1) = 0;
    00384
    00386   virtual bool PropagateAction (const char *name) = 0;
    00387
    00389   virtual iSpriteAction* GetCurAction () const = 0;
    00390
    00392   virtual bool GetReverseAction () const = 0;
    00393
    00395   virtual void EnableTweening (bool en) = 0;
    00397   virtual bool IsTweeningEnabled () const = 0;
    00398
    00400   virtual void UnsetTexture () = 0;
    00401
    00407   virtual int GetLightingQuality () = 0;
    00408
    00413   virtual void SetLocalLightingQuality (int lighting_quality) = 0;
    00414
    00422   virtual void SetLightingQualityConfig (int config_flag) = 0;
    00423
    00427   virtual int GetLightingQualityConfig () const = 0;
    00428
    00436   virtual void SetLodLevelConfig (int config_flag) = 0;
    00437
    00441   virtual int GetLodLevelConfig () const = 0;
    00442
    00446   virtual bool IsLodEnabled () const = 0;
    00447
    00449   virtual iSpriteSocket* FindSocket (iMeshWrapper *mesh) const = 0;
    00450
    00452   virtual iSpriteSocket* FindSocket (const char * name) const = 0;
    00453 };
    00454
    00457 #endif // __CS_IMESH_SPRITE3D_H__
    00458