imesh/thing.h
00001 /* 00002 Copyright (C) 1998-2003 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_THING_H__ 00020 #define __CS_IMESH_THING_H__ 00021 00022 #include "csutil/scf.h" 00023 #include "csutil/flags.h" 00024 00025 class csVector2; 00026 class csVector3; 00027 class csMatrix3; 00028 class csPlane3; 00029 struct iSector; 00030 struct iGraphics3D; 00031 struct iFrustumView; 00032 struct iMaterialWrapper; 00033 struct iMaterialList; 00034 struct iMovable; 00035 struct iMeshObject; 00036 struct iMeshObjectFactory; 00037 struct iThingState; 00038 struct iThingFactoryState; 00039 00043 struct csPolygonRange 00044 { 00045 int start, end; 00046 csPolygonRange (int start, int end) 00047 { 00048 csPolygonRange::start = start; 00049 csPolygonRange::end = end; 00050 } 00051 void Set (int start, int end) 00052 { 00053 csPolygonRange::start = start; 00054 csPolygonRange::end = end; 00055 } 00056 void Set (int idx) 00057 { 00058 csPolygonRange::start = idx; 00059 csPolygonRange::end = idx; 00060 } 00061 }; 00062 00069 #define CS_POLY_LIGHTING 0x00000001 00070 00074 #define CS_POLY_COLLDET 0x00000002 00075 00079 #define CS_POLY_VISCULL 0x00000004 00080 00088 #define CS_POLYRANGE(s1,s2) csPolygonRange (s1, s2) 00089 00092 #define CS_POLYRANGE_SINGLE(idx) csPolygonRange (idx, idx) 00093 00096 #define CS_POLYRANGE_LAST csPolygonRange (-1, -1) 00097 00100 #define CS_POLYRANGE_ALL csPolygonRange (0, 2000000000) 00101 00106 #define CS_POLYINDEX_LAST -1 00107 00116 #define CS_THING_NOCOMPRESS 0x00010000 00117 00125 #define CS_THING_MOVE_NEVER 0 00126 #define CS_THING_MOVE_OCCASIONAL 2 00127 00129 SCF_VERSION (iPolygonHandle, 0, 0, 1); 00130 00150 struct iPolygonHandle : public iBase 00151 { 00156 virtual iThingFactoryState* GetThingFactoryState () const = 0; 00157 00162 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0; 00163 00168 virtual iThingState* GetThingState () const = 0; 00169 00174 virtual iMeshObject* GetMeshObject () const = 0; 00175 00179 virtual int GetIndex () const = 0; 00180 }; 00181 00182 00183 SCF_VERSION (iThingFactoryState, 0, 2, 0); 00184 00204 struct iThingFactoryState : public iBase 00205 { 00207 virtual void* GetPrivateObject () = 0; 00208 00217 virtual void CompressVertices () = 0; 00218 00220 virtual int GetPolygonCount () = 0; 00222 virtual void RemovePolygon (int idx) = 0; 00224 virtual void RemovePolygons () = 0; 00225 00227 virtual int FindPolygonByName (const char* name) = 0; 00228 00233 virtual int AddEmptyPolygon () = 0; 00234 00245 virtual int AddTriangle (const csVector3& v1, const csVector3& v2, 00246 const csVector3& v3) = 0; 00258 virtual int AddQuad (const csVector3& v1, const csVector3& v2, 00259 const csVector3& v3, const csVector3& v4) = 0; 00260 00271 virtual int AddPolygon (csVector3* vertices, int num) = 0; 00272 00283 virtual int AddPolygon (int num, ...) = 0; 00284 00295 virtual int AddOutsideBox (const csVector3& bmin, const csVector3& bmax) = 0; 00296 00307 virtual int AddInsideBox (const csVector3& bmin, const csVector3& bmax) = 0; 00308 00314 virtual void SetPolygonName (const csPolygonRange& range, 00315 const char* name) = 0; 00316 00322 virtual const char* GetPolygonName (int polygon_idx) = 0; 00323 00334 virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0; 00335 00341 virtual void SetPolygonMaterial (const csPolygonRange& range, 00342 iMaterialWrapper* material) = 0; 00343 00349 virtual iMaterialWrapper* GetPolygonMaterial (int polygon_idx) = 0; 00350 00356 virtual void AddPolygonVertex (const csPolygonRange& range, 00357 const csVector3& vt) = 0; 00358 00364 virtual void AddPolygonVertex (const csPolygonRange& range, int vt) = 0; 00365 00373 virtual void SetPolygonVertexIndices (const csPolygonRange& range, 00374 int num, int* indices) = 0; 00375 00381 virtual int GetPolygonVertexCount (int polygon_idx) = 0; 00382 00388 virtual const csVector3& GetPolygonVertex (int polygon_idx, 00389 int vertex_idx) = 0; 00390 00396 virtual int* GetPolygonVertexIndices (int polygon_idx) = 0; 00397 00407 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00408 const csMatrix3& m, const csVector3& v) = 0; 00409 00416 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00417 const csVector2& uv1, const csVector2& uv2, const csVector2& uv3) = 0; 00418 00427 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00428 const csVector3& p1, const csVector2& uv1, 00429 const csVector3& p2, const csVector2& uv2, 00430 const csVector3& p3, const csVector2& uv3) = 0; 00431 00445 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00446 const csVector3& v_orig, const csVector3& v1, float len1) = 0; 00447 00461 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00462 const csVector3& v_orig, 00463 const csVector3& v1, float len1, 00464 const csVector3& v2, float len2) = 0; 00465 00479 virtual void SetPolygonTextureMapping (const csPolygonRange& range, 00480 float len1) = 0; 00481 00487 virtual void GetPolygonTextureMapping (int polygon_idx, 00488 csMatrix3& m, csVector3& v) = 0; 00489 00495 virtual void SetPolygonTextureMappingEnabled (const csPolygonRange& range, 00496 bool enabled) = 0; 00497 00503 virtual bool IsPolygonTextureMappingEnabled (int polygon_idx) const = 0; 00504 00510 virtual void SetPolygonFlags (const csPolygonRange& range, uint32 flags) = 0; 00511 00517 virtual void SetPolygonFlags (const csPolygonRange& range, uint32 mask, 00518 uint32 flags) = 0; 00519 00525 virtual void ResetPolygonFlags (const csPolygonRange& range, 00526 uint32 flags) = 0; 00527 00533 virtual csFlags& GetPolygonFlags (int polygon_idx) = 0; 00534 00540 virtual const csPlane3& GetPolygonObjectPlane (int polygon_idx) = 0; 00541 00547 virtual bool IsPolygonTransparent (int polygon_idx) = 0; 00548 00555 virtual bool PointOnPolygon (int polygon_idx, const csVector3& v) = 0; 00556 00558 virtual int GetVertexCount () const = 0; 00560 virtual const csVector3 &GetVertex (int idx) const = 0; 00562 virtual const csVector3* GetVertices () const = 0; 00564 virtual int CreateVertex (const csVector3& vt) = 0; 00566 virtual void SetVertex (int idx, const csVector3& vt) = 0; 00572 virtual void DeleteVertex (int idx) = 0; 00580 virtual void DeleteVertices (int from, int to) = 0; 00581 00585 virtual void SetSmoothingFlag (bool smoothing) = 0; 00586 00590 virtual bool GetSmoothingFlag () = 0; 00591 00595 virtual csVector3* GetNormals () = 0; 00596 00600 virtual float GetCosinusFactor () const = 0; 00606 virtual void SetCosinusFactor (float cosfact) = 0; 00607 }; 00608 00609 SCF_VERSION (iThingState, 0, 7, 0); 00610 00629 struct iThingState : public iBase 00630 { 00632 virtual void* GetPrivateObject () = 0; 00633 00635 virtual iThingFactoryState* GetFactory () = 0; 00636 00638 virtual const csVector3 &GetVertexW (int idx) const = 0; 00640 virtual const csVector3* GetVerticesW () const = 0; 00641 00645 virtual int GetMovingOption () const = 0; 00646 00674 virtual void SetMovingOption (int opt) = 0; 00675 00684 virtual void Prepare () = 0; 00685 00690 virtual void Unprepare () = 0; 00691 00699 virtual void ReplaceMaterial (iMaterialWrapper* oldmat, 00700 iMaterialWrapper* newmat) = 0; 00701 00706 virtual void ClearReplacedMaterials () = 0; 00707 00709 virtual void SetMixMode (uint mode) = 0; 00711 virtual uint GetMixMode () const = 0; 00712 00722 virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0; 00723 00729 virtual const csPlane3& GetPolygonWorldPlane (int polygon_idx) = 0; 00730 }; 00731 00732 SCF_VERSION (iThingEnvironment, 0, 3, 0); 00733 00747 struct iThingEnvironment : public iBase 00748 { 00752 virtual void Clear () = 0; 00753 00755 virtual int GetLightmapCellSize () const = 0; 00757 virtual void SetLightmapCellSize (int Size) = 0; 00759 virtual int GetDefaultLightmapCellSize () const = 0; 00760 }; 00761 00762 #endif // __CS_IMESH_THING_H__
Generated for Crystal Space by doxygen 1.2.18