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

mesh.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000-2001 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_IENGINE_MESH_H__
00020 #define __CS_IENGINE_MESH_H__
00021 
00028 #include "csutil/scf.h"
00029 
00030 #include "csgeom/box.h"
00031 #include "csgeom/vector3.h"
00032 
00033 #include "ivideo/graph3d.h"
00034 
00035 struct iCamera;
00036 struct iLightingInfo;
00037 struct iLODControl;
00038 struct iMeshFactoryList;
00039 struct iMeshFactoryWrapper;
00040 struct iMeshList;
00041 struct iMeshObject;
00042 struct iMeshObjectFactory;
00043 struct iMeshWrapper;
00044 struct iMovable;
00045 struct iObject;
00046 struct iPortalContainer;
00047 struct iRenderView;
00048 struct iShaderVariableContext;
00049 struct iShadowCaster;
00050 struct iShadowReceiver;
00051 struct iSharedVariable;
00052 
00053 struct csRenderMesh;
00054 
00055 class csEllipsoid;
00056 class csFlags;
00057 class csReversibleTransform;
00058 
00069 #define CS_ENTITY_DETAIL 2
00070 
00079 #define CS_ENTITY_CAMERA 4
00080 
00088 #define CS_ENTITY_INVISIBLEMESH 8
00089 
00096 #define CS_ENTITY_INVISIBLE (CS_ENTITY_INVISIBLEMESH+CS_ENTITY_NOHITBEAM)
00097 
00103 #define CS_ENTITY_NOSHADOWS 16
00104 
00110 #define CS_ENTITY_NOLIGHTING 32
00111 
00116 #define CS_ENTITY_NOHITBEAM 64
00117 
00127 #define CS_ENTITY_NOCLIP 128
00128 
00139 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1
00140 
00147 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2
00148 
00151 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00152 
00161 struct iMeshDrawCallback : public iBase
00162 {
00167   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00168 };
00169 
00173 struct csHitBeamResult
00174 {
00176   csVector3 isect;
00181   float r;
00183   int polygon_idx;
00188   int facehit;
00192   bool hit;
00193 };
00194 
00198 struct csScreenBoxResult
00199 {
00201   csBox2 sbox;
00203   csBox3 cbox;
00208   float distance;
00209 };
00210 
00211 SCF_VERSION (iMeshWrapper, 0, 8, 1);
00212 
00248 struct iMeshWrapper : public iBase
00249 {
00255   virtual iObject *QueryObject () = 0;
00256 
00258   virtual iMeshObject* GetMeshObject () const = 0;
00260   virtual void SetMeshObject (iMeshObject*) = 0;
00265   virtual iPortalContainer* GetPortalContainer () const = 0;
00266 
00273   virtual iLightingInfo* GetLightingInfo () const = 0;
00274 
00286   virtual iShadowReceiver* GetShadowReceiver () = 0;
00287 
00298   virtual iShadowCaster* GetShadowCaster () = 0;
00299 
00301   virtual iMeshFactoryWrapper *GetFactory () const = 0;
00303   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00304 
00319   virtual void SetLightingUpdate (int flags, int num_lights) = 0;
00320 
00328   virtual iMovable* GetMovable () const = 0;
00329 
00347   virtual void PlaceMesh () = 0;
00348 
00359   CS_DEPRECATED_METHOD virtual int HitBeamBBox (const csVector3& start,
00360         const csVector3& end, csVector3& isect, float* pr) = 0;
00361 
00367   CS_DEPRECATED_METHOD virtual bool HitBeamOutline (const csVector3& start,
00368         const csVector3& end, csVector3& isect, float* pr) = 0;
00369 
00376   CS_DEPRECATED_METHOD virtual bool HitBeamObject (const csVector3& start,
00377         const csVector3& end, csVector3& isect, float* pr,
00378         int* polygon_idx = 0) = 0;
00379 
00385   CS_DEPRECATED_METHOD virtual bool HitBeam (const csVector3& start,
00386         const csVector3& end, csVector3& isect, float* pr) = 0;
00387 
00398   virtual csHitBeamResult HitBeamBBox (const csVector3& start,
00399         const csVector3& end) = 0;
00400 
00406   virtual csHitBeamResult HitBeamOutline (const csVector3& start,
00407         const csVector3& end) = 0;
00408 
00415   virtual csHitBeamResult HitBeamObject (const csVector3& start,
00416         const csVector3& end) = 0;
00417 
00423   virtual csHitBeamResult HitBeam (const csVector3& start,
00424         const csVector3& end) = 0;
00425 
00434   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00435 
00439   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00440 
00442   virtual int GetDrawCallbackCount () const = 0;
00443 
00445   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00446 
00463   virtual void SetRenderPriority (long rp) = 0;
00467   virtual long GetRenderPriority () const = 0;
00468 
00473   virtual void SetRenderPriorityRecursive (long rp) = 0;
00474 
00494   virtual csFlags& GetFlags () = 0;
00495 
00514   virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0;
00515 
00526   virtual void SetZBufMode (csZBufMode mode) = 0;
00530   virtual csZBufMode GetZBufMode () const = 0;
00535   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00536 
00551   virtual void HardTransform (const csReversibleTransform& t) = 0;
00552 
00559   CS_DEPRECATED_METHOD virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00560 
00567   CS_DEPRECATED_METHOD virtual void GetTransformedBoundingBox (
00568         const csReversibleTransform& trans, csBox3& cbox) = 0;
00569 
00577   CS_DEPRECATED_METHOD virtual float GetScreenBoundingBox (iCamera* camera,
00578         csBox2& sbox, csBox3& cbox) = 0;
00579 
00585   virtual const csBox3& GetWorldBoundingBox () = 0;
00586 
00592   virtual csBox3 GetTransformedBoundingBox (
00593         const csReversibleTransform& trans) = 0;
00594 
00600   virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0;
00601 
00607   virtual iMeshList* GetChildren () = 0;
00613   virtual iMeshWrapper* GetParentContainer () = 0;
00618   virtual void SetParentContainer (iMeshWrapper *) = 0;
00619 
00624   CS_DEPRECATED_METHOD virtual void GetRadius (csVector3& rad,
00625         csVector3& cent) const = 0;
00627   virtual csEllipsoid GetRadius () const = 0;
00628 
00632   virtual void ResetMinMaxRenderDistance () = 0;
00633 
00638   virtual void SetMinimumRenderDistance (float min) = 0;
00639 
00643   virtual float GetMinimumRenderDistance () const = 0;
00644 
00649   virtual void SetMaximumRenderDistance (float min) = 0;
00650 
00654   virtual float GetMaximumRenderDistance () const = 0;
00655 
00661   virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0;
00662 
00667   virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0;
00668 
00674   virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0;
00675 
00680   virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0;
00681 
00688   virtual iLODControl* CreateStaticLOD () = 0;
00689 
00694   virtual void DestroyStaticLOD () = 0;
00695 
00701   virtual iLODControl* GetStaticLOD () = 0;
00702 
00707   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
00708 
00713   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
00714 
00718   virtual iShaderVariableContext* GetSVContext() = 0;
00719 };
00720 
00721 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 7);
00722 
00752 struct iMeshFactoryWrapper : public iBase
00753 {
00755   virtual iObject *QueryObject () = 0;
00757   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00759   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00769   virtual void HardTransform (const csReversibleTransform& t) = 0;
00774   virtual iMeshWrapper* CreateMeshWrapper () = 0;
00775 
00780   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00785   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00786 
00790   virtual iMeshFactoryList* GetChildren () = 0;
00791 
00795   virtual csReversibleTransform& GetTransform () = 0;
00796 
00800   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00801 
00808   virtual iLODControl* CreateStaticLOD () = 0;
00809 
00813   virtual void DestroyStaticLOD () = 0;
00814 
00820   virtual iLODControl* GetStaticLOD () = 0;
00821 
00829   virtual void SetStaticLOD (float m, float a) = 0;
00830 
00834   virtual void GetStaticLOD (float& m, float& a) const = 0;
00835 
00840   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00841 
00846   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00847 
00859   virtual void SetZBufMode (csZBufMode mode) = 0;
00863   virtual csZBufMode GetZBufMode () const = 0;
00868   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00869 
00887   virtual void SetRenderPriority (long rp) = 0;
00891   virtual long GetRenderPriority () const = 0;
00892 
00897   virtual void SetRenderPriorityRecursive (long rp) = 0;
00898 
00902   virtual iShaderVariableContext* GetSVContext() = 0;
00903 };
00904 
00905 SCF_VERSION (iMeshList, 0, 0, 1);
00906 
00921 struct iMeshList : public iBase
00922 {
00924   virtual int GetCount () const = 0;
00925 
00927   virtual iMeshWrapper *Get (int n) const = 0;
00928 
00930   virtual int Add (iMeshWrapper *obj) = 0;
00931 
00933   virtual bool Remove (iMeshWrapper *obj) = 0;
00934 
00936   virtual bool Remove (int n) = 0;
00937 
00939   virtual void RemoveAll () = 0;
00940 
00942   virtual int Find (iMeshWrapper *obj) const = 0;
00943 
00949   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00950 };
00951 
00952 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00953 
00967 struct iMeshFactoryList : public iBase
00968 {
00970   virtual int GetCount () const = 0;
00971 
00973   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00974 
00976   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00977 
00979   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00980 
00982   virtual bool Remove (int n) = 0;
00983 
00985   virtual void RemoveAll () = 0;
00986 
00988   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00989 
00991   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00992 };
00993 
00994 SCF_VERSION (iMeshWrapperIterator, 0, 1, 0);
00995 
01005 struct iMeshWrapperIterator : public iBase
01006 {
01008   virtual iMeshWrapper* Next () = 0;
01009 
01011   virtual void Reset () = 0;
01012 
01014   virtual bool HasNext () const = 0;
01015 };
01016 
01017 
01020 #endif // __CS_IENGINE_MESH_H__
01021 

Generated for Crystal Space by doxygen 1.4.4