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 00051 struct iGeneralFactorySubMesh : public virtual iBase 00052 { 00053 SCF_INTERFACE (iGeneralFactorySubMesh, 1, 0, 3); 00054 00056 virtual void ClearSlidingWindows() = 0; 00057 00059 virtual int GetSlidingWindowSize() const = 0; 00060 00062 virtual void AddSlidingWindow(int start_index, int end_index) = 0; 00063 00065 virtual void GetSlidingWindow(unsigned int index, int& out_start_index, int& out_end_index) const = 0; 00066 }; 00067 00071 struct iGeneralFactorySubMeshObject : public virtual iBase 00072 { 00073 SCF_INTERFACE (iGeneralFactorySubMeshObject, 1, 0, 3); 00074 00076 virtual void ForceProgLODLevel(int level) = 0; 00077 00079 virtual int GetForcedProgLODLevel() = 0; 00080 }; 00081 00085 struct iGeneralMeshSubMesh : public virtual iBase 00086 { 00087 SCF_INTERFACE (iGeneralMeshSubMesh, 1, 0, 3); 00088 00090 virtual iRenderBuffer* GetIndices () = 0; 00091 00093 virtual void SetIndices(iRenderBuffer* newIndices) = 0; 00094 00096 virtual iMaterialWrapper* GetMaterial () const = 0; 00097 00099 virtual const char* GetName () const = 0; 00100 00102 virtual uint GetMixmode () const = 0; 00103 00105 virtual void SetMaterial (iMaterialWrapper* material) = 0; 00106 00108 virtual csZBufMode GetZMode () const = 0; 00109 00111 virtual void SetZMode (csZBufMode mode) = 0; 00112 00114 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00115 00117 virtual void SetRenderPriority (CS::Graphics::RenderPriority prio) = 0; 00118 00120 virtual void SetMixmode (uint mode) = 0; 00121 00126 virtual void SetBack2Front (bool enable) = 0; 00127 00129 virtual bool GetBack2Front () const = 0; 00130 }; 00131 00137 struct iGeneralMeshCommonState : public virtual iBase 00138 { 00139 SCF_INTERFACE (iGeneralMeshCommonState, 1, 2, 2); 00140 00145 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00146 virtual void SetLighting (bool l) = 0; 00151 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00152 virtual bool IsLighting () const = 0; 00158 virtual void SetManualColors (bool m) = 0; 00160 virtual bool IsManualColors () const = 0; 00166 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00167 virtual void SetShadowCasting (bool m) = 0; 00172 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00173 virtual bool IsShadowCasting () const = 0; 00183 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00184 virtual void SetShadowReceiving (bool m) = 0; 00189 CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.") 00190 virtual bool IsShadowReceiving () const = 0; 00191 00197 virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0; 00198 00202 virtual bool RemoveRenderBuffer (const char *name) = 0; 00203 00207 virtual int GetRenderBufferCount () const = 0; 00208 00212 virtual iRenderBuffer* GetRenderBuffer (int index) = 0; 00213 00217 virtual csRef<iString> GetRenderBufferName (int index) const = 0; 00218 00222 virtual iRenderBuffer* GetRenderBuffer (const char* name) = 0; 00223 00227 virtual bool AddRenderBuffer (csRenderBufferName name, iRenderBuffer* buffer) = 0; 00228 00232 virtual bool RemoveRenderBuffer (csRenderBufferName name) = 0; 00233 00237 virtual iRenderBuffer* GetRenderBuffer (csRenderBufferName name) = 0; 00239 }; 00240 00255 struct iGeneralMeshState : public virtual iGeneralMeshCommonState 00256 { 00257 SCF_INTERFACE (iGeneralMeshState, 2, 0, 1); 00258 00263 virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0; 00264 00268 virtual iGenMeshAnimationControl* GetAnimationControl () const = 0; 00269 00281 virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0; 00288 virtual void ForceProgLODLevel(int level) = 0; 00289 }; 00290 00313 struct iGeneralFactoryState : public virtual iGeneralMeshCommonState 00314 { 00315 SCF_INTERFACE (iGeneralFactoryState, 2, 0, 2); 00316 00318 virtual void SetColor (const csColor& col) = 0; 00320 virtual const csColor& GetColor () const = 0; 00321 00327 virtual void AddVertex (const csVector3& v, 00328 const csVector2& uv, const csVector3& normal, 00329 const csColor4& color) = 0; 00330 00338 virtual void SetVertexCount (int n) = 0; 00340 virtual int GetVertexCount () const = 0; 00346 virtual csVector3* GetVertices () = 0; 00352 virtual csVector2* GetTexels () = 0; 00361 virtual csVector3* GetNormals () = 0; 00369 virtual csColor4* GetColors () = 0; 00370 00376 virtual void AddTriangle (const csTriangle& tri) = 0; 00377 00385 virtual void SetTriangleCount (int n) = 0; 00387 virtual int GetTriangleCount () const = 0; 00393 virtual csTriangle* GetTriangles () = 0; 00394 00401 virtual void Invalidate () = 0; 00402 00408 virtual void CalculateNormals (bool compress = true) = 0; 00409 00414 virtual void Compress () = 0; 00415 00421 virtual void GenerateBox (const csBox3& box) = 0; 00422 00429 virtual void GenerateCapsule (float l, float r, uint sides) = 0; 00430 00442 virtual void GenerateSphere (const csEllipsoid& ellips, int rim_vertices, 00443 bool cyl_mapping = false, 00444 bool toponly = false, 00445 bool reversed = false) = 0; 00446 00447 //virtual void GeneratePlane (const csPlane3& plane) = 0; 00448 00454 virtual void SetBack2Front (bool b2f) = 0; 00455 00459 virtual bool IsAutoNormals () const = 0; 00460 00464 virtual bool IsBack2Front () const = 0; 00465 00470 virtual void SetAnimationControlFactory ( 00471 iGenMeshAnimationControlFactory* anim_ctrl) = 0; 00472 00476 virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory () 00477 const = 0; 00478 00484 virtual void ClearSubMeshes () = 0; 00502 virtual iGeneralMeshSubMesh* AddSubMesh (iRenderBuffer* indices, 00503 iMaterialWrapper *material, const char* name, uint mixmode = (uint)~0) = 0; 00504 00509 virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0; 00510 00514 virtual void DeleteSubMesh (iGeneralMeshSubMesh* mesh) = 0; 00515 00517 virtual size_t GetSubMeshCount () const = 0; 00518 00520 virtual iGeneralMeshSubMesh* GetSubMesh (size_t index) const = 0; 00529 virtual void DisableAutoNormals () = 0; 00530 00537 virtual void GenerateCylinder (float l, float r, uint sides) = 0; 00538 00545 virtual int GetNumProgLODLevels() const = 0; 00546 00551 virtual void GetProgLODDistances(float& out_min, float& out_max) const = 0; 00552 00558 virtual void SetProgLODDistances(float min, float max) = 0; 00560 }; 00561 00579 struct iGenMeshAnimationControl : public virtual iBase 00580 { 00581 SCF_INTERFACE(iGenMeshAnimationControl, 2, 0, 1); 00582 00584 virtual bool AnimatesVertices () const = 0; 00586 virtual bool AnimatesTexels () const = 0; 00588 virtual bool AnimatesNormals () const = 0; 00590 virtual bool AnimatesColors () const = 0; 00591 00601 virtual void Update (csTicks current, int num_verts, 00602 uint32 version_id) = 0; 00603 00616 virtual const csVector3* UpdateVertices (csTicks current, 00617 const csVector3* verts, int num_verts, uint32 version_id) = 0; 00618 00631 virtual const csVector2* UpdateTexels (csTicks current, 00632 const csVector2* texels, int num_texels, uint32 version_id) = 0; 00633 00646 virtual const csVector3* UpdateNormals (csTicks current, 00647 const csVector3* normals, int num_normals, uint32 version_id) = 0; 00648 00663 virtual const csColor4* UpdateColors (csTicks current, 00664 const csColor4* colors, int num_colors, uint32 version_id) = 0; 00665 00667 virtual bool AnimatesBBoxRadius () const = 0; 00668 00678 virtual const csBox3& UpdateBoundingBox (csTicks current, uint32 version_id, const csBox3& bbox) = 0; 00679 00689 virtual const float UpdateRadius (csTicks current, uint32 version_id, const float radius) = 0; 00690 00700 virtual const csBox3* UpdateBoundingBoxes (csTicks current, uint32 version_id) = 0; 00701 }; 00702 00715 struct iGenMeshAnimationControlFactory : public virtual iBase 00716 { 00717 SCF_INTERFACE(iGenMeshAnimationControlFactory, 2, 0, 0); 00718 00722 virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl ( 00723 iMeshObject *mesh) = 0; 00724 00729 virtual const char* Load (iDocumentNode* node) = 0; 00730 00735 virtual const char* Save (iDocumentNode* parent) = 0; 00736 }; 00737 00752 struct iGenMeshAnimationControlType : public virtual iBase 00753 { 00754 SCF_INTERFACE(iGenMeshAnimationControlType, 2, 0, 0); 00755 00759 virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory 00760 () = 0; 00761 }; 00762 00765 #endif // __CS_IMESH_GENMESH_H__
Generated for Crystal Space 2.0 by doxygen 1.6.1