CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

genmesh.h

00001 /*
00002     Copyright (C) 2002 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_GENMESH_H__
00020 #define __CS_IMESH_GENMESH_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "ivideo/rndbuf.h"
00024 
00025 class csVector3;
00026 class csVector2;
00027 class csColor;
00028 class csBox3;
00029 struct csTriangle;
00030 
00031 struct iMaterialWrapper;
00032 struct iGenMeshAnimationControl;
00033 struct iGenMeshAnimationControlFactory;
00034 struct iDocumentNode;
00035 
00036 SCF_VERSION (iGeneralMeshCommonState, 0, 0, 3);
00037 
00043 struct iGeneralMeshCommonState : public iBase
00044 {
00046   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00048   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00050   virtual void SetMixMode (uint mode) = 0;
00052   virtual uint GetMixMode () const = 0;
00053 
00055   virtual void SetLighting (bool l) = 0;
00057   virtual bool IsLighting () const = 0;
00059   virtual void SetColor (const csColor& col) = 0;
00061   virtual const csColor& GetColor () const = 0;
00067   virtual void SetManualColors (bool m) = 0;
00069   virtual bool IsManualColors () const = 0;
00074   virtual void SetShadowCasting (bool m) = 0;
00076   virtual bool IsShadowCasting () const = 0;
00085   virtual void SetShadowReceiving (bool m) = 0;
00087   virtual bool IsShadowReceiving () const = 0;
00088 
00092   virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0;
00096   virtual bool RemoveRenderBuffer (const char *name) = 0;
00097 };
00098 
00099 SCF_VERSION (iGeneralMeshState, 0, 1, 0);
00100 
00118 struct iGeneralMeshState : public iGeneralMeshCommonState
00119 {
00124   virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0;
00125 
00129   virtual iGenMeshAnimationControl* GetAnimationControl () const = 0;
00130 
00134   virtual void ClearSubMeshes () = 0;
00135 
00145   virtual void AddSubMesh (unsigned int *triangles,
00146     int tricount,
00147     iMaterialWrapper *material) = 0;
00148 };
00149 
00150 SCF_VERSION (iGeneralFactoryState, 0, 3, 0);
00151 
00177 struct iGeneralFactoryState : public iGeneralMeshCommonState
00178 {
00180   virtual void SetVertexCount (int n) = 0;
00182   virtual int GetVertexCount () const = 0;
00188   virtual csVector3* GetVertices () = 0;
00194   virtual csVector2* GetTexels () = 0;
00202   virtual csVector3* GetNormals () = 0;
00203 
00205   virtual void SetTriangleCount (int n) = 0;
00207   virtual int GetTriangleCount () const = 0;
00213   virtual csTriangle* GetTriangles () = 0;
00220   virtual csColor* GetColors () = 0;
00221 
00228   virtual void Invalidate () = 0;
00229 
00233   virtual void CalculateNormals () = 0;
00234 
00240   virtual void GenerateBox (const csBox3& box) = 0;
00241 
00247   virtual void SetBack2Front (bool b2f) = 0;
00248 
00252   virtual bool IsAutoNormals () const = 0;
00253 
00257   virtual bool IsBack2Front () const = 0;
00258 
00263   virtual void SetAnimationControlFactory (
00264         iGenMeshAnimationControlFactory* anim_ctrl) = 0;
00265 
00269   virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory ()
00270         const = 0;
00271 };
00272 
00273 SCF_VERSION (iGenMeshAnimationControl, 0, 0, 1);
00274 
00296 struct iGenMeshAnimationControl : public iBase
00297 {
00299   virtual bool AnimatesVertices () const = 0;
00301   virtual bool AnimatesTexels () const = 0;
00303   virtual bool AnimatesNormals () const = 0;
00305   virtual bool AnimatesColors () const = 0;
00306 
00316   virtual const csVector3* UpdateVertices (csTicks current,
00317         const csVector3* verts, int num_verts, uint32 version_id) = 0;
00318 
00328   virtual const csVector2* UpdateTexels (csTicks current,
00329         const csVector2* texels, int num_texels, uint32 version_id) = 0;
00330 
00340   virtual const csVector3* UpdateNormals (csTicks current,
00341         const csVector3* normals, int num_normals, uint32 version_id) = 0;
00342 
00352   virtual const csColor* UpdateColors (csTicks current,
00353         const csColor* colors, int num_colors, uint32 version_id) = 0;
00354 };
00355 
00356 SCF_VERSION (iGenMeshAnimationControlFactory, 0, 0, 1);
00357 
00374 struct iGenMeshAnimationControlFactory : public iBase
00375 {
00379   virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl () = 0;
00380 
00385   virtual const char* Load (iDocumentNode* node) = 0;
00386 
00391   virtual const char* Save (iDocumentNode* parent) = 0;
00392 };
00393 
00394 SCF_VERSION (iGenMeshAnimationControlType, 0, 0, 1);
00395 
00413 struct iGenMeshAnimationControlType : public iBase
00414 {
00418   virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory
00419         () = 0;
00420 
00421 };
00422 
00423 #endif // __CS_IMESH_GENMESH_H__
00424 

Generated for Crystal Space by doxygen 1.3.9.1