CrystalSpace

Public API Reference

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

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 struct iRenderBuffer;
00040 
00044 struct csPolygonRange
00045 {
00046   int start, end;
00047   csPolygonRange (int start, int end)
00048   {
00049     csPolygonRange::start = start;
00050     csPolygonRange::end = end;
00051   }
00052   void Set (int start, int end)
00053   {
00054     csPolygonRange::start = start;
00055     csPolygonRange::end = end;
00056   }
00057   void Set (int idx)
00058   {
00059     csPolygonRange::start = idx;
00060     csPolygonRange::end = idx;
00061   }
00062 };
00063 
00070 #define CS_POLY_LIGHTING 0x00000001
00071 
00075 #define CS_POLY_COLLDET 0x00000002
00076 
00080 #define CS_POLY_VISCULL 0x00000004
00081 
00089 #define CS_POLYRANGE(s1,s2) csPolygonRange (s1, s2)
00090 
00093 #define CS_POLYRANGE_SINGLE(idx) csPolygonRange (idx, idx)
00094 
00097 #define CS_POLYRANGE_LAST csPolygonRange (-1, -1)
00098 
00101 #define CS_POLYRANGE_ALL csPolygonRange (0, 2000000000)
00102 
00107 #define CS_POLYINDEX_LAST -1
00108 
00117 #define CS_THING_NOCOMPRESS 0x00010000
00118 
00126 #define CS_THING_MOVE_NEVER 0
00127 #define CS_THING_MOVE_OCCASIONAL 2
00128 
00130 SCF_VERSION (iPolygonHandle, 0, 0, 1);
00131 
00151 struct iPolygonHandle : public iBase
00152 {
00157   virtual iThingFactoryState* GetThingFactoryState () const = 0;
00158 
00163   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00164 
00169   virtual iThingState* GetThingState () const = 0;
00170 
00175   virtual iMeshObject* GetMeshObject () const = 0;
00176 
00180   virtual int GetIndex () const = 0;
00181 };
00182 
00183 
00184 SCF_VERSION (iThingFactoryState, 0, 2, 0);
00185 
00205 struct iThingFactoryState : public iBase
00206 {
00215   virtual void CompressVertices () = 0;
00216 
00218   virtual int GetPolygonCount () = 0;
00220   virtual void RemovePolygon (int idx) = 0;
00222   virtual void RemovePolygons () = 0;
00223 
00225   virtual int FindPolygonByName (const char* name) = 0;
00226 
00231   virtual int AddEmptyPolygon () = 0;
00232 
00243   virtual int AddTriangle (const csVector3& v1, const csVector3& v2,
00244         const csVector3& v3) = 0;
00256   virtual int AddQuad (const csVector3& v1, const csVector3& v2,
00257         const csVector3& v3, const csVector3& v4) = 0;
00258 
00269   virtual int AddPolygon (csVector3* vertices, int num) = 0;
00270 
00281   virtual int AddPolygon (int num, ...) = 0;
00282 
00293   virtual int AddOutsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00294 
00305   virtual int AddInsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00306 
00313   virtual void SetPolygonName (const csPolygonRange& range,
00314         const char* name) = 0;
00315 
00321   virtual const char* GetPolygonName (int polygon_idx) = 0;
00322 
00333   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00334 
00341   virtual void SetPolygonMaterial (const csPolygonRange& range,
00342         iMaterialWrapper* material) = 0;
00343 
00349   virtual iMaterialWrapper* GetPolygonMaterial (int polygon_idx) = 0;
00350 
00357   virtual void AddPolygonVertex (const csPolygonRange& range,
00358         const csVector3& vt) = 0;
00359 
00366   virtual void AddPolygonVertex (const csPolygonRange& range, int vt) = 0;
00367 
00377   virtual void SetPolygonVertexIndices (const csPolygonRange& range,
00378         int num, int* indices) = 0;
00379 
00385   virtual int GetPolygonVertexCount (int polygon_idx) = 0;
00386 
00393   virtual const csVector3& GetPolygonVertex (int polygon_idx,
00394         int vertex_idx) = 0;
00395 
00401   virtual int* GetPolygonVertexIndices (int polygon_idx) = 0;
00402 
00416   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00417         const csMatrix3& m, const csVector3& v) = 0;
00418 
00430   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00431         const csVector2& uv1, const csVector2& uv2, const csVector2& uv3) = 0;
00432 
00449   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00450         const csVector3& p1, const csVector2& uv1,
00451         const csVector3& p2, const csVector2& uv2,
00452         const csVector3& p3, const csVector2& uv3) = 0;
00453 
00472   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00473         const csVector3& v_orig, const csVector3& v, float len) = 0;
00474 
00495   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00496         const csVector3& v_orig,
00497         const csVector3& v1, float len1,
00498         const csVector3& v2, float len2) = 0;
00499 
00517   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00518         float len) = 0;
00519 
00527   virtual void GetPolygonTextureMapping (int polygon_idx,
00528         csMatrix3& m, csVector3& v) = 0;
00529 
00537   virtual void SetPolygonTextureMappingEnabled (const csPolygonRange& range,
00538         bool enabled) = 0;
00539 
00545   virtual bool IsPolygonTextureMappingEnabled (int polygon_idx) const = 0;
00546 
00554   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 flags) = 0;
00555 
00566   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 mask,
00567         uint32 flags) = 0;
00568 
00576   virtual void ResetPolygonFlags (const csPolygonRange& range,
00577         uint32 flags) = 0;
00578 
00584   virtual csFlags& GetPolygonFlags (int polygon_idx) = 0;
00585 
00591   virtual const csPlane3& GetPolygonObjectPlane (int polygon_idx) = 0;
00592 
00598   virtual bool IsPolygonTransparent (int polygon_idx) = 0;
00599 
00607   virtual bool PointOnPolygon (int polygon_idx, const csVector3& v) = 0;
00608 
00610   virtual int GetVertexCount () const = 0;
00612   virtual const csVector3 &GetVertex (int idx) const = 0;
00614   virtual const csVector3* GetVertices () const = 0;
00616   virtual int CreateVertex (const csVector3& vt) = 0;
00618   virtual void SetVertex (int idx, const csVector3& vt) = 0;
00624   virtual void DeleteVertex (int idx) = 0;
00632   virtual void DeleteVertices (int from, int to) = 0;
00633 
00637   virtual void SetSmoothingFlag (bool smoothing) = 0;
00638 
00642   virtual bool GetSmoothingFlag () = 0;
00643   
00647   virtual csVector3* GetNormals () = 0;
00648 
00652   virtual float GetCosinusFactor () const = 0;
00658   virtual void SetCosinusFactor (float cosfact) = 0;
00659 
00660   virtual bool AddPolygonRenderBuffer (int polygon_idx, const char* name,
00661     iRenderBuffer* buffer) = 0;
00662 };
00663 
00664 SCF_VERSION (iThingState, 0, 7, 0);
00665 
00684 struct iThingState : public iBase
00685 {
00687   virtual iThingFactoryState* GetFactory () = 0;
00688 
00690   virtual const csVector3 &GetVertexW (int idx) const = 0;
00692   virtual const csVector3* GetVerticesW () const = 0;
00693 
00697   virtual int GetMovingOption () const = 0;
00698 
00726   virtual void SetMovingOption (int opt) = 0;
00727 
00736   virtual void Prepare () = 0;
00737 
00742   virtual void Unprepare () = 0;
00743 
00751   virtual void ReplaceMaterial (iMaterialWrapper* oldmat,
00752         iMaterialWrapper* newmat) = 0;
00753 
00758   virtual void ClearReplacedMaterials () = 0;
00759 
00761   virtual void SetMixMode (uint mode) = 0;
00763   virtual uint GetMixMode () const = 0;
00764 
00774   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00775 
00781   virtual const csPlane3& GetPolygonWorldPlane (int polygon_idx) = 0;
00782 };
00783 
00784 SCF_VERSION (iThingEnvironment, 0, 3, 0);
00785 
00799 struct iThingEnvironment : public iBase
00800 {
00804   virtual void Clear () = 0;
00805 
00807   virtual int GetLightmapCellSize () const = 0;
00809   virtual void SetLightmapCellSize (int Size) = 0;
00811   virtual int GetDefaultLightmapCellSize () const = 0;
00812 };
00813 
00814 #endif // __CS_IMESH_THING_H__

Generated for Crystal Space by doxygen 1.3.9.1