CrystalSpace

Public API Reference

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

thing.h

Go to the documentation of this file.
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 
00032 struct iMaterialWrapper;
00033 struct iMeshObject;
00034 struct iMeshObjectFactory;
00035 struct iRenderBuffer;
00036 struct iThingState;
00037 struct iThingFactoryState;
00038 
00039 class csFlags;
00040 class csMatrix3;
00041 class csPlane3;
00042 class csVector2;
00043 class csVector3;
00044 
00048 struct csPolygonRange
00049 {
00050   int start, end;
00051   csPolygonRange (int start, int end)
00052   {
00053     csPolygonRange::start = start;
00054     csPolygonRange::end = end;
00055   }
00056   void Set (int start, int end)
00057   {
00058     csPolygonRange::start = start;
00059     csPolygonRange::end = end;
00060   }
00061   void Set (int idx)
00062   {
00063     csPolygonRange::start = idx;
00064     csPolygonRange::end = idx;
00065   }
00066 };
00067 
00074 #define CS_POLY_LIGHTING 0x00000001
00075 
00079 #define CS_POLY_COLLDET 0x00000002
00080 
00084 #define CS_POLY_VISCULL 0x00000004
00085 
00093 #define CS_POLYRANGE(s1,s2) csPolygonRange (s1, s2)
00094 
00097 #define CS_POLYRANGE_SINGLE(idx) csPolygonRange (idx, idx)
00098 
00101 #define CS_POLYRANGE_LAST csPolygonRange (-1, -1)
00102 
00105 #define CS_POLYRANGE_ALL csPolygonRange (0, 2000000000)
00106 
00111 #define CS_POLYINDEX_LAST -1
00112 
00121 #define CS_THING_NOCOMPRESS 0x00010000
00122 
00130 #define CS_THING_MOVE_NEVER 0
00131 #define CS_THING_MOVE_OCCASIONAL 2
00132 
00134 SCF_VERSION (iPolygonHandle, 0, 0, 1);
00135 
00155 struct iPolygonHandle : public iBase
00156 {
00161   virtual iThingFactoryState* GetThingFactoryState () const = 0;
00162 
00167   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00168 
00173   virtual iThingState* GetThingState () const = 0;
00174 
00179   virtual iMeshObject* GetMeshObject () const = 0;
00180 
00184   virtual int GetIndex () const = 0;
00185 };
00186 
00187 
00188 SCF_VERSION (iThingFactoryState, 0, 2, 1);
00189 
00209 struct iThingFactoryState : public iBase
00210 {
00219   virtual void CompressVertices () = 0;
00220 
00222   virtual int GetPolygonCount () = 0;
00224   virtual void RemovePolygon (int idx) = 0;
00226   virtual void RemovePolygons () = 0;
00227 
00229   virtual int FindPolygonByName (const char* name) = 0;
00230 
00235   virtual int AddEmptyPolygon () = 0;
00236 
00247   virtual int AddTriangle (const csVector3& v1, const csVector3& v2,
00248         const csVector3& v3) = 0;
00260   virtual int AddQuad (const csVector3& v1, const csVector3& v2,
00261         const csVector3& v3, const csVector3& v4) = 0;
00262 
00273   virtual int AddPolygon (csVector3* vertices, int num) = 0;
00274 
00285   virtual int AddPolygon (int num, ...) = 0;
00286 
00297   virtual int AddOutsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00298 
00309   virtual int AddInsideBox (const csVector3& bmin, const csVector3& bmax) = 0;
00310 
00317   virtual void SetPolygonName (const csPolygonRange& range,
00318         const char* name) = 0;
00319 
00325   virtual const char* GetPolygonName (int polygon_idx) = 0;
00326 
00337   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00338 
00345   virtual void SetPolygonMaterial (const csPolygonRange& range,
00346         iMaterialWrapper* material) = 0;
00347 
00353   virtual iMaterialWrapper* GetPolygonMaterial (int polygon_idx) = 0;
00354 
00361   virtual void AddPolygonVertex (const csPolygonRange& range,
00362         const csVector3& vt) = 0;
00363 
00370   virtual void AddPolygonVertex (const csPolygonRange& range, int vt) = 0;
00371 
00381   virtual void SetPolygonVertexIndices (const csPolygonRange& range,
00382         int num, int* indices) = 0;
00383 
00389   virtual int GetPolygonVertexCount (int polygon_idx) = 0;
00390 
00397   virtual const csVector3& GetPolygonVertex (int polygon_idx,
00398         int vertex_idx) = 0;
00399 
00405   virtual int* GetPolygonVertexIndices (int polygon_idx) = 0;
00406 
00420   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00421         const csMatrix3& m, const csVector3& v) = 0;
00422 
00434   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00435         const csVector2& uv1, const csVector2& uv2, const csVector2& uv3) = 0;
00436 
00453   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00454         const csVector3& p1, const csVector2& uv1,
00455         const csVector3& p2, const csVector2& uv2,
00456         const csVector3& p3, const csVector2& uv3) = 0;
00457 
00476   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00477         const csVector3& v_orig, const csVector3& v, float len) = 0;
00478 
00499   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00500         const csVector3& v_orig,
00501         const csVector3& v1, float len1,
00502         const csVector3& v2, float len2) = 0;
00503 
00521   virtual bool SetPolygonTextureMapping (const csPolygonRange& range,
00522         float len) = 0;
00523 
00531   virtual void GetPolygonTextureMapping (int polygon_idx,
00532         csMatrix3& m, csVector3& v) = 0;
00533 
00541   virtual void SetPolygonTextureMappingEnabled (const csPolygonRange& range,
00542         bool enabled) = 0;
00543 
00549   virtual bool IsPolygonTextureMappingEnabled (int polygon_idx) const = 0;
00550 
00558   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 flags) = 0;
00559 
00570   virtual void SetPolygonFlags (const csPolygonRange& range, uint32 mask,
00571         uint32 flags) = 0;
00572 
00580   virtual void ResetPolygonFlags (const csPolygonRange& range,
00581         uint32 flags) = 0;
00582 
00588   virtual csFlags& GetPolygonFlags (int polygon_idx) = 0;
00589 
00595   virtual const csPlane3& GetPolygonObjectPlane (int polygon_idx) = 0;
00596 
00602   virtual bool IsPolygonTransparent (int polygon_idx) = 0;
00603 
00611   virtual bool PointOnPolygon (int polygon_idx, const csVector3& v) = 0;
00612 
00614   virtual int GetVertexCount () const = 0;
00616   virtual const csVector3 &GetVertex (int idx) const = 0;
00618   virtual const csVector3* GetVertices () const = 0;
00620   virtual int CreateVertex (const csVector3& vt) = 0;
00622   virtual void SetVertex (int idx, const csVector3& vt) = 0;
00628   virtual void DeleteVertex (int idx) = 0;
00636   virtual void DeleteVertices (int from, int to) = 0;
00637 
00641   virtual void SetSmoothingFlag (bool smoothing) = 0;
00642 
00646   virtual bool GetSmoothingFlag () = 0;
00647   
00651   virtual csVector3* GetNormals () = 0;
00652 
00656   virtual float GetCosinusFactor () const = 0;
00662   virtual void SetCosinusFactor (float cosfact) = 0;
00663 
00664   virtual bool AddPolygonRenderBuffer (int polygon_idx, const char* name,
00665     iRenderBuffer* buffer) = 0;
00666 
00668   virtual void SetMixMode (uint mode) = 0;
00670   virtual uint GetMixMode () const = 0;
00671 };
00672 
00673 SCF_VERSION (iThingState, 0, 7, 0);
00674 
00693 struct iThingState : public iBase
00694 {
00696   virtual iThingFactoryState* GetFactory () = 0;
00697 
00699   virtual const csVector3 &GetVertexW (int idx) const = 0;
00701   virtual const csVector3* GetVerticesW () const = 0;
00702 
00706   virtual int GetMovingOption () const = 0;
00707 
00735   virtual void SetMovingOption (int opt) = 0;
00736 
00745   virtual void Prepare () = 0;
00746 
00751   virtual void Unprepare () = 0;
00752 
00760   virtual void ReplaceMaterial (iMaterialWrapper* oldmat,
00761         iMaterialWrapper* newmat) = 0;
00762 
00767   virtual void ClearReplacedMaterials () = 0;
00768 
00770   virtual void SetMixMode (uint mode) = 0;
00772   virtual uint GetMixMode () const = 0;
00773 
00783   virtual csPtr<iPolygonHandle> CreatePolygonHandle (int polygon_idx) = 0;
00784 
00790   virtual const csPlane3& GetPolygonWorldPlane (int polygon_idx) = 0;
00791 };
00792 
00793 SCF_VERSION (iThingEnvironment, 0, 3, 0);
00794 
00808 struct iThingEnvironment : public iBase
00809 {
00813   virtual void Clear () = 0;
00814 
00816   virtual int GetLightmapCellSize () const = 0;
00818   virtual void SetLightmapCellSize (int Size) = 0;
00820   virtual int GetDefaultLightmapCellSize () const = 0;
00821 };
00822 
00825 #endif // __CS_IMESH_THING_H__

Generated for Crystal Space by doxygen 1.4.4