iengine/mesh.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

- 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 #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
    00056 class csEllipsoid;
    00057 class csFlags;
    00058 class csReversibleTransform;
    00059
    00070 #define CS_ENTITY_DETAIL 2
    00071
    00080 #define CS_ENTITY_CAMERA 4
    00081
    00089 #define CS_ENTITY_INVISIBLEMESH 8
    00090
    00097 #define CS_ENTITY_INVISIBLE (CS_ENTITY_INVISIBLEMESH+CS_ENTITY_NOHITBEAM)
    00098
    00104 #define CS_ENTITY_NOSHADOWCAST 16
    00105 #define CS_ENTITY_NOSHADOWS   CS_ENTITY_NOSHADOWCAST
    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
    00145 #define CS_ENTITY_NOSHADOWRECEIVE 1024
    00146
    00151 #define CS_ENTITY_LIMITEDSHADOWCAST 2048
    00152
    00156 #define CS_ENTITY_ALWAYSVISIBLE 4096
    00157
    00171 struct iMeshDrawCallback : public virtual iBase
    00172 {
    00173   SCF_INTERFACE (iMeshDrawCallback, 0, 0, 1);
    00174
    00179   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
    00180 };
    00181
    00186 struct csHitBeamResult
    00187 {
    00189   csVector3 isect;
    00194   float r;
    00196   int polygon_idx;
    00201   iMaterialWrapper* material;
    00206   int facehit;
    00210   bool hit;
    00211
    00212   csHitBeamResult() : material(0), hit(false)
    00213   {
    00214   }
    00215 };
    00216
    00220 struct csScreenBoxResult
    00221 {
    00223   csBox2 sbox;
    00225   csBox3 cbox;
    00230   float distance;
    00231 };
    00232
    00263 struct iMeshWrapper : public virtual iBase
    00264 {
    00265   SCF_INTERFACE(iMeshWrapper, 5, 0, 0);
    00266
    00272   virtual iObject *QueryObject () = 0;
    00273
    00275   virtual iMeshObject* GetMeshObject () const = 0;
    00277   virtual void SetMeshObject (iMeshObject*) = 0;
    00282   virtual iPortalContainer* GetPortalContainer () const = 0;
    00283
    00285   virtual iMeshFactoryWrapper *GetFactory () const = 0;
    00287   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
    00288
    00296   virtual iMovable* GetMovable () const = 0;
    00297
    00301   virtual iSceneNode* QuerySceneNode () = 0;
    00302
    00308   virtual iMeshWrapper* FindChildByName (const char* name) = 0;
    00309
    00327   virtual void PlaceMesh () = 0;
    00328
    00339   virtual csHitBeamResult HitBeamBBox (const csVector3& start,
    00340         const csVector3& end) = 0;
    00341
    00347   virtual csHitBeamResult HitBeamOutline (const csVector3& start,
    00348         const csVector3& end) = 0;
    00349
    00359   virtual csHitBeamResult HitBeamObject (const csVector3& start,
    00360         const csVector3& end, bool do_material = false) = 0;
    00361
    00371   virtual csHitBeamResult HitBeam (const csVector3& start,
    00372         const csVector3& end, bool do_material = false) = 0;
    00373
    00382   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
    00383
    00387   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
    00388
    00390   virtual int GetDrawCallbackCount () const = 0;
    00391
    00393   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
    00394
    00409   virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0;
    00413   virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0;
    00414
    00419   virtual void SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp) = 0;
    00420
    00439   virtual csFlags& GetFlags () = 0;
    00440
    00459   virtual void SetFlagsRecursive (uint32 mask, uint32 flags = ~0) = 0;
    00460
    00469   virtual void SetZBufMode (csZBufMode mode) = 0;
    00473   virtual csZBufMode GetZBufMode () const = 0;
    00478   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
    00479
    00494   virtual void HardTransform (const csReversibleTransform& t) = 0;
    00495
    00501   virtual const csBox3& GetWorldBoundingBox () = 0;
    00502
    00508   virtual csBox3 GetTransformedBoundingBox (
    00509         const csReversibleTransform& trans) = 0;
    00510
    00516   virtual csScreenBoxResult GetScreenBoundingBox (iCamera* camera) = 0;
    00517
    00519   virtual csSphere GetRadius () const = 0;
    00520
    00524   virtual void ResetMinMaxRenderDistance () = 0;
    00525
    00530   virtual void SetMinimumRenderDistance (float min) = 0;
    00531
    00535   virtual float GetMinimumRenderDistance () const = 0;
    00536
    00541   virtual void SetMaximumRenderDistance (float min) = 0;
    00542
    00546   virtual float GetMaximumRenderDistance () const = 0;
    00547
    00553   virtual void SetMinimumRenderDistanceVar (iSharedVariable* min) = 0;
    00554
    00559   virtual iSharedVariable* GetMinimumRenderDistanceVar () const = 0;
    00560
    00566   virtual void SetMaximumRenderDistanceVar (iSharedVariable* min) = 0;
    00567
    00572   virtual iSharedVariable* GetMaximumRenderDistanceVar () const = 0;
    00573
    00580   virtual iLODControl* CreateStaticLOD () = 0;
    00581
    00586   virtual void DestroyStaticLOD () = 0;
    00587
    00593   virtual iLODControl* GetStaticLOD () = 0;
    00594
    00599   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
    00600
    00605   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
    00606
    00610   virtual iShaderVariableContext* GetSVContext() = 0;
    00611
    00615   virtual csRenderMesh** GetRenderMeshes (int& num, iRenderView* rview,
    00616     uint32 frustum_mask) = 0;
    00617
    00625   virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0;
    00626
    00635   CS_DEPRECATED_METHOD_MSG("Pass zbuf mode in render mesh")
    00636   virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh,
    00637     csZBufMode zBufMode) = 0;
    00638
    00640   virtual CS::Graphics::RenderMesh* GetExtraRenderMesh (size_t idx) const = 0;
    00641
    00643   virtual size_t GetExtraRenderMeshCount () const = 0;
    00644
    00649   CS_DEPRECATED_METHOD_MSG("Obtain zbuf mode from render mesh")
    00650   virtual csZBufMode GetExtraRenderMeshZBufMode (size_t idx) const = 0;
    00651
    00653
    00656   virtual void RemoveExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0;
    00657   virtual void RemoveExtraRenderMesh (size_t idx) = 0;
    00659
    00664   virtual csShaderVariable* AddInstance (csVector3& position, csMatrix3& rotation) = 0;
    00665
    00669   virtual void RemoveInstance (csShaderVariable* instance) = 0;
    00670 };
    00671
    00697 struct iMeshFactoryWrapper : public virtual iBase
    00698 {
    00699   SCF_INTERFACE(iMeshFactoryWrapper, 3, 0, 1);
    00701   virtual iObject *QueryObject () = 0;
    00703   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
    00705   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
    00715   virtual void HardTransform (const csReversibleTransform& t) = 0;
    00720   virtual csPtr<iMeshWrapper> CreateMeshWrapper () = 0;
    00721
    00741   virtual csFlags& GetFlags () = 0;
    00742
    00747   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
    00752   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
    00753
    00757   virtual iMeshFactoryList* GetChildren () = 0;
    00758
    00762   virtual csReversibleTransform& GetTransform () = 0;
    00763
    00767   virtual void SetTransform (const csReversibleTransform& tr) = 0;
    00768
    00775   virtual iLODControl* CreateStaticLOD () = 0;
    00776
    00780   virtual void DestroyStaticLOD () = 0;
    00781
    00787   virtual iLODControl* GetStaticLOD () = 0;
    00788
    00796   virtual void SetStaticLOD (float m, float a) = 0;
    00797
    00801   virtual void GetStaticLOD (float& m, float& a) const = 0;
    00802
    00807   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
    00808
    00813   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
    00814
    00824   virtual void SetZBufMode (csZBufMode mode) = 0;
    00828   virtual csZBufMode GetZBufMode () const = 0;
    00833   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
    00834
    00850   virtual void SetRenderPriority (CS::Graphics::RenderPriority rp) = 0;
    00854   virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0;
    00855
    00860   virtual void SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp) = 0;
    00861
    00865   virtual iShaderVariableContext* GetSVContext() = 0;
    00866
    00870   virtual void SetInstanceFactory(iMeshFactoryWrapper* meshfact) = 0;
    00871
    00875   virtual iMeshFactoryWrapper* GetInstanceFactory() const = 0;
    00876
    00880   virtual void AddInstance(csVector3& position, csMatrix3& rotation) = 0;
    00881
    00885   virtual csShaderVariable* GetInstances() const = 0;
    00886
    00894   virtual size_t AddExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0;
    00895
    00897   virtual CS::Graphics::RenderMesh* GetExtraRenderMesh (size_t idx) const = 0;
    00898
    00900   virtual size_t GetExtraRenderMeshCount () const = 0;
    00901
    00903
    00906   virtual void RemoveExtraRenderMesh (CS::Graphics::RenderMesh* renderMesh) = 0;
    00907   virtual void RemoveExtraRenderMesh (size_t idx) = 0;
    00909 };
    00910
    00921 struct iMeshList : public virtual iBase
    00922 {
    00923   SCF_INTERFACE(iMeshList, 2,0,0);
    00925   virtual int GetCount () const = 0;
    00926
    00928   virtual iMeshWrapper *Get (int n) const = 0;
    00929
    00931   virtual int Add (iMeshWrapper *obj) = 0;
    00932
    00934   virtual bool Remove (iMeshWrapper *obj) = 0;
    00935
    00937   virtual bool Remove (int n) = 0;
    00938
    00940   virtual void RemoveAll () = 0;
    00941
    00943   virtual int Find (iMeshWrapper *obj) const = 0;
    00944
    00950   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
    00951 };
    00952
    00963 struct iMeshFactoryList : public virtual iBase
    00964 {
    00965   SCF_INTERFACE(iMeshFactoryList,2,0,0);
    00967   virtual int GetCount () const = 0;
    00968
    00970   virtual iMeshFactoryWrapper *Get (int n) const = 0;
    00971
    00973   virtual int Add (iMeshFactoryWrapper *obj) = 0;
    00974
    00976   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
    00977
    00979   virtual bool Remove (int n) = 0;
    00980
    00982   virtual void RemoveAll () = 0;
    00983
    00985   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
    00986
    00988   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
    00989 };
    00990
    00998 struct iMeshFactoryWrapperIterator : public virtual iBase
    00999 {
    01000   SCF_INTERFACE(iMeshFactoryWrapperIterator,1,0,0);
    01002   virtual iMeshFactoryWrapper* Next () = 0;
    01003
    01005   virtual void Reset () = 0;
    01006
    01008   virtual bool HasNext () const = 0;
    01009 };
    01010
    01018 struct iMeshWrapperIterator : public virtual iBase
    01019 {
    01020   SCF_INTERFACE(iMeshWrapperIterator,2,0,0);
    01022   virtual iMeshWrapper* Next () = 0;
    01023
    01025   virtual void Reset () = 0;
    01026
    01028   virtual bool HasNext () const = 0;
    01029 };
    01030
    01031
    01034 #endif // __CS_IENGINE_MESH_H__
    01035