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_interface.h" 00027 #include "ivideo/rendermesh.h" 00028 00029 struct iDocumentNode; 00030 struct iGenMeshAnimationControl; 00031 struct iGenMeshAnimationControlFactory; 00032 struct iMaterialWrapper; 00033 struct iRenderBuffer; 00034 struct iMeshObject; 00035 struct iString; 00036 00040 class csBox3; 00041 class csColor; 00042 class csColor4; 00043 struct csTriangle; 00044 class csVector2; 00045 class csVector3; 00046 class csEllipsoid; 00047 00048 struct iGeneralMeshSubMesh : public virtual iBase 00049 { 00050 SCF_INTERFACE (iGeneralMeshSubMesh, 1, 0, 3); 00051 00053 virtual iRenderBuffer* GetIndices () = 0; 00054 00056 virtual iMaterialWrapper* GetMaterial () const = 0; 00057 00059 virtual const char* GetName () const = 0; 00060 00062 virtual uint GetMixmode () const = 0; 00063 00065 virtual void SetMaterial (iMaterialWrapper* material) = 0; 00066 00068 virtual csZBufMode GetZMode () const = 0; 00069 00071 virtual void SetZMode (csZBufMode mode) = 0; 00072 00074 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00075 00077 virtual void SetRenderPriority (CS::Graphics::RenderPriority prio) = 0; 00078 00080 virtual void SetMixmode (uint mode) = 0; 00081 00086 virtual void SetBack2Front (bool enable) = 0; 00087 00089 virtual bool GetBack2Front () const = 0; 00090 }; 00091 00097 struct iGeneralMeshCommonState : public virtual iBase 00098 { 00099 SCF_INTERFACE (iGeneralMeshCommonState, 1, 2, 2); 00100 00102 virtual void SetLighting (bool l) = 0; 00104 virtual bool IsLighting () const = 0; 00110 virtual void SetManualColors (bool m) = 0; 00112 virtual bool IsManualColors () const = 0; 00117 virtual void SetShadowCasting (bool m) = 0; 00119 virtual bool IsShadowCasting () const = 0; 00128 virtual void SetShadowReceiving (bool m) = 0; 00130 virtual bool IsShadowReceiving () const = 0; 00131 00137 virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0; 00138 00142 virtual bool RemoveRenderBuffer (const char *name) = 0; 00143 00147 virtual int GetRenderBufferCount () const = 0; 00148 00152 virtual iRenderBuffer* GetRenderBuffer (int index) = 0; 00153 00157 virtual csRef<iString> GetRenderBufferName (int index) const = 0; 00158 00162 virtual iRenderBuffer* GetRenderBuffer (const char* name) = 0; 00163 00167 virtual bool AddRenderBuffer (csRenderBufferName name, iRenderBuffer* buffer) = 0; 00168 00172 virtual bool RemoveRenderBuffer (csRenderBufferName name) = 0; 00173 00177 virtual iRenderBuffer* GetRenderBuffer (csRenderBufferName name) = 0; 00179 }; 00180 00195 struct iGeneralMeshState : public virtual iGeneralMeshCommonState 00196 { 00197 SCF_INTERFACE (iGeneralMeshState, 2, 0, 0); 00198 00203 virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0; 00204 00208 virtual iGenMeshAnimationControl* GetAnimationControl () const = 0; 00209 00221 virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0; 00223 }; 00224 00247 struct iGeneralFactoryState : public virtual iGeneralMeshCommonState 00248 { 00249 SCF_INTERFACE (iGeneralFactoryState, 2, 0, 0); 00250 00252 virtual void SetColor (const csColor& col) = 0; 00254 virtual const csColor& GetColor () const = 0; 00255 00261 virtual void AddVertex (const csVector3& v, 00262 const csVector2& uv, const csVector3& normal, 00263 const csColor4& color) = 0; 00264 00272 virtual void SetVertexCount (int n) = 0; 00274 virtual int GetVertexCount () const = 0; 00280 virtual csVector3* GetVertices () = 0; 00286 virtual csVector2* GetTexels () = 0; 00295 virtual csVector3* GetNormals () = 0; 00303 virtual csColor4* GetColors () = 0; 00304 00310 virtual void AddTriangle (const csTriangle& tri) = 0; 00311 00319 virtual void SetTriangleCount (int n) = 0; 00321 virtual int GetTriangleCount () const = 0; 00327 virtual csTriangle* GetTriangles () = 0; 00328 00335 virtual void Invalidate () = 0; 00336 00342 virtual void CalculateNormals (bool compress = true) = 0; 00343 00348 virtual void Compress () = 0; 00349 00355 virtual void GenerateBox (const csBox3& box) = 0; 00356 00363 virtual void GenerateCapsule (float l, float r, uint sides) = 0; 00364 00376 virtual void GenerateSphere (const csEllipsoid& ellips, int rim_vertices, 00377 bool cyl_mapping = false, 00378 bool toponly = false, 00379 bool reversed = false) = 0; 00380 00381 //virtual void GeneratePlane (const csPlane3& plane) = 0; 00382 00388 virtual void SetBack2Front (bool b2f) = 0; 00389 00393 virtual bool IsAutoNormals () const = 0; 00394 00398 virtual bool IsBack2Front () const = 0; 00399 00404 virtual void SetAnimationControlFactory ( 00405 iGenMeshAnimationControlFactory* anim_ctrl) = 0; 00406 00410 virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory () 00411 const = 0; 00412 00418 virtual void ClearSubMeshes () = 0; 00436 virtual iGeneralMeshSubMesh* AddSubMesh (iRenderBuffer* indices, 00437 iMaterialWrapper *material, const char* name, uint mixmode = (uint)~0) = 0; 00438 00443 virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0; 00444 00448 virtual void DeleteSubMesh (iGeneralMeshSubMesh* mesh) = 0; 00449 00451 virtual size_t GetSubMeshCount () const = 0; 00452 00454 virtual iGeneralMeshSubMesh* GetSubMesh (size_t index) const = 0; 00463 virtual void DisableAutoNormals () = 0; 00464 }; 00465 00485 struct iGenMeshAnimationControl : public virtual iBase 00486 { 00487 SCF_INTERFACE(iGenMeshAnimationControl, 2, 0, 0); 00488 00490 virtual bool AnimatesVertices () const = 0; 00492 virtual bool AnimatesTexels () const = 0; 00494 virtual bool AnimatesNormals () const = 0; 00496 virtual bool AnimatesColors () const = 0; 00497 00504 virtual void Update (csTicks current) = 0; 00505 00515 virtual const csVector3* UpdateVertices (csTicks current, 00516 const csVector3* verts, int num_verts, uint32 version_id) = 0; 00517 00527 virtual const csVector2* UpdateTexels (csTicks current, 00528 const csVector2* texels, int num_texels, uint32 version_id) = 0; 00529 00539 virtual const csVector3* UpdateNormals (csTicks current, 00540 const csVector3* normals, int num_normals, uint32 version_id) = 0; 00541 00553 virtual const csColor4* UpdateColors (csTicks current, 00554 const csColor4* colors, int num_colors, uint32 version_id) = 0; 00555 }; 00556 00561 struct iGenMeshAnimationControl1_4 : public virtual iBase 00562 { 00563 SCF_INTERFACE(iGenMeshAnimationControl1_4, 0, 1, 0); 00564 00569 virtual void Update (csTicks current, int num_verts, 00570 uint32 version_id) = 0; 00571 }; 00572 00585 struct iGenMeshAnimationControlFactory : public virtual iBase 00586 { 00587 SCF_INTERFACE(iGenMeshAnimationControlFactory, 2, 0, 0); 00588 00592 virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl ( 00593 iMeshObject *mesh) = 0; 00594 00599 virtual const char* Load (iDocumentNode* node) = 0; 00600 00605 virtual const char* Save (iDocumentNode* parent) = 0; 00606 }; 00607 00622 struct iGenMeshAnimationControlType : public virtual iBase 00623 { 00624 SCF_INTERFACE(iGenMeshAnimationControlType, 2, 0, 0); 00625 00629 virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory 00630 () = 0; 00631 }; 00632 00635 #endif // __CS_IMESH_GENMESH_H__
Generated for Crystal Space 1.4.1 by doxygen 1.7.1