## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# 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
    00164 struct iMeshDrawCallback : public iBase
    00165 {
    00170   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
    00171 };
    00172
    00176 struct csHitBeamResult
    00177 {
    00179   csVector3 isect;
    00184   float r;
    00186   int polygon_idx;
    00191   iMaterialWrapper* material;
    00196   int facehit;
    00200   bool hit;
    00201 };
    00202
    00206 struct csScreenBoxResult
    00207 {
    00209   csBox2 sbox;
    00211   csBox3 cbox;
    00216   float distance;
    00217 };
    00218
    00250 struct iMeshWrapper : public virtual iBase
    00251 {
    00252   SCF_INTERFACE(iMeshWrapper, 2, 0, 0);
    00253
    00259   virtual iObject *QueryObject () = 0;
    00260
    00262   virtual iMeshObject* GetMeshObject () const = 0;
    00264   virtual void SetMeshObject (iMeshObject*) = 0;
    00269   virtual iPortalContainer* GetPortalContainer () const = 0;
    00270
    00277   virtual iLightingInfo* GetLightingInfo () const = 0;
    00278
    00290   virtual iShadowReceiver* GetShadowReceiver () = 0;
    00291
    00302   virtual iShadowCaster* GetShadowCaster () = 0;
    00303
    00305   virtual iMeshFactoryWrapper *GetFactory () const = 0;
    00307   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
    00308
    00322   virtual void SetLightingUpdate (int flags, int num_lights) = 0;
    00323
    00331   virtual iMovable* GetMovable () const = 0;
    00332
    00336   virtual iSceneNode* QuerySceneNode () = 0;
    00337
    00343   virtual iMeshWrapper* FindChildByName (const char* name) = 0;
    00344
    00362   virtual void PlaceMesh () = 0;
    00363
    00374   CS_DEPRECATED_METHOD virtual int HitBeamBBox (const csVector3& start,
    00375         const csVector3& end, csVector3& isect, float* pr) = 0;
    00376
    00382   CS_DEPRECATED_METHOD virtual bool HitBeamOutline (const csVector3& start,
    00383         const csVector3& end, csVector3& isect, float* pr) = 0;
    00384
    00391   CS_DEPRECATED_METHOD virtual bool HitBeamObject (const csVector3& start,
    00392         const csVector3& end, csVector3& isect, float* pr,
    00393         int* polygon_idx = 0) = 0;
    00394
    00400   CS_DEPRECATED_METHOD virtual bool HitBeam (const csVector3& start,
    00401         const csVector3& end, csVector3& isect, float* pr) = 0;
    00402
    00413   virtual csHitBeamResult HitBeamBBox (const csVector3& start,
    00414         const csVector3& end) = 0;
    00415
    00421   virtual csHitBeamResult HitBeamOutline (const csVector3& start,
    00422         const csVector3& end) = 0;
    00423
    00433   virtual csHitBeamResult HitBeamObject (const csVector3& start,
    00434         const csVector3& end, bool do_material = false) = 0;
    00435
    00441   virtual csHitBeamResult HitBeam (const csVector3& start,
    00442         const csVector3& end) = 0;
    00443
    00452   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
    00453
    00457   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
    00458
    00460   virtual int GetDrawCallbackCount () const = 0;
    00461
    00463   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
    00464
    00479   virtual void SetRenderPriority (long rp) = 0;
    00483   virtual long GetRenderPriority () const = 0;
    00484
    00489   virtual void SetRenderPriorityRecursive (long rp) = 0;
    00490
    00509   virtual csFlags& GetFlags () = 0;
    00510
    00529   virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0;
    00530
    00539   virtual void SetZBufMode (csZBufMode mode) = 0;
    00543   virtual csZBufMode GetZBufMode () const = 0;
    00548   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
    00549
    00564   virtual void HardTransform (const csReversibleTransform& t) = 0;
    00565
    00572   CS_DEPRECATED_METHOD virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
    00573
    00580   CS_DEPRECATED_METHOD virtual void GetTransformedBoundingBox (
    00581         const csReversibleTransform& trans, csBox3& cbox) = 0;
    00582
    00590   CS_DEPRECATED_METHOD virtual float GetScreenBoundingBox (iCamera* camera,
    00591         csBox2& sbox, csBox3& cbox) = 0;
    00592
    00598   virtual const csBox3& GetWorldBoundingBox () = 0;
    00599
    00605   virtual csBox3 GetTransformedBoundingBox (
    00606         const csReversibleTransform& trans) = 0;
    00607
    00613   virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0;
    00614
    00619   CS_DEPRECATED_METHOD virtual void GetRadius (csVector3& rad,
    00620         csVector3& cent) const = 0;
    00622   virtual csEllipsoid GetRadius () const = 0;
    00623
    00627   virtual void ResetMinMaxRenderDistance () = 0;
    00628
    00633   virtual void SetMinimumRenderDistance (float min) = 0;
    00634
    00638   virtual float GetMinimumRenderDistance () const = 0;
    00639
    00644   virtual void SetMaximumRenderDistance (float min) = 0;
    00645
    00649   virtual float GetMaximumRenderDistance () const = 0;
    00650
    00656   virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0;
    00657
    00662   virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0;
    00663
    00669   virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0;
    00670
    00675   virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0;
    00676
    00683   virtual iLODControl* CreateStaticLOD () = 0;
    00684
    00689   virtual void DestroyStaticLOD () = 0;
    00690
    00696   virtual iLODControl* GetStaticLOD () = 0;
    00697
    00702   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
    00703
    00708   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
    00709
    00713   virtual iShaderVariableContext* GetSVContext() = 0;
    00714 };
    00715
    00741 struct iMeshFactoryWrapper : public virtual iBase
    00742 {
    00743   SCF_INTERFACE(iMeshFactoryWrapper, 2,0,0);
    00745   virtual iObject *QueryObject () = 0;
    00747   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
    00749   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
    00759   virtual void HardTransform (const csReversibleTransform& t) = 0;
    00764   virtual iMeshWrapper* CreateMeshWrapper () = 0;
    00765
    00770   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
    00775   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
    00776
    00780   virtual iMeshFactoryList* GetChildren () = 0;
    00781
    00785   virtual csReversibleTransform& GetTransform () = 0;
    00786
    00790   virtual void SetTransform (const csReversibleTransform& tr) = 0;
    00791
    00798   virtual iLODControl* CreateStaticLOD () = 0;
    00799
    00803   virtual void DestroyStaticLOD () = 0;
    00804
    00810   virtual iLODControl* GetStaticLOD () = 0;
    00811
    00819   virtual void SetStaticLOD (float m, float a) = 0;
    00820
    00824   virtual void GetStaticLOD (float& m, float& a) const = 0;
    00825
    00830   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
    00831
    00836   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
    00837
    00847   virtual void SetZBufMode (csZBufMode mode) = 0;
    00851   virtual csZBufMode GetZBufMode () const = 0;
    00856   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
    00857
    00873   virtual void SetRenderPriority (long rp) = 0;
    00877   virtual long GetRenderPriority () const = 0;
    00878
    00883   virtual void SetRenderPriorityRecursive (long rp) = 0;
    00884
    00888   virtual iShaderVariableContext* GetSVContext() = 0;
    00889 };
    00890
    00901 struct iMeshList : public virtual iBase
    00902 {
    00903   SCF_INTERFACE(iMeshList, 2,0,0);
    00905   virtual int GetCount () const = 0;
    00906
    00908   virtual iMeshWrapper *Get (int n) const = 0;
    00909
    00911   virtual int Add (iMeshWrapper *obj) = 0;
    00912
    00914   virtual bool Remove (iMeshWrapper *obj) = 0;
    00915
    00917   virtual bool Remove (int n) = 0;
    00918
    00920   virtual void RemoveAll () = 0;
    00921
    00923   virtual int Find (iMeshWrapper *obj) const = 0;
    00924
    00930   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
    00931 };
    00932
    00943 struct iMeshFactoryList : public virtual iBase
    00944 {
    00945   SCF_INTERFACE(iMeshFactoryList,2,0,0);
    00947   virtual int GetCount () const = 0;
    00948
    00950   virtual iMeshFactoryWrapper *Get (int n) const = 0;
    00951
    00953   virtual int Add (iMeshFactoryWrapper *obj) = 0;
    00954
    00956   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
    00957
    00959   virtual bool Remove (int n) = 0;
    00960
    00962   virtual void RemoveAll () = 0;
    00963
    00965   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
    00966
    00968   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
    00969 };
    00970
    00978 struct iMeshWrapperIterator : public virtual iBase
    00979 {
    00980   SCF_INTERFACE(iMeshWrapperIterator,2,0,0);
    00982   virtual iMeshWrapper* Next () = 0;
    00983
    00985   virtual void Reset () = 0;
    00986
    00988   virtual bool HasNext () const = 0;
    00989 };
    00990
    00991
    00994 #endif // __CS_IENGINE_MESH_H__
    00995