CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iso.h

00001 /*
00002     Copyright (C) 2001 by W.C.A. Wijngaards
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_IVARIA_ISO_H__
00020 #define __CS_IVARIA_ISO_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csutil/cscolor.h"
00024 #include "csutil/flags.h"
00025 #include "csgeom/csrect.h"
00026 #include "csgeom/math2d.h"
00027 #include "csgeom/math3d.h"
00028 #include "ivideo/graph3d.h"
00029 
00030 class csMatrix3;
00031 struct iObjectRegistry;
00032 struct iEvent;
00033 struct iGraphics2D;
00034 struct iGraphics3D;
00035 struct iTextureManager;
00036 struct iMaterial;
00037 struct iMaterialHandle;
00038 struct iMaterialWrapper;
00039 struct iMaterialList;
00040 struct iMeshFactoryList;
00041 struct iMeshFactoryWrapper;
00042 struct iClipper2D;
00043 struct iIsoWorld;
00044 struct iIsoView;
00045 struct iIsoRenderView;
00046 struct iIsoSprite;
00047 struct iIsoMeshSprite;
00048 struct iIsoGrid;
00049 struct iIsoCell;
00050 struct iIsoLight;
00051 struct G3DPolygonDPFX;
00052 struct iMeshObject;
00053 struct iCamera;
00054 struct iLight;
00055 struct iMeshObjectFactory;
00056 
00057 SCF_VERSION (iGridChangeCallback, 0, 0, 1);
00058 
00062 struct iGridChangeCallback : public iBase
00063 {
00065   virtual void GridChange (iIsoSprite* spr) = 0;
00066 };
00067 
00068 SCF_VERSION (iIsoEngine, 0, 1, 1);
00069 
00073 struct iIsoEngine : public iBase
00074 {
00076   virtual iObjectRegistry* GetObjectRegistry() const = 0;
00078   virtual iGraphics2D* GetG2D() const = 0;
00080   virtual iGraphics3D* GetG3D() const = 0;
00082   virtual iTextureManager* GetTextureManager() const = 0;
00083 
00085   virtual int GetBeginDrawFlags () const = 0;
00086 
00088   virtual iIsoWorld* CreateWorld() = 0;
00090   virtual iIsoView* CreateView(iIsoWorld *world) = 0;
00092   virtual iIsoLight* CreateLight() = 0;
00094   virtual iIsoSprite* CreateSprite() = 0;
00096   virtual iIsoMeshSprite* CreateMeshSprite() = 0;
00098   virtual iIsoSprite* CreateFloorSprite(const csVector3& pos, float w,
00099     float h) = 0;
00101   virtual iIsoSprite* CreateFrontSprite(const csVector3& pos, float w,
00102     float h) = 0;
00104   virtual iIsoSprite* CreateZWallSprite(const csVector3& pos, float w,
00105     float h) = 0;
00107   virtual iIsoSprite* CreateXWallSprite(const csVector3& pos, float w,
00108     float h) = 0;
00109 
00111   virtual iMaterialList* GetMaterialList () = 0;
00116   virtual iMaterialWrapper *CreateMaterialWrapper(const char *vfsfilename,
00117     const char *materialname) = 0;
00118 
00120   virtual iMeshFactoryList* GetMeshFactories () = 0;
00122   virtual iMeshFactoryWrapper *CreateMeshFactory(const char* classId,
00123     const char *name) = 0;
00125   virtual iMeshFactoryWrapper *CreateMeshFactory(const char *name) = 0;
00126 
00127 };
00128 
00129 SCF_VERSION (iIsoWorld, 0, 0, 1);
00130 
00134 struct iIsoWorld : public iBase
00135 {
00137   virtual void AddSprite(iIsoSprite *sprite) = 0;
00139   virtual void RemoveSprite(iIsoSprite *sprite) = 0;
00141   virtual void MoveSprite(iIsoSprite *sprite, const csVector3& oldpos,
00142     const csVector3& newpos) = 0;
00143 
00145   virtual iIsoGrid* CreateGrid(int width, int height) = 0;
00147   virtual iIsoGrid* FindGrid(const csVector3& pos) = 0;
00148 
00150   virtual void Draw(iIsoRenderView *rview) = 0;
00151 };
00152 
00153 SCF_VERSION (iIsoGrid, 0, 0, 1);
00154 
00161 struct iIsoGrid : public iBase
00162 {
00164   virtual iIsoWorld* GetWorld() const = 0;
00172   virtual void SetSpace(int minx, int minz, float miny = -1.0,
00173     float maxy = +10.0) = 0;
00175   virtual bool Contains(const csVector3& pos) = 0;
00177   virtual const csBox3& GetBox() const = 0;
00179   virtual int GetWidth() const = 0;
00181   virtual int GetHeight() const = 0;
00183   virtual void GetGridOffset(int& minx, int& miny) const = 0;
00185   virtual iIsoCell* GetGridCell(int x, int y) = 0;
00186 
00192   virtual void SetGroundMult(int multx, int multy) = 0;
00194   virtual int GetGroundMultX() const = 0;
00196   virtual int GetGroundMultY() const = 0;
00202   virtual void SetGroundValue(int x, int y, int gr_x, int gr_y, float val) = 0;
00204   virtual float GetGroundValue(int x, int y, int gr_x, int gr_y) = 0;
00206   virtual float GetGroundValue(int x, int y) = 0;
00208   virtual bool GroundHitBeam(const csVector3& src, const csVector3& dest) = 0;
00209 
00211   virtual void SetAllLight(const csColor& color) = 0;
00213   virtual void SetAllStaticLight(const csColor& color) = 0;
00215   virtual void RegisterLight(iIsoLight *light) = 0;
00217   virtual void UnRegisterLight(iIsoLight *light) = 0;
00219   virtual void RegisterDynamicLight(iIsoLight *light) = 0;
00221   virtual void UnRegisterDynamicLight(iIsoLight *light) = 0;
00223   virtual void GetFakeLights(const csVector3& pos, iLight **& flights,
00224     int& num) = 0;
00225 
00227   virtual void AddSprite(iIsoSprite *sprite) = 0;
00229   virtual void AddSprite(iIsoSprite *sprite, const csVector3& pos) = 0;
00231   virtual void RemoveSprite(iIsoSprite *sprite) = 0;
00236   virtual void MoveSprite(iIsoSprite *sprite, const csVector3& oldpos,
00237     const csVector3& newpos) = 0;
00238 
00240   virtual void Draw(iIsoRenderView *rview) = 0;
00241 };
00242 
00243 SCF_VERSION (iIsoCellTraverseCallback, 0, 0, 1);
00244 
00248 struct iIsoCellTraverseCallback : public iBase
00249 {
00251   virtual void Traverse (iIsoSprite* spr) = 0;
00252 };
00253 
00254 SCF_VERSION (iIsoCell, 0, 0, 2);
00255 
00259 struct iIsoCell : public iBase
00260 {
00262   virtual void AddSprite(iIsoSprite *sprite, const csVector3& pos) = 0;
00264   virtual void RemoveSprite(iIsoSprite *sprite, const csVector3& pos) = 0;
00266   virtual void Draw(iIsoRenderView *rview) = 0;
00268   virtual void Traverse(iIsoCellTraverseCallback* func) = 0;
00269 };
00270 
00271 SCF_VERSION (iIsoView, 0, 0, 1);
00272 
00288 struct iIsoView : public iBase
00289 {
00291   virtual iIsoEngine *GetEngine() const = 0;
00292 
00294   virtual void SetWorld(iIsoWorld* world) = 0;
00296   virtual iIsoWorld* GetWorld() const = 0;
00297 
00299   virtual void SetRect(const csRect& rect) = 0;
00301   virtual const csRect& GetRect() const = 0;
00302 
00314   virtual void SetAxes(float xscale, float yscale, float zscale,
00315     float zskew, float xskew) = 0;
00316 
00318   virtual const csVector2& GetScroll() const = 0;
00320   virtual csVector3 GetViewScroll() const = 0;
00322   virtual void SetScroll(const csVector3& worldpos, const csVector2& coord) = 0;
00324   virtual void MoveScroll(const csVector3& delta) = 0;
00325 
00327   virtual void W2S(const csVector3& world, csVector2& screen) const = 0;
00333   virtual void W2S(const csVector3& world, csVector3& screen) const = 0;
00338   virtual void S2W(const csVector2& screen, csVector3& world) const = 0;
00339 
00344   virtual void Draw() = 0;
00345 
00351   virtual iCamera* GetFakeCamera(const csVector3& center,
00352     iIsoRenderView *rview) = 0;
00353 };
00354 
00355 SCF_VERSION (iIsoRenderView, 0, 0, 1);
00356 
00358 #define CSISO_RENDERPASS_PRE    0
00359 
00360 #define CSISO_RENDERPASS_BG     1
00361 
00362 #define CSISO_RENDERPASS_MAIN   2
00363 
00364 #define CSISO_RENDERPASS_FG     3
00365 
00366 #define CSISO_RENDERPASS_POST   4
00367 
00371 struct iIsoRenderView : public iBase
00372 {
00374   virtual iIsoView* GetView() const = 0;
00376   virtual iGraphics3D* GetG3D() const = 0;
00378   virtual int GetRenderPass() const = 0;
00380   virtual iClipper2D* GetClipper() const = 0;
00382   virtual void GetPrecalcGrid(int& startx, int& starty, int& scanw,
00383     int& scanh, float& cellpery) const = 0;
00385   virtual float GetMinZ() const = 0;
00387   virtual void SetMinZ(float val) = 0;
00389   virtual void AddPolyFX(int materialindex, G3DPolygonDPFX *g3dpolyfx,
00390     uint mixmode) = 0;
00391 };
00392 
00393 SCF_VERSION (iIsoSprite, 0, 0, 1);
00394 
00398 struct iIsoSprite : public iBase
00399 {
00401   virtual int GetVertexCount() const = 0;
00403   virtual void AddVertex(const csVector3& coord, float u, float v) = 0;
00405   virtual const csVector3& GetVertexPosition(int i) = 0;
00407   virtual void SetAllColors(const csColor& color) = 0;
00409   virtual void AddToVertexColor(int i, const csColor& color) = 0;
00411   virtual void ResetAllColors() = 0;
00413   virtual void SetAllStaticColors(const csColor& color) = 0;
00415   virtual void AddToVertexStaticColor(int i, const csColor& color) = 0;
00416 
00418   virtual const csVector3& GetPosition() const = 0;
00420   virtual void SetPosition(const csVector3& pos) = 0;
00422   virtual void MovePosition(const csVector3& delta) = 0;
00428   virtual void ForcePosition(const csVector3& pos) = 0;
00429 
00431   virtual void SetMaterialWrapper(iMaterialWrapper *material) = 0;
00433   virtual iMaterialWrapper* GetMaterialWrapper() const = 0;
00435   virtual void SetMixMode (uint mode) = 0;
00437   virtual uint GetMixMode () const = 0;
00438 
00440   virtual void Draw(iIsoRenderView *rview) = 0;
00441 
00443   virtual void SetGrid(iIsoGrid *grid) = 0;
00445   virtual iIsoGrid *GetGrid() const = 0;
00447   virtual void SetGridChangeCallback (iGridChangeCallback* cb) = 0;
00449   virtual iGridChangeCallback* GetGridChangeCallback () const = 0;
00450 };
00451 
00452 
00453 
00454 SCF_VERSION (iIsoMeshSprite, 0, 0, 1);
00455 
00460 struct iIsoMeshSprite : iIsoSprite {
00462   virtual void SetMeshObject(iMeshObject *mesh) = 0;
00464   virtual iMeshObject* GetMeshObject() const = 0;
00465 
00467   virtual void SetTransform(const csMatrix3& transform) = 0;
00469   virtual const csMatrix3& GetTransform() const = 0;
00470 
00472   virtual void SetZBufMode(csZBufMode mode) = 0;
00474   virtual csZBufMode GetZBufMode() const = 0;
00475 };
00476 
00477 
00488 #define CSISO_ATTN_NONE      0
00489 #define CSISO_ATTN_LINEAR    1
00490 #define CSISO_ATTN_INVERSE   2
00491 #define CSISO_ATTN_REALISTIC 3
00492 
00494 #define CSISO_LIGHT_STATIC 0x0000
00495 
00496 #define CSISO_LIGHT_DYNAMIC 0x0001
00497 
00498 SCF_VERSION (iIsoLight, 0, 0, 1);
00499 
00503 struct iIsoLight : public iBase
00504 {
00506   virtual void SetGrid(iIsoGrid *grid) = 0;
00508   virtual iIsoGrid* GetGrid() const = 0;
00510   virtual csFlags& Flags() = 0;
00512   virtual void SetAttenuation(int attn) = 0;
00514   virtual int GetAttenuation() const = 0;
00516   virtual void SetPosition(const csVector3& pos) = 0;
00518   virtual const csVector3& GetPosition() const = 0;
00520   virtual void SetColor(const csColor& col) = 0;
00522   virtual const csColor& GetColor() const = 0;
00524   virtual void SetRadius(float radius) = 0;
00526   virtual float GetRadius() const = 0;
00527 
00529   virtual void ShineGrid() = 0;
00531   virtual void ShineSprite(iIsoSprite *sprite) = 0;
00533   virtual iLight* GetFakeLight() = 0;
00535   virtual float GetVis(int gridx, int gridy) const = 0;
00536 };
00537 
00538 SCF_VERSION (iIsoMaterialWrapperIndex, 0, 0, 1);
00539 
00545 struct iIsoMaterialWrapperIndex: public iBase
00546 {
00548   virtual int GetIndex() const = 0;
00550   virtual void SetIndex(int i) = 0;
00551 };
00552 #endif // __CS_IVARIA_ISO_H__

Generated for Crystal Space by doxygen 1.2.14