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 #include "imesh/object.h" 00038 00039 struct iCamera; 00040 struct iLODControl; 00041 struct iMeshFactoryList; 00042 struct iMeshFactoryWrapper; 00043 struct iMeshList; 00044 struct iMeshObject; 00045 struct iMeshObjectFactory; 00046 struct iMeshWrapper; 00047 struct iMovable; 00048 struct iObject; 00049 struct iPortalContainer; 00050 struct iRenderView; 00051 struct iShaderVariableContext; 00052 struct iSharedVariable; 00053 struct iSceneNode; 00054 struct iMaterialWrapper; 00055 struct iSector; 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_NOSHADOWCAST 16 00106 #define CS_ENTITY_NOSHADOWS CS_ENTITY_NOSHADOWCAST 00107 00113 #define CS_ENTITY_NOLIGHTING 32 00114 00119 #define CS_ENTITY_NOHITBEAM 64 00120 00130 #define CS_ENTITY_NOCLIP 128 00131 00135 #define CS_ENTITY_NODECAL 256 00136 00140 #define CS_ENTITY_STATICLIT 512 00141 00146 #define CS_ENTITY_NOSHADOWRECEIVE 1024 00147 00152 #define CS_ENTITY_LIMITEDSHADOWCAST 2048 00153 00157 #define CS_ENTITY_ALWAYSVISIBLE 4096 00158 00172 struct iMeshDrawCallback : public virtual iBase 00173 { 00174 SCF_INTERFACE (iMeshDrawCallback, 0, 0, 1); 00175 00180 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0; 00181 }; 00182 00187 struct csHitBeamResult 00188 { 00190 csVector3 isect; 00195 float r; 00197 int polygon_idx; 00202 iMaterialWrapper* material; 00207 int facehit; 00211 bool hit; 00212 00213 csHitBeamResult() : material(0), hit(false) 00214 { 00215 } 00216 }; 00217 00221 struct csScreenBoxResult 00222 { 00224 csBox2 sbox; 00226 csBox3 cbox; 00231 float distance; 00232 }; 00233 00264 struct iMeshWrapper : public virtual iBase 00265 { 00266 SCF_INTERFACE(iMeshWrapper, 7, 0, 0); 00267 00273 virtual iObject *QueryObject () = 0; 00274 00276 virtual iMeshObject* GetMeshObject () const = 0; 00278 virtual void SetMeshObject (iMeshObject*) = 0; 00283 virtual iPortalContainer* GetPortalContainer () const = 0; 00284 00286 virtual iMeshFactoryWrapper *GetFactory () const = 0; 00288 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0; 00289 00297 virtual iMovable* GetMovable () const = 0; 00298 00302 virtual iSceneNode* QuerySceneNode () = 0; 00303 00309 virtual iMeshWrapper* FindChildByName (const char* name) = 0; 00310 00328 virtual void PlaceMesh () = 0; 00329 00340 virtual csHitBeamResult HitBeamBBox (const csVector3& start, 00341 const csVector3& end) = 0; 00342 00348 virtual csHitBeamResult HitBeamOutline (const csVector3& start, 00349 const csVector3& end) = 0; 00350 00361 virtual csHitBeamResult HitBeamObject (const csVector3& start, 00362 const csVector3& end, bool do_material = false, bool bf = false) = 0; 00363 00375 virtual csHitBeamResult HitBeam (const csVector3& start, 00376 const csVector3& end, bool do_material = false, bool bf = false) = 0; 00377 00386 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0; 00387 00391 virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0; 00392 00394 virtual int GetDrawCallbackCount () const = 0; 00395 00397 virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0; 00398 00413 virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0; 00417 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00418 00423 virtual void SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp) = 0; 00424 00443 virtual csFlags& GetFlags () = 0; 00444 00463 virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0; 00464 00473 virtual void SetZBufMode (csZBufMode mode) = 0; 00477 virtual csZBufMode GetZBufMode () const = 0; 00482 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00483 00498 virtual void HardTransform (const csReversibleTransform& t) = 0; 00499 00505 virtual const csBox3& GetWorldBoundingBox () = 0; 00506 00512 virtual csBox3 GetTransformedBoundingBox ( 00513 const csReversibleTransform& trans) = 0; 00514 00520 virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0; 00521 00523 virtual csSphere GetRadius () const = 0; 00524 00528 virtual void ResetMinMaxRenderDistance () = 0; 00529 00534 virtual void SetMinimumRenderDistance (float min) = 0; 00535 00539 virtual float GetMinimumRenderDistance () const = 0; 00540 00545 virtual void SetMaximumRenderDistance (float min) = 0; 00546 00550 virtual float GetMaximumRenderDistance () const = 0; 00551 00557 virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0; 00558 00563 virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0; 00564 00570 virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0; 00571 00576 virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0; 00577 00584 virtual iLODControl* CreateStaticLOD () = 0; 00585 00590 virtual void DestroyStaticLOD () = 0; 00591 00597 virtual iLODControl* GetStaticLOD () = 0; 00598 00602 virtual iShaderVariableContext* GetSVContext() = 0; 00603 00611 virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0; 00612 00621 CS_DEPRECATED_METHOD_MSG("Pass zbuf mode in render mesh") 00622 virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh, 00623 csZBufMode zBufMode) = 0; 00624 00626 virtual CS::Graphics::RenderMesh* GetExtraRenderMesh (size_t idx) const = 0; 00627 00629 virtual size_t GetExtraRenderMeshCount () const = 0; 00630 00635 CS_DEPRECATED_METHOD_MSG("Obtain zbuf mode from render mesh") 00636 virtual csZBufMode GetExtraRenderMeshZBufMode (size_t idx) const = 0; 00637 00639 00642 virtual void RemoveExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0; 00643 virtual void RemoveExtraRenderMesh (size_t idx) = 0; 00645 00650 virtual csShaderVariable* AddInstance (csVector3& position, csMatrix3& rotation) = 0; 00651 00655 virtual void RemoveInstance (csShaderVariable* instance) = 0; 00656 00663 virtual void RemoveFromSectors (iSector* sector = 0) = 0; 00664 }; 00665 00691 struct iMeshFactoryWrapper : public virtual iBase 00692 { 00693 SCF_INTERFACE(iMeshFactoryWrapper, 4, 0, 1); 00694 00696 virtual iObject *QueryObject () = 0; 00698 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0; 00700 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0; 00710 virtual void HardTransform (const csReversibleTransform& t) = 0; 00715 virtual csPtr<iMeshWrapper> CreateMeshWrapper () = 0; 00716 00736 virtual csFlags& GetFlags () = 0; 00737 00742 virtual iMeshFactoryWrapper* GetParentContainer () const = 0; 00747 virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0; 00748 00752 virtual iMeshFactoryList* GetChildren () = 0; 00753 00757 virtual csReversibleTransform& GetTransform () = 0; 00758 00762 virtual void SetTransform (const csReversibleTransform& tr) = 0; 00763 00770 virtual iLODControl* CreateStaticLOD () = 0; 00771 00775 virtual void DestroyStaticLOD () = 0; 00776 00782 virtual iLODControl* GetStaticLOD () = 0; 00783 00791 virtual void SetStaticLOD (float m, float a) = 0; 00792 00796 virtual void GetStaticLOD (float& m, float& a) const = 0; 00797 00807 virtual void SetZBufMode (csZBufMode mode) = 0; 00811 virtual csZBufMode GetZBufMode () const = 0; 00816 virtual void SetZBufModeRecursive (csZBufMode mode) = 0; 00817 00833 virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0; 00837 virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0; 00838 00843 virtual void SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp) = 0; 00844 00848 virtual iShaderVariableContext* GetSVContext() = 0; 00849 00853 virtual void SetInstanceFactory(iMeshFactoryWrapper* meshfact) = 0; 00854 00858 virtual iMeshFactoryWrapper* GetInstanceFactory() const = 0; 00859 00863 virtual void AddInstance(csVector3& position, csMatrix3& rotation) = 0; 00864 00868 virtual csShaderVariable* GetInstances() const = 0; 00869 00877 virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0; 00878 00880 virtual CS::Graphics::RenderMesh* GetExtraRenderMesh (size_t idx) const = 0; 00881 00883 virtual size_t GetExtraRenderMeshCount () const = 0; 00884 00886 00889 virtual void RemoveExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0; 00890 virtual void RemoveExtraRenderMesh (size_t idx) = 0; 00892 }; 00893 00904 struct iMeshList : public virtual iBase 00905 { 00906 SCF_INTERFACE(iMeshList, 2,0,0); 00908 virtual int GetCount () const = 0; 00909 00911 virtual iMeshWrapper *Get (int n) const = 0; 00912 00914 virtual int Add (iMeshWrapper *obj) = 0; 00915 00917 virtual bool Remove (iMeshWrapper *obj) = 0; 00918 00920 virtual bool Remove (int n) = 0; 00921 00923 virtual void RemoveAll () = 0; 00924 00926 virtual int Find (iMeshWrapper *obj) const = 0; 00927 00933 virtual iMeshWrapper *FindByName (const char *Name) const = 0; 00934 }; 00935 00946 struct iMeshFactoryList : public virtual iBase 00947 { 00948 SCF_INTERFACE(iMeshFactoryList,2,0,0); 00950 virtual int GetCount () const = 0; 00951 00953 virtual iMeshFactoryWrapper *Get (int n) const = 0; 00954 00956 virtual int Add (iMeshFactoryWrapper *obj) = 0; 00957 00959 virtual bool Remove (iMeshFactoryWrapper *obj) = 0; 00960 00962 virtual bool Remove (int n) = 0; 00963 00965 virtual void RemoveAll () = 0; 00966 00968 virtual int Find (iMeshFactoryWrapper *obj) const = 0; 00969 00971 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0; 00972 }; 00973 00981 struct iMeshFactoryWrapperIterator : public virtual iBase 00982 { 00983 SCF_INTERFACE(iMeshFactoryWrapperIterator,1,0,0); 00985 virtual iMeshFactoryWrapper* Next () = 0; 00986 00988 virtual void Reset () = 0; 00989 00991 virtual bool HasNext () const = 0; 00992 }; 00993 01001 struct iMeshWrapperIterator : public virtual iBase 01002 { 01003 SCF_INTERFACE(iMeshWrapperIterator,2,0,0); 01005 virtual iMeshWrapper* Next () = 0; 01006 01008 virtual void Reset () = 0; 01009 01011 virtual bool HasNext () const = 0; 01012 }; 01013 01014 01017 #endif // __CS_IENGINE_MESH_H__ 01018
Generated for Crystal Space 2.1 by doxygen 1.6.1
