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 00036 struct iCamera; 00037 struct iLightingInfo; 00038 struct iLODControl; 00039 struct iMeshFactoryList; 00040 struct iMeshFactoryWrapper; 00041 struct iMeshList; 00042 struct iMeshObject; 00043 struct iMeshObjectFactory; 00044 struct iMeshWrapper; 00045 struct iMovable; 00046 struct iObject; 00047 struct iPortalContainer; 00048 struct iRenderView; 00049 struct iShaderVariableContext; 00050 struct iShadowCaster; 00051 struct iShadowReceiver; 00052 struct iSharedVariable; 00053 struct iSceneNode; 00054 struct iMaterialWrapper; 00055 00056 struct csRenderMesh; 00057 00058 class csEllipsoid; 00059 class csFlags; 00060 class csReversibleTransform; 00061 00072 #define CS_ENTITY_DETAIL 2 00073 00082 #define CS_ENTITY_CAMERA 4 00083 00091 #define CS_ENTITY_INVISIBLEMESH 8 00092 00099 #define CS_ENTITY_INVISIBLE (CS_ENTITY_INVISIBLEMESH+CS_ENTITY_NOHITBEAM) 00100 00106 #define CS_ENTITY_NOSHADOWS 16 00107 00113 #define CS_ENTITY_NOLIGHTING 32 00114 00119 #define CS_ENTITY_NOHITBEAM 64 00120 00130 #define CS_ENTITY_NOCLIP 128 00131 00142 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1 00143 00150 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2 00151 00154 SCF_VERSION (iMeshDrawCallback, 0, 0, 1); 00155 00167 struct iMeshDrawCallback : public iBase 00168 { 00173 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0; 00174 }; 00175 00179 struct csHitBeamResult 00180 { 00182 csVector3 isect; 00187 float r; 00189 int polygon_idx; 00194 iMaterialWrapper* material; 00199 int facehit; 00203 bool hit; 00204 }; 00205 00209 struct csScreenBoxResult 00210 { 00212 csBox2 sbox; 00214 csBox3 cbox; 00219 float distance; 00220 }; 00221 00253 struct iMeshWrapper : public virtual iBase 00254 { 00255 SCF_INTERFACE(iMeshWrapper, 2, 0, 0); 00256 00262 virtual iObject *QueryObject () = 0; 00263 00265 virtual iMeshObject* GetMeshObject () const = 0; 00267 virtual void SetMeshObject (iMeshObject*) = 0; 00272 virtual iPortalContainer* GetPortalContainer () const = 0; 00273 00280 virtual iLightingInfo* GetLightingInfo () const = 0; 00281 00293 virtual iShadowReceiver* GetShadowReceiver () = 0; 00294 00305 virtual iShadowCaster* GetShadowCaster () = 0; 00306 00308 virtual iMeshFactoryWrapper *GetFactory () const = 0; 00310 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0; 00311 00325 virtual void SetLightingUpdate (int flags, int num_lights) = 0; 00326 00334 virtual iMovable* GetMovable () const = 0; 00335 00339 virtual iSceneNode* QuerySceneNode () = 0; 00340 00346 virtual iMeshWrapper* FindChildByName (const char* name) = 0; 00347 00365 virtual void PlaceMesh () = 0; 00366 00377 CS_DEPRECATED_METHOD_MSG("Use HitBeamBBox() with csHitBeamResult instead.") 00378 virtual int HitBeamBBox (const csVector3& start, 00379 const csVector3& end, csVector3& isect, float* pr) = 0; 00380 00386 CS_DEPRECATED_METHOD_MSG("Use HitBeamOutline() with csHitBeamResult instead.") 00387 virtual bool HitBeamOutline (const csVector3& start, 00388 const csVector3& end, csVector3& isect, float* pr) = 0; 00389 00396 CS_DEPRECATED_METHOD_MSG("Use HitBeamObject() with csHitBeamResult instead.") 00397 virtual bool HitBeamObject (const csVector3& start, 00398 const csVector3& end, csVector3& isect, float* pr, 00399 int* polygon_idx = 0) = 0; 00400 00406 CS_DEPRECATED_METHOD_MSG("Use HitBeamObject() with csHitBeamResult instead.") 00407 virtual bool HitBeam (const csVector3& start, 00408 const csVector3& end, csVector3& isect, float* pr, 00409 iMaterialWrapper** material = 0) = 0; 00410 00421 virtual csHitBeamResult HitBeamBBox (const csVector3& start, 00422 const csVector3& end) = 0; 00423 00429 virtual csHitBeamResult HitBeamOutline (const csVector3& start, 00430 const csVector3& end) = 0; 00431 00441 virtual csHitBeamResult HitBeamObject (const csVector3& start, 00442 const csVector3& end, bool do_material = false) = 0; 00443 00452 virtual csHitBeamResult HitBeam (const csVector3& start, 00453 const csVector3& end, bool do_material = false) = 0; 00454 00463 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0; 00464 00468 virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0; 00469 00471 virtual int GetDrawCallbackCount () const = 0; 00472 00474 virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0; 00475 00490 virtual void SetRenderPriority (long rp) = 0; 00494 virtual long GetRenderPriority () const = 0; 00495 00500 virtual void SetRenderPriorityRecursive (long rp) = 0; 00501 00520 virtual csFlags& GetFlags () = 0; 00521 00540 virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0; 00541 00550 virtual void SetZBufMode (csZBufMode mode) = 0; 00554 virtual csZBufMode GetZBufMode () const = 0; 00559 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00560 00575 virtual void HardTransform (const csReversibleTransform& t) = 0; 00576 00583 CS_DEPRECATED_METHOD_MSG("Use GetWorldBoundingBox that returns a csBox3 " 00584 "instead") 00585 virtual void GetWorldBoundingBox (csBox3& cbox) = 0; 00586 00593 CS_DEPRECATED_METHOD_MSG("Use GetTransformedBoundingBox that returns a " 00594 "csBox3 instead") 00595 virtual void GetTransformedBoundingBox (const csReversibleTransform& trans, 00596 csBox3& cbox) = 0; 00597 00605 CS_DEPRECATED_METHOD_MSG("Use GetScreenBoundingBox() that returns a " 00606 "csScreenBoxResult instead") 00607 virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox, 00608 csBox3& cbox) = 0; 00609 00615 virtual const csBox3& GetWorldBoundingBox () = 0; 00616 00622 virtual csBox3 GetTransformedBoundingBox ( 00623 const csReversibleTransform& trans) = 0; 00624 00630 virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0; 00631 00636 CS_DEPRECATED_METHOD_MSG("Use GetRadius() that returns csEllipsoid") 00637 virtual void GetRadius (float& rad, csVector3& cent) const = 0; 00639 virtual csSphere GetRadius () const = 0; 00640 00644 virtual void ResetMinMaxRenderDistance () = 0; 00645 00650 virtual void SetMinimumRenderDistance (float min) = 0; 00651 00655 virtual float GetMinimumRenderDistance () const = 0; 00656 00661 virtual void SetMaximumRenderDistance (float min) = 0; 00662 00666 virtual float GetMaximumRenderDistance () const = 0; 00667 00673 virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0; 00674 00679 virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0; 00680 00686 virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0; 00687 00692 virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0; 00693 00700 virtual iLODControl* CreateStaticLOD () = 0; 00701 00706 virtual void DestroyStaticLOD () = 0; 00707 00713 virtual iLODControl* GetStaticLOD () = 0; 00714 00719 virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0; 00720 00725 virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0; 00726 00730 virtual iShaderVariableContext* GetSVContext() = 0; 00731 }; 00732 00758 struct iMeshFactoryWrapper : public virtual iBase 00759 { 00760 SCF_INTERFACE(iMeshFactoryWrapper, 2,0,0); 00762 virtual iObject *QueryObject () = 0; 00764 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0; 00766 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0; 00776 virtual void HardTransform (const csReversibleTransform& t) = 0; 00781 virtual csPtr<iMeshWrapper> CreateMeshWrapper () = 0; 00782 00802 virtual csFlags& GetFlags () = 0; 00803 00808 virtual iMeshFactoryWrapper* GetParentContainer () const = 0; 00813 virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0; 00814 00818 virtual iMeshFactoryList* GetChildren () = 0; 00819 00823 virtual csReversibleTransform& GetTransform () = 0; 00824 00828 virtual void SetTransform (const csReversibleTransform& tr) = 0; 00829 00836 virtual iLODControl* CreateStaticLOD () = 0; 00837 00841 virtual void DestroyStaticLOD () = 0; 00842 00848 virtual iLODControl* GetStaticLOD () = 0; 00849 00857 virtual void SetStaticLOD (float m, float a) = 0; 00858 00862 virtual void GetStaticLOD (float& m, float& a) const = 0; 00863 00868 virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0; 00869 00874 virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0; 00875 00885 virtual void SetZBufMode (csZBufMode mode) = 0; 00889 virtual csZBufMode GetZBufMode () const = 0; 00894 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00895 00911 virtual void SetRenderPriority (long rp) = 0; 00915 virtual long GetRenderPriority () const = 0; 00916 00921 virtual void SetRenderPriorityRecursive (long rp) = 0; 00922 00926 virtual iShaderVariableContext* GetSVContext() = 0; 00927 }; 00928 00939 struct iMeshList : public virtual iBase 00940 { 00941 SCF_INTERFACE(iMeshList, 2,0,0); 00943 virtual int GetCount () const = 0; 00944 00946 virtual iMeshWrapper *Get (int n) const = 0; 00947 00949 virtual int Add (iMeshWrapper *obj) = 0; 00950 00952 virtual bool Remove (iMeshWrapper *obj) = 0; 00953 00955 virtual bool Remove (int n) = 0; 00956 00958 virtual void RemoveAll () = 0; 00959 00961 virtual int Find (iMeshWrapper *obj) const = 0; 00962 00968 virtual iMeshWrapper *FindByName (const char *Name) const = 0; 00969 }; 00970 00981 struct iMeshFactoryList : public virtual iBase 00982 { 00983 SCF_INTERFACE(iMeshFactoryList,2,0,0); 00985 virtual int GetCount () const = 0; 00986 00988 virtual iMeshFactoryWrapper *Get (int n) const = 0; 00989 00991 virtual int Add (iMeshFactoryWrapper *obj) = 0; 00992 00994 virtual bool Remove (iMeshFactoryWrapper *obj) = 0; 00995 00997 virtual bool Remove (int n) = 0; 00998 01000 virtual void RemoveAll () = 0; 01001 01003 virtual int Find (iMeshFactoryWrapper *obj) const = 0; 01004 01006 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0; 01007 }; 01008 01016 struct iMeshWrapperIterator : public virtual iBase 01017 { 01018 SCF_INTERFACE(iMeshWrapperIterator,2,0,0); 01020 virtual iMeshWrapper* Next () = 0; 01021 01023 virtual void Reset () = 0; 01024 01026 virtual bool HasNext () const = 0; 01027 }; 01028 01029 01032 #endif // __CS_IENGINE_MESH_H__ 01033
Generated for Crystal Space by doxygen 1.4.7