CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

imesh/thing/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 4
00117 
00122 #define CS_THING_MOVE_NEVER 0
00123 #define CS_THING_MOVE_OCCASIONAL 2
00124 
00126 SCF_VERSION (iPolygonHandle, 0, 0, 1);
00127 
00136 struct iPolygonHandle : public iBase
00137 {
00142   virtual iThingFactoryState* GetThingFactoryState () const = 0;
00143 
00148   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00149 
00154   virtual iThingState* GetThingState () const = 0;
00155 
00160   virtual iMeshObject* GetMeshObject () const = 0;
00161 
00165   virtual int GetIndex () const = 0;
00166 };
00167 
00168 
00169 SCF_VERSION (iThingFactoryState, 0, 2, 0);
00170 
00175 struct iThingFactoryState : public iBase
00176 {
00178   virtual void* GetPrivateObject () = 0;
00179 
00188   virtual void CompressVertices () = 0;
00189 
00191   virtual int GetPolygonCount () = 0;
00193   virtual void RemovePolygon (int idx) = 0;
00195   virtual void RemovePolygons () = 0;
00196 
00198   virtual int FindPolygonByName (const char* name) = 0;
00199 
00204   virtual int AddEmptyPolygon () = 0;
00205 
00216   virtual int AddTriangle (const csVector3& v1, const csVector3& v2,
00217         const csVector3& v3) = 0;
00229   virtual int AddQuad (const csVector3& v1, const csVector3& v2,
00230         const csVector3& v3, const csVector3& v4) = 0;
00231 
00242   virtual int AddPolygon (csVector3* vertices, int num) = 0;
00243 
00254   virtual int AddPolygon (int num, ...) = 0;
00255 
00266   virtual int AddOutsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00267 
00278   virtual int AddInsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00279 
00285   virtual void SetPolygonName (const csPolygonRange& range,
00286         const char* name) = 0;
00287 
00293   virtual const char* GetPolygonName (int polygon_idx) = 0;
00294 
00305   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00306 
00312   virtual void SetPolygonMaterial (const csPolygonRange& range,
00313         iMaterialWrapper* material) = 0;
00314 
00320   virtual iMaterialWrapper* GetPolygonMaterial (int polygon_idx) = 0;
00321 
00327   virtual void AddPolygonVertex (const csPolygonRange& range,
00328         const csVector3& vt) = 0;
00329 
00335   virtual void AddPolygonVertex (const csPolygonRange& range, int vt) = 0;
00336 
00344   virtual void SetPolygonVertexIndices (const csPolygonRange& range,
00345         int num, int* indices) = 0;
00346 
00352   virtual int GetPolygonVertexCount (int polygon_idx) = 0;
00353 
00359   virtual const csVector3& GetPolygonVertex (int polygon_idx,
00360         int vertex_idx) = 0;
00361 
00367   virtual int* GetPolygonVertexIndices (int polygon_idx) = 0;
00368 
00378   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00379         const csMatrix3& m, const csVector3& v) = 0;
00380 
00387   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00388         const csVector2& uv1, const csVector2& uv2, const csVector2& uv3) = 0;
00389 
00398   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00399         const csVector3& p1, const csVector2& uv1,
00400         const csVector3& p2, const csVector2& uv2,
00401         const csVector3& p3, const csVector2& uv3) = 0;
00402 
00416   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00417         const csVector3& v_orig, const csVector3& v1, float len1) = 0;
00418 
00432   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00433         const csVector3& v_orig,
00434         const csVector3& v1, float len1,
00435         const csVector3& v2, float len2) = 0;
00436 
00450   virtual void SetPolygonTextureMapping (const csPolygonRange& range,
00451         float len1) = 0;
00452 
00458   virtual void GetPolygonTextureMapping (int polygon_idx,
00459         csMatrix3& m, csVector3& v) = 0;
00460 
00466   virtual void SetPolygonTextureMappingEnabled (const csPolygonRange& range,
00467         bool enabled) = 0;
00468 
00474   virtual bool IsPolygonTextureMappingEnabled (int polygon_idx) const = 0;
00475 
00481   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 flags) = 0;
00482 
00488   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 mask,
00489         uint32 flags) = 0;
00490 
00496   virtual void ResetPolygonFlags (const csPolygonRange& range,
00497         uint32 flags) = 0;
00498 
00504   virtual csFlags& GetPolygonFlags (int polygon_idx) = 0;
00505 
00511   virtual const csPlane3& GetPolygonObjectPlane (int polygon_idx) = 0;
00512 
00518   virtual bool IsPolygonTransparent (int polygon_idx) = 0;
00519 
00526   virtual bool PointOnPolygon (int polygon_idx, const csVector3& v) = 0;
00527 
00529   virtual int GetVertexCount () const = 0;
00531   virtual const csVector3 &GetVertex (int idx) const = 0;
00533   virtual const csVector3* GetVertices () const = 0;
00535   virtual int CreateVertex (const csVector3& vt) = 0;
00537   virtual void SetVertex (int idx, const csVector3& vt) = 0;
00543   virtual void DeleteVertex (int idx) = 0;
00551   virtual void DeleteVertices (int from, int to) = 0;
00552 
00554   virtual csFlags& GetFlags () = 0;
00555 
00559   virtual void SetSmoothingFlag (bool smoothing) = 0;
00560 
00564   virtual bool GetSmoothingFlag () = 0;
00565   
00569   virtual csVector3* GetNormals () = 0;
00570 
00574   virtual float GetCosinusFactor () const = 0;
00580   virtual void SetCosinusFactor (float cosfact) = 0;
00581 };
00582 
00583 SCF_VERSION (iThingState, 0, 7, 0);
00584 
00589 struct iThingState : public iBase
00590 {
00592   virtual void* GetPrivateObject () = 0;
00593 
00595   virtual iThingFactoryState* GetFactory () = 0;
00596 
00598   virtual const csVector3 &GetVertexW (int idx) const = 0;
00600   virtual const csVector3* GetVerticesW () const = 0;
00601 
00605   virtual int GetMovingOption () const = 0;
00606 
00634   virtual void SetMovingOption (int opt) = 0;
00635 
00644   virtual void Prepare () = 0;
00645 
00650   virtual void Unprepare () = 0;
00651 
00659   virtual void ReplaceMaterial (iMaterialWrapper* oldmat,
00660         iMaterialWrapper* newmat) = 0;
00661 
00666   virtual void ClearReplacedMaterials () = 0;
00667 
00669   virtual void SetMixMode (uint mode) = 0;
00671   virtual uint GetMixMode () const = 0;
00672 
00682   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00683 
00689   virtual const csPlane3& GetPolygonWorldPlane (int polygon_idx) = 0;
00690 
00696   virtual iMaterialWrapper* GetPolygonMaterial (int polygon_idx) = 0;
00697 
00706   virtual void SetPolygonMaterial (const csPolygonRange& range,
00707         iMaterialWrapper* material) = 0;
00708 };
00709 
00710 SCF_VERSION (iThingEnvironment, 0, 3, 0);
00711 
00716 struct iThingEnvironment : public iBase
00717 {
00721   virtual void Clear () = 0;
00722 
00724   virtual int GetLightmapCellSize () const = 0;
00726   virtual void SetLightmapCellSize (int Size) = 0;
00728   virtual int GetDefaultLightmapCellSize () const = 0;
00729 };
00730 
00731 #endif // __CS_IMESH_THING_H__

Generated for Crystal Space by doxygen 1.2.18