imesh/genmesh.h
Go to the documentation of this file.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 00026 #include "csutil/scf.h" 00027 00028 struct iDocumentNode; 00029 struct iGenMeshAnimationControl; 00030 struct iGenMeshAnimationControlFactory; 00031 struct iMaterialWrapper; 00032 struct iRenderBuffer; 00033 struct iMeshObject; 00034 00038 class csBox3; 00039 class csColor; 00040 class csColor4; 00041 struct csTriangle; 00042 class csVector2; 00043 class csVector3; 00044 class csEllipsoid; 00045 00046 SCF_VERSION (iGeneralMeshCommonState, 0, 0, 3); 00047 00053 struct iGeneralMeshCommonState : public iBase 00054 { 00056 virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0; 00058 virtual iMaterialWrapper* GetMaterialWrapper () const = 0; 00060 virtual void SetMixMode (uint mode) = 0; 00062 virtual uint GetMixMode () const = 0; 00063 00065 virtual void SetLighting (bool l) = 0; 00067 virtual bool IsLighting () const = 0; 00069 virtual void SetColor (const csColor& col) = 0; 00071 virtual const csColor& GetColor () const = 0; 00077 virtual void SetManualColors (bool m) = 0; 00079 virtual bool IsManualColors () const = 0; 00084 virtual void SetShadowCasting (bool m) = 0; 00086 virtual bool IsShadowCasting () const = 0; 00095 virtual void SetShadowReceiving (bool m) = 0; 00097 virtual bool IsShadowReceiving () const = 0; 00098 00102 virtual void ClearSubMeshes () = 0; 00103 00116 virtual void AddSubMesh (unsigned int *triangles, 00117 int tricount, 00118 iMaterialWrapper *material) = 0; 00119 00133 virtual void AddSubMesh (unsigned int *triangles, 00134 int tricount, 00135 iMaterialWrapper *material, uint mixmode) = 0; 00136 00140 virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0; 00144 virtual bool RemoveRenderBuffer (const char *name) = 0; 00145 }; 00146 00147 SCF_VERSION (iGeneralMeshState, 0, 1, 0); 00148 00163 struct iGeneralMeshState : public iGeneralMeshCommonState 00164 { 00169 virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0; 00170 00174 virtual iGenMeshAnimationControl* GetAnimationControl () const = 0; 00175 }; 00176 00177 SCF_VERSION (iGeneralFactoryState, 0, 3, 0); 00178 00201 struct iGeneralFactoryState : public iGeneralMeshCommonState 00202 { 00208 virtual void AddVertex (const csVector3& v, 00209 const csVector2& uv, const csVector3& normal, 00210 const csColor4& color) = 0; 00211 00219 virtual void SetVertexCount (int n) = 0; 00221 virtual int GetVertexCount () const = 0; 00227 virtual csVector3* GetVertices () = 0; 00233 virtual csVector2* GetTexels () = 0; 00242 virtual csVector3* GetNormals () = 0; 00250 virtual csColor4* GetColors () = 0; 00251 00257 virtual void AddTriangle (const csTriangle& tri) = 0; 00258 00266 virtual void SetTriangleCount (int n) = 0; 00268 virtual int GetTriangleCount () const = 0; 00274 virtual csTriangle* GetTriangles () = 0; 00275 00282 virtual void Invalidate () = 0; 00283 00289 virtual void CalculateNormals (bool compress = true) = 0; 00290 00295 virtual void Compress () = 0; 00296 00302 virtual void GenerateBox (const csBox3& box) = 0; 00303 00315 virtual void GenerateSphere (const csEllipsoid& ellips, int rim_vertices, 00316 bool cyl_mapping = false, 00317 bool toponly = false, 00318 bool reversed = false) = 0; 00319 00320 //virtual void GeneratePlane (const csPlane3& plane) = 0; 00321 00327 virtual void SetBack2Front (bool b2f) = 0; 00328 00332 virtual bool IsAutoNormals () const = 0; 00333 00337 virtual bool IsBack2Front () const = 0; 00338 00343 virtual void SetAnimationControlFactory ( 00344 iGenMeshAnimationControlFactory* anim_ctrl) = 0; 00345 00349 virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory () 00350 const = 0; 00351 }; 00352 00353 SCF_VERSION (iGenMeshAnimationControl, 0, 0, 1); 00354 00373 struct iGenMeshAnimationControl : public iBase 00374 { 00376 virtual bool AnimatesVertices () const = 0; 00378 virtual bool AnimatesTexels () const = 0; 00380 virtual bool AnimatesNormals () const = 0; 00382 virtual bool AnimatesColors () const = 0; 00383 00393 virtual const csVector3* UpdateVertices (csTicks current, 00394 const csVector3* verts, int num_verts, uint32 version_id) = 0; 00395 00405 virtual const csVector2* UpdateTexels (csTicks current, 00406 const csVector2* texels, int num_texels, uint32 version_id) = 0; 00407 00417 virtual const csVector3* UpdateNormals (csTicks current, 00418 const csVector3* normals, int num_normals, uint32 version_id) = 0; 00419 00429 virtual const csColor4* UpdateColors (csTicks current, 00430 const csColor4* colors, int num_colors, uint32 version_id) = 0; 00431 }; 00432 00433 SCF_VERSION (iGenMeshAnimationControlFactory, 0, 0, 1); 00434 00435 struct iDocumentNode; 00436 00449 struct iGenMeshAnimationControlFactory : public iBase 00450 { 00454 virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl ( 00455 iMeshObject *mesh) = 0; 00456 00461 virtual const char* Load (iDocumentNode* node) = 0; 00462 00467 virtual const char* Save (iDocumentNode* parent) = 0; 00468 }; 00469 00470 SCF_VERSION (iGenMeshAnimationControlType, 0, 0, 1); 00471 00486 struct iGenMeshAnimationControlType : public iBase 00487 { 00491 virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory 00492 () = 0; 00493 00494 }; 00495 00498 #endif // __CS_IMESH_GENMESH_H__ 00499
Generated for Crystal Space by doxygen 1.4.6