iengine/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 00029 #include "csutil/scf.h" 00030 00031 #include "csgeom/box.h" 00032 #include "csgeom/vector3.h" 00033 00034 #include "ivideo/graph3d.h" 00035 #include "ivideo/rendermesh.h" 00036 00037 struct iCamera; 00038 struct iLightingInfo; 00039 struct iLODControl; 00040 struct iMeshFactoryList; 00041 struct iMeshFactoryWrapper; 00042 struct iMeshList; 00043 struct iMeshObject; 00044 struct iMeshObjectFactory; 00045 struct iMeshWrapper; 00046 struct iMovable; 00047 struct iObject; 00048 struct iPortalContainer; 00049 struct iRenderView; 00050 struct iShaderVariableContext; 00051 struct iShadowCaster; 00052 struct iShadowReceiver; 00053 struct iSharedVariable; 00054 struct iSceneNode; 00055 struct iMaterialWrapper; 00056 00057 class csEllipsoid; 00058 class csFlags; 00059 class csReversibleTransform; 00060 00071 #define CS_ENTITY_DETAIL 2 00072 00081 #define CS_ENTITY_CAMERA 4 00082 00090 #define CS_ENTITY_INVISIBLEMESH 8 00091 00098 #define CS_ENTITY_INVISIBLE (CS_ENTITY_INVISIBLEMESH+CS_ENTITY_NOHITBEAM) 00099 00105 #define CS_ENTITY_NOSHADOWS 16 00106 00112 #define CS_ENTITY_NOLIGHTING 32 00113 00118 #define CS_ENTITY_NOHITBEAM 64 00119 00129 #define CS_ENTITY_NOCLIP 128 00130 00134 #define CS_ENTITY_NODECAL 256 00135 00139 #define CS_ENTITY_STATICLIT 512 00140 00151 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1 00152 00159 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2 00160 00174 struct iMeshDrawCallback : public virtual iBase 00175 { 00176 SCF_INTERFACE (iMeshDrawCallback, 0, 0, 1); 00177 00182 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0; 00183 }; 00184 00188 struct csHitBeamResult 00189 { 00191 csVector3 isect; 00196 float r; 00198 int polygon_idx; 00203 iMaterialWrapper* material; 00208 int facehit; 00212 bool hit; 00213 00214 csHitBeamResult() : material(0), hit(false) 00215 { 00216 } 00217 }; 00218 00222 struct csScreenBoxResult 00223 { 00225 csBox2 sbox; 00227 csBox3 cbox; 00232 float distance; 00233 }; 00234 00265 struct iMeshWrapper : public virtual iBase 00266 { 00267 SCF_INTERFACE(iMeshWrapper, 2, 3, 0); 00268 00274 virtual iObject *QueryObject () = 0; 00275 00277 virtual iMeshObject* GetMeshObject () const = 0; 00279 virtual void SetMeshObject (iMeshObject*) = 0; 00284 virtual iPortalContainer* GetPortalContainer () const = 0; 00285 00292 virtual iLightingInfo* GetLightingInfo () const = 0; 00293 00305 virtual iShadowReceiver* GetShadowReceiver () = 0; 00306 00317 virtual iShadowCaster* GetShadowCaster () = 0; 00318 00320 virtual iMeshFactoryWrapper *GetFactory () const = 0; 00322 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0; 00323 00337 virtual void SetLightingUpdate (int flags, int num_lights) = 0; 00338 00346 virtual iMovable* GetMovable () const = 0; 00347 00351 virtual iSceneNode* QuerySceneNode () = 0; 00352 00358 virtual iMeshWrapper* FindChildByName (const char* name) = 0; 00359 00377 virtual void PlaceMesh () = 0; 00378 00389 virtual csHitBeamResult HitBeamBBox (const csVector3& start, 00390 const csVector3& end) = 0; 00391 00397 virtual csHitBeamResult HitBeamOutline (const csVector3& start, 00398 const csVector3& end) = 0; 00399 00409 virtual csHitBeamResult HitBeamObject (const csVector3& start, 00410 const csVector3& end, bool do_material = false) = 0; 00411 00420 virtual csHitBeamResult HitBeam (const csVector3& start, 00421 const csVector3& end, bool do_material = false) = 0; 00422 00431 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0; 00432 00436 virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0; 00437 00439 virtual int GetDrawCallbackCount () const = 0; 00440 00442 virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0; 00443 00458 virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0; 00462 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00463 00468 virtual void SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp) = 0; 00469 00488 virtual csFlags& GetFlags () = 0; 00489 00508 virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0; 00509 00518 virtual void SetZBufMode (csZBufMode mode) = 0; 00522 virtual csZBufMode GetZBufMode () const = 0; 00527 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00528 00543 virtual void HardTransform (const csReversibleTransform& t) = 0; 00544 00550 virtual const csBox3& GetWorldBoundingBox () = 0; 00551 00557 virtual csBox3 GetTransformedBoundingBox ( 00558 const csReversibleTransform& trans) = 0; 00559 00565 virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0; 00566 00568 virtual csSphere GetRadius () const = 0; 00569 00573 virtual void ResetMinMaxRenderDistance () = 0; 00574 00579 virtual void SetMinimumRenderDistance (float min) = 0; 00580 00584 virtual float GetMinimumRenderDistance () const = 0; 00585 00590 virtual void SetMaximumRenderDistance (float min) = 0; 00591 00595 virtual float GetMaximumRenderDistance () const = 0; 00596 00602 virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0; 00603 00608 virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0; 00609 00615 virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0; 00616 00621 virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0; 00622 00629 virtual iLODControl* CreateStaticLOD () = 0; 00630 00635 virtual void DestroyStaticLOD () = 0; 00636 00642 virtual iLODControl* GetStaticLOD () = 0; 00643 00648 virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0; 00649 00654 virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0; 00655 00659 virtual iShaderVariableContext* GetSVContext() = 0; 00660 00666 virtual size_t AddExtraRenderMesh(CS::Graphics::RenderMesh* renderMesh, 00667 csZBufMode zBufMode) = 0; 00669 CS_DEPRECATED_METHOD_MSG("Pass render priority in render mesh") 00670 virtual void AddExtraRenderMesh(CS::Graphics::RenderMesh* renderMesh, 00671 CS::Graphics::RenderPriority priority, csZBufMode zBufMode) = 0; 00672 00674 virtual CS::Graphics::RenderMesh* GetExtraRenderMesh (size_t idx) const = 0; 00675 00677 virtual size_t GetExtraRenderMeshCount () const = 0; 00678 00683 CS_DEPRECATED_METHOD_MSG("Obtain render priority from render mesh") 00684 virtual CS::Graphics::RenderPriority GetExtraRenderMeshPriority(size_t idx) const = 0; 00685 00689 virtual csZBufMode GetExtraRenderMeshZBufMode(size_t idx) const = 0; 00690 00692 00695 virtual void RemoveExtraRenderMesh(CS::Graphics::RenderMesh* renderMesh) = 0; 00696 virtual void RemoveExtraRenderMesh(size_t idx) = 0; 00698 }; 00699 00725 struct iMeshFactoryWrapper : public virtual iBase 00726 { 00727 SCF_INTERFACE(iMeshFactoryWrapper, 2,0,0); 00729 virtual iObject *QueryObject () = 0; 00731 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0; 00733 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0; 00743 virtual void HardTransform (const csReversibleTransform& t) = 0; 00748 virtual csPtr<iMeshWrapper> CreateMeshWrapper () = 0; 00749 00769 virtual csFlags& GetFlags () = 0; 00770 00775 virtual iMeshFactoryWrapper* GetParentContainer () const = 0; 00780 virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0; 00781 00785 virtual iMeshFactoryList* GetChildren () = 0; 00786 00790 virtual csReversibleTransform& GetTransform () = 0; 00791 00795 virtual void SetTransform (const csReversibleTransform& tr) = 0; 00796 00803 virtual iLODControl* CreateStaticLOD () = 0; 00804 00808 virtual void DestroyStaticLOD () = 0; 00809 00815 virtual iLODControl* GetStaticLOD () = 0; 00816 00824 virtual void SetStaticLOD (float m, float a) = 0; 00825 00829 virtual void GetStaticLOD (float& m, float& a) const = 0; 00830 00835 virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0; 00836 00841 virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0; 00842 00852 virtual void SetZBufMode (csZBufMode mode) = 0; 00856 virtual csZBufMode GetZBufMode () const = 0; 00861 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00862 00878 virtual void SetRenderPriority (long rp) = 0; 00882 virtual long GetRenderPriority () const = 0; 00883 00888 virtual void SetRenderPriorityRecursive (long rp) = 0; 00889 00893 virtual iShaderVariableContext* GetSVContext() = 0; 00894 }; 00895 00906 struct iMeshList : public virtual iBase 00907 { 00908 SCF_INTERFACE(iMeshList, 2,0,0); 00910 virtual int GetCount () const = 0; 00911 00913 virtual iMeshWrapper *Get (int n) const = 0; 00914 00916 virtual int Add (iMeshWrapper *obj) = 0; 00917 00919 virtual bool Remove (iMeshWrapper *obj) = 0; 00920 00922 virtual bool Remove (int n) = 0; 00923 00925 virtual void RemoveAll () = 0; 00926 00928 virtual int Find (iMeshWrapper *obj) const = 0; 00929 00935 virtual iMeshWrapper *FindByName (const char *Name) const = 0; 00936 }; 00937 00948 struct iMeshFactoryList : public virtual iBase 00949 { 00950 SCF_INTERFACE(iMeshFactoryList,2,0,0); 00952 virtual int GetCount () const = 0; 00953 00955 virtual iMeshFactoryWrapper *Get (int n) const = 0; 00956 00958 virtual int Add (iMeshFactoryWrapper *obj) = 0; 00959 00961 virtual bool Remove (iMeshFactoryWrapper *obj) = 0; 00962 00964 virtual bool Remove (int n) = 0; 00965 00967 virtual void RemoveAll () = 0; 00968 00970 virtual int Find (iMeshFactoryWrapper *obj) const = 0; 00971 00973 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0; 00974 }; 00975 00983 struct iMeshWrapperIterator : public virtual iBase 00984 { 00985 SCF_INTERFACE(iMeshWrapperIterator,2,0,0); 00987 virtual iMeshWrapper* Next () = 0; 00988 00990 virtual void Reset () = 0; 00991 00993 virtual bool HasNext () const = 0; 00994 }; 00995 00996 00999 #endif // __CS_IENGINE_MESH_H__ 01000
Generated for Crystal Space 1.4.1 by doxygen 1.7.1