CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | 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 
00024 struct iDocumentNode;
00025 struct iGenMeshAnimationControl;
00026 struct iGenMeshAnimationControlFactory;
00027 struct iMaterialWrapper;
00028 struct iRenderBuffer;
00029 
00030 class csBox3;
00031 class csColor;
00032 class csColor4;
00033 struct csTriangle;
00034 class csVector2;
00035 class csVector3;
00036 
00037 SCF_VERSION (iGeneralMeshCommonState, 0, 0, 3);
00038 
00044 struct iGeneralMeshCommonState : public iBase
00045 {
00047   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00049   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00051   virtual void SetMixMode (uint mode) = 0;
00053   virtual uint GetMixMode () const = 0;
00054 
00056   virtual void SetLighting (bool l) = 0;
00058   virtual bool IsLighting () const = 0;
00060   virtual void SetColor (const csColor& col) = 0;
00062   virtual const csColor& GetColor () const = 0;
00068   virtual void SetManualColors (bool m) = 0;
00070   virtual bool IsManualColors () const = 0;
00075   virtual void SetShadowCasting (bool m) = 0;
00077   virtual bool IsShadowCasting () const = 0;
00086   virtual void SetShadowReceiving (bool m) = 0;
00088   virtual bool IsShadowReceiving () const = 0;
00089 
00093   virtual void ClearSubMeshes () = 0;
00094 
00107   virtual void AddSubMesh (unsigned int *triangles,
00108     int tricount,
00109     iMaterialWrapper *material) = 0;
00110 
00124   virtual void AddSubMesh (unsigned int *triangles,
00125     int tricount,
00126     iMaterialWrapper *material, uint mixmode) = 0;
00127 
00131   virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0;
00135   virtual bool RemoveRenderBuffer (const char *name) = 0;
00136 };
00137 
00138 SCF_VERSION (iGeneralMeshState, 0, 1, 0);
00139 
00157 struct iGeneralMeshState : public iGeneralMeshCommonState
00158 {
00163   virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0;
00164 
00168   virtual iGenMeshAnimationControl* GetAnimationControl () const = 0;
00169 };
00170 
00171 SCF_VERSION (iGeneralFactoryState, 0, 3, 0);
00172 
00173 struct csSphere;
00199 struct iGeneralFactoryState : public iGeneralMeshCommonState
00200 {
00202   virtual void SetVertexCount (int n) = 0;
00204   virtual int GetVertexCount () const = 0;
00210   virtual csVector3* GetVertices () = 0;
00216   virtual csVector2* GetTexels () = 0;
00224   virtual csVector3* GetNormals () = 0;
00225 
00227   virtual void SetTriangleCount (int n) = 0;
00229   virtual int GetTriangleCount () const = 0;
00235   virtual csTriangle* GetTriangles () = 0;
00242   virtual csColor4* GetColors () = 0;
00243 
00250   virtual void Invalidate () = 0;
00251 
00255   virtual void CalculateNormals () = 0;
00256 
00262   virtual void GenerateBox (const csBox3& box) = 0;
00263 
00269   virtual void GenerateSphere (const csSphere& sphere, int rim_vertices) = 0;
00270 
00271   //virtual void GeneratePlane (const csPlane3& plane) = 0;
00272 
00278   virtual void SetBack2Front (bool b2f) = 0;
00279 
00283   virtual bool IsAutoNormals () const = 0;
00284 
00288   virtual bool IsBack2Front () const = 0;
00289 
00294   virtual void SetAnimationControlFactory (
00295         iGenMeshAnimationControlFactory* anim_ctrl) = 0;
00296 
00300   virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory ()
00301         const = 0;
00302 };
00303 
00304 SCF_VERSION (iGenMeshAnimationControl, 0, 0, 1);
00305 
00327 struct iGenMeshAnimationControl : public iBase
00328 {
00330   virtual bool AnimatesVertices () const = 0;
00332   virtual bool AnimatesTexels () const = 0;
00334   virtual bool AnimatesNormals () const = 0;
00336   virtual bool AnimatesColors () const = 0;
00337 
00347   virtual const csVector3* UpdateVertices (csTicks current,
00348         const csVector3* verts, int num_verts, uint32 version_id) = 0;
00349 
00359   virtual const csVector2* UpdateTexels (csTicks current,
00360         const csVector2* texels, int num_texels, uint32 version_id) = 0;
00361 
00371   virtual const csVector3* UpdateNormals (csTicks current,
00372         const csVector3* normals, int num_normals, uint32 version_id) = 0;
00373 
00383   virtual const csColor4* UpdateColors (csTicks current,
00384         const csColor4* colors, int num_colors, uint32 version_id) = 0;
00385 };
00386 
00387 SCF_VERSION (iGenMeshAnimationControlFactory, 0, 0, 1);
00388 
00389 struct iDocumentNode;
00406 struct iGenMeshAnimationControlFactory : public iBase
00407 {
00411   virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl () = 0;
00412 
00417   virtual const char* Load (iDocumentNode* node) = 0;
00418 
00423   virtual const char* Save (iDocumentNode* parent) = 0;
00424 };
00425 
00426 SCF_VERSION (iGenMeshAnimationControlType, 0, 0, 1);
00427 
00445 struct iGenMeshAnimationControlType : public iBase
00446 {
00450   virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory
00451         () = 0;
00452 
00453 };
00454 
00455 #endif // __CS_IMESH_GENMESH_H__
00456 

Generated for Crystal Space by doxygen 1.4.4