CrystalSpace

Public API Reference

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 
00135 #define CS_ENTITY_NODECAL 256
00136 
00147 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1
00148 
00155 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2
00156 
00170 struct iMeshDrawCallback : public iBase
00171 {
00172   SCF_INTERFACE (iMeshDrawCallback, 0, 0, 1);
00173 
00178   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00179 };
00180 
00184 struct csHitBeamResult
00185 {
00187   csVector3 isect;
00192   float r;
00194   int polygon_idx;
00199   iMaterialWrapper* material;
00204   int facehit;
00208   bool hit;
00209 };
00210 
00214 struct csScreenBoxResult
00215 {
00217   csBox2 sbox;
00219   csBox3 cbox;
00224   float distance;
00225 };
00226 
00258 struct iMeshWrapper : public virtual iBase
00259 {
00260   SCF_INTERFACE(iMeshWrapper, 2, 2, 0);
00261 
00267   virtual iObject *QueryObject () = 0;
00268 
00270   virtual iMeshObject* GetMeshObject () const = 0;
00272   virtual void SetMeshObject (iMeshObject*) = 0;
00277   virtual iPortalContainer* GetPortalContainer () const = 0;
00278 
00285   virtual iLightingInfo* GetLightingInfo () const = 0;
00286 
00298   virtual iShadowReceiver* GetShadowReceiver () = 0;
00299 
00310   virtual iShadowCaster* GetShadowCaster () = 0;
00311 
00313   virtual iMeshFactoryWrapper *GetFactory () const = 0;
00315   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00316 
00330   virtual void SetLightingUpdate (int flags, int num_lights) = 0;
00331 
00339   virtual iMovable* GetMovable () const = 0;
00340 
00344   virtual iSceneNode* QuerySceneNode () = 0;
00345 
00351   virtual iMeshWrapper* FindChildByName (const char* name) = 0;
00352 
00370   virtual void PlaceMesh () = 0;
00371 
00382   virtual csHitBeamResult HitBeamBBox (const csVector3& start,
00383         const csVector3& end) = 0;
00384 
00390   virtual csHitBeamResult HitBeamOutline (const csVector3& start,
00391         const csVector3& end) = 0;
00392 
00402   virtual csHitBeamResult HitBeamObject (const csVector3& start,
00403         const csVector3& end, bool do_material = false) = 0;
00404 
00413   virtual csHitBeamResult HitBeam (const csVector3& start,
00414         const csVector3& end, bool do_material = false) = 0;
00415 
00424   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00425 
00429   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00430 
00432   virtual int GetDrawCallbackCount () const = 0;
00433 
00435   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00436 
00451   virtual void SetRenderPriority (long rp) = 0;
00455   virtual long GetRenderPriority () const = 0;
00456 
00461   virtual void SetRenderPriorityRecursive (long rp) = 0;
00462 
00481   virtual csFlags& GetFlags () = 0;
00482 
00501   virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0;
00502 
00511   virtual void SetZBufMode (csZBufMode mode) = 0;
00515   virtual csZBufMode GetZBufMode () const = 0;
00520   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00521 
00536   virtual void HardTransform (const csReversibleTransform& t) = 0;
00537 
00543   virtual const csBox3& GetWorldBoundingBox () = 0;
00544 
00550   virtual csBox3 GetTransformedBoundingBox (
00551         const csReversibleTransform& trans) = 0;
00552 
00558   virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0;
00559 
00561   virtual csSphere GetRadius () const = 0;
00562 
00566   virtual void ResetMinMaxRenderDistance () = 0;
00567 
00572   virtual void SetMinimumRenderDistance (float min) = 0;
00573 
00577   virtual float GetMinimumRenderDistance () const = 0;
00578 
00583   virtual void SetMaximumRenderDistance (float min) = 0;
00584 
00588   virtual float GetMaximumRenderDistance () const = 0;
00589 
00595   virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0;
00596 
00601   virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0;
00602 
00608   virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0;
00609 
00614   virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0;
00615 
00622   virtual iLODControl* CreateStaticLOD () = 0;
00623 
00628   virtual void DestroyStaticLOD () = 0;
00629 
00635   virtual iLODControl* GetStaticLOD () = 0;
00636 
00641   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
00642 
00647   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
00648 
00652   virtual iShaderVariableContext* GetSVContext() = 0;
00653 
00659   virtual void AddExtraRenderMesh(csRenderMesh* renderMesh, long priority, 
00660           csZBufMode zBufMode) = 0;
00661 
00665   virtual long GetExtraRenderMeshPriority(size_t idx) const = 0;
00666 
00670   virtual csZBufMode GetExtraRenderMeshZBufMode(size_t idx) const = 0;
00671 
00675   virtual void RemoveExtraRenderMesh(csRenderMesh* renderMesh) = 0;
00676 };
00677 
00703 struct iMeshFactoryWrapper : public virtual iBase
00704 {
00705   SCF_INTERFACE(iMeshFactoryWrapper, 2,0,0);
00707   virtual iObject *QueryObject () = 0;
00709   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00711   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00721   virtual void HardTransform (const csReversibleTransform& t) = 0;
00726   virtual csPtr<iMeshWrapper> CreateMeshWrapper () = 0;
00727 
00747   virtual csFlags& GetFlags () = 0;
00748 
00753   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00758   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00759 
00763   virtual iMeshFactoryList* GetChildren () = 0;
00764 
00768   virtual csReversibleTransform& GetTransform () = 0;
00769 
00773   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00774 
00781   virtual iLODControl* CreateStaticLOD () = 0;
00782 
00786   virtual void DestroyStaticLOD () = 0;
00787 
00793   virtual iLODControl* GetStaticLOD () = 0;
00794 
00802   virtual void SetStaticLOD (float m, float a) = 0;
00803 
00807   virtual void GetStaticLOD (float& m, float& a) const = 0;
00808 
00813   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00814 
00819   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00820 
00830   virtual void SetZBufMode (csZBufMode mode) = 0;
00834   virtual csZBufMode GetZBufMode () const = 0;
00839   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00840 
00856   virtual void SetRenderPriority (long rp) = 0;
00860   virtual long GetRenderPriority () const = 0;
00861 
00866   virtual void SetRenderPriorityRecursive (long rp) = 0;
00867 
00871   virtual iShaderVariableContext* GetSVContext() = 0;
00872 };
00873 
00884 struct iMeshList : public virtual iBase
00885 {
00886   SCF_INTERFACE(iMeshList, 2,0,0);
00888   virtual int GetCount () const = 0;
00889 
00891   virtual iMeshWrapper *Get (int n) const = 0;
00892 
00894   virtual int Add (iMeshWrapper *obj) = 0;
00895 
00897   virtual bool Remove (iMeshWrapper *obj) = 0;
00898 
00900   virtual bool Remove (int n) = 0;
00901 
00903   virtual void RemoveAll () = 0;
00904 
00906   virtual int Find (iMeshWrapper *obj) const = 0;
00907 
00913   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00914 };
00915 
00926 struct iMeshFactoryList : public virtual iBase
00927 {
00928   SCF_INTERFACE(iMeshFactoryList,2,0,0);
00930   virtual int GetCount () const = 0;
00931 
00933   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00934 
00936   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00937 
00939   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00940 
00942   virtual bool Remove (int n) = 0;
00943 
00945   virtual void RemoveAll () = 0;
00946 
00948   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00949 
00951   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00952 };
00953 
00961 struct iMeshWrapperIterator : public virtual iBase
00962 {
00963   SCF_INTERFACE(iMeshWrapperIterator,2,0,0);
00965   virtual iMeshWrapper* Next () = 0;
00966 
00968   virtual void Reset () = 0;
00969 
00971   virtual bool HasNext () const = 0;
00972 };
00973 
00974 
00977 #endif // __CS_IENGINE_MESH_H__
00978 

Generated for Crystal Space 1.2.1 by doxygen 1.5.3