![]()
|
iso.h00001 /* 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 __IISO_H__ 00020 #define __IISO_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 00191 virtual void SetGroundMult(int multx, int multy) = 0; 00193 virtual int GetGroundMultX() const = 0; 00195 virtual int GetGroundMultY() const = 0; 00200 virtual void SetGroundValue(int x, int y, int gr_x, int gr_y, float val) = 0; 00202 virtual float GetGroundValue(int x, int y, int gr_x, int gr_y) = 0; 00204 virtual float GetGroundValue(int x, int y) = 0; 00206 virtual bool GroundHitBeam(const csVector3& src, const csVector3& dest) = 0; 00207 00209 virtual void SetAllLight(const csColor& color) = 0; 00211 virtual void SetAllStaticLight(const csColor& color) = 0; 00213 virtual void RegisterLight(iIsoLight *light) = 0; 00215 virtual void UnRegisterLight(iIsoLight *light) = 0; 00217 virtual void RegisterDynamicLight(iIsoLight *light) = 0; 00219 virtual void UnRegisterDynamicLight(iIsoLight *light) = 0; 00221 virtual void GetFakeLights(const csVector3& pos, iLight **& flights, 00222 int& num) = 0; 00223 00225 virtual void AddSprite(iIsoSprite *sprite) = 0; 00227 virtual void AddSprite(iIsoSprite *sprite, const csVector3& pos) = 0; 00229 virtual void RemoveSprite(iIsoSprite *sprite) = 0; 00234 virtual void MoveSprite(iIsoSprite *sprite, const csVector3& oldpos, 00235 const csVector3& newpos) = 0; 00236 00238 virtual void Draw(iIsoRenderView *rview) = 0; 00239 }; 00240 00241 SCF_VERSION (iIsoCellTraverseCallback, 0, 0, 1); 00242 00246 struct iIsoCellTraverseCallback : public iBase 00247 { 00249 virtual void Traverse (iIsoSprite* spr) = 0; 00250 }; 00251 00252 SCF_VERSION (iIsoCell, 0, 0, 2); 00253 00257 struct iIsoCell : public iBase 00258 { 00260 virtual void AddSprite(iIsoSprite *sprite, const csVector3& pos) = 0; 00262 virtual void RemoveSprite(iIsoSprite *sprite, const csVector3& pos) = 0; 00264 virtual void Draw(iIsoRenderView *rview) = 0; 00266 virtual void Traverse(iIsoCellTraverseCallback* func) = 0; 00267 }; 00268 00269 SCF_VERSION (iIsoView, 0, 0, 1); 00270 00286 struct iIsoView : public iBase 00287 { 00289 virtual iIsoEngine *GetEngine() const = 0; 00290 00292 virtual void SetWorld(iIsoWorld* world) = 0; 00294 virtual iIsoWorld* GetWorld() const = 0; 00295 00297 virtual void SetRect(const csRect& rect) = 0; 00299 virtual const csRect& GetRect() const = 0; 00300 00311 virtual void SetAxes(float xscale, float yscale, float zscale, 00312 float zskew, float xskew) = 0; 00313 00315 virtual const csVector2& GetScroll() const = 0; 00317 virtual csVector3 GetViewScroll() const = 0; 00319 virtual void SetScroll(const csVector3& worldpos, const csVector2& coord) = 0; 00321 virtual void MoveScroll(const csVector3& delta) = 0; 00322 00324 virtual void W2S(const csVector3& world, csVector2& screen) const = 0; 00330 virtual void W2S(const csVector3& world, csVector3& screen) const = 0; 00335 virtual void S2W(const csVector2& screen, csVector3& world) const = 0; 00336 00341 virtual void Draw() = 0; 00342 00348 virtual iCamera* GetFakeCamera(const csVector3& center, 00349 iIsoRenderView *rview) = 0; 00350 }; 00351 00352 SCF_VERSION (iIsoRenderView, 0, 0, 1); 00353 00355 #define CSISO_RENDERPASS_PRE 0 00356 00357 #define CSISO_RENDERPASS_BG 1 00358 00359 #define CSISO_RENDERPASS_MAIN 2 00360 00361 #define CSISO_RENDERPASS_FG 3 00362 00363 #define CSISO_RENDERPASS_POST 4 00364 00368 struct iIsoRenderView : public iBase 00369 { 00371 virtual iIsoView* GetView() const = 0; 00373 virtual iGraphics3D* GetG3D() const = 0; 00375 virtual int GetRenderPass() const = 0; 00377 virtual iClipper2D* GetClipper() const = 0; 00379 virtual void GetPrecalcGrid(int& startx, int& starty, int& scanw, 00380 int& scanh, float& cellpery) const = 0; 00382 virtual float GetMinZ() const = 0; 00384 virtual void SetMinZ(float val) = 0; 00386 virtual void AddPolyFX(int materialindex, G3DPolygonDPFX *g3dpolyfx, 00387 uint mixmode) = 0; 00388 }; 00389 00390 SCF_VERSION (iIsoSprite, 0, 0, 1); 00391 00395 struct iIsoSprite : public iBase 00396 { 00398 virtual int GetVertexCount() const = 0; 00400 virtual void AddVertex(const csVector3& coord, float u, float v) = 0; 00402 virtual const csVector3& GetVertexPosition(int i) = 0; 00404 virtual void SetAllColors(const csColor& color) = 0; 00406 virtual void AddToVertexColor(int i, const csColor& color) = 0; 00408 virtual void ResetAllColors() = 0; 00410 virtual void SetAllStaticColors(const csColor& color) = 0; 00412 virtual void AddToVertexStaticColor(int i, const csColor& color) = 0; 00413 00415 virtual const csVector3& GetPosition() const = 0; 00417 virtual void SetPosition(const csVector3& pos) = 0; 00419 virtual void MovePosition(const csVector3& delta) = 0; 00425 virtual void ForcePosition(const csVector3& pos) = 0; 00426 00428 virtual void SetMaterialWrapper(iMaterialWrapper *material) = 0; 00430 virtual iMaterialWrapper* GetMaterialWrapper() const = 0; 00432 virtual void SetMixMode (uint mode) = 0; 00434 virtual uint GetMixMode () const = 0; 00435 00437 virtual void Draw(iIsoRenderView *rview) = 0; 00438 00440 virtual void SetGrid(iIsoGrid *grid) = 0; 00442 virtual iIsoGrid *GetGrid() const = 0; 00444 virtual void SetGridChangeCallback (iGridChangeCallback* cb) = 0; 00446 virtual iGridChangeCallback* GetGridChangeCallback () const = 0; 00447 }; 00448 00449 00450 00451 SCF_VERSION (iIsoMeshSprite, 0, 0, 1); 00452 00457 struct iIsoMeshSprite : iIsoSprite { 00459 virtual void SetMeshObject(iMeshObject *mesh) = 0; 00461 virtual iMeshObject* GetMeshObject() const = 0; 00462 00464 virtual void SetTransform(const csMatrix3& transform) = 0; 00466 virtual const csMatrix3& GetTransform() const = 0; 00467 00469 virtual void SetZBufMode(csZBufMode mode) = 0; 00471 virtual csZBufMode GetZBufMode() const = 0; 00472 }; 00473 00474 00485 #define CSISO_ATTN_NONE 0 00486 #define CSISO_ATTN_LINEAR 1 00487 #define CSISO_ATTN_INVERSE 2 00488 #define CSISO_ATTN_REALISTIC 3 00489 00491 #define CSISO_LIGHT_STATIC 0x0000 00492 00493 #define CSISO_LIGHT_DYNAMIC 0x0001 00494 00495 SCF_VERSION (iIsoLight, 0, 0, 1); 00496 00500 struct iIsoLight : public iBase 00501 { 00503 virtual void SetGrid(iIsoGrid *grid) = 0; 00505 virtual iIsoGrid* GetGrid() const = 0; 00507 virtual csFlags& Flags() = 0; 00509 virtual void SetAttenuation(int attn) = 0; 00511 virtual int GetAttenuation() const = 0; 00513 virtual void SetPosition(const csVector3& pos) = 0; 00515 virtual const csVector3& GetPosition() const = 0; 00517 virtual void SetColor(const csColor& col) = 0; 00519 virtual const csColor& GetColor() const = 0; 00521 virtual void SetRadius(float radius) = 0; 00523 virtual float GetRadius() const = 0; 00524 00526 virtual void ShineGrid() = 0; 00528 virtual void ShineSprite(iIsoSprite *sprite) = 0; 00530 virtual iLight* GetFakeLight() = 0; 00532 virtual float GetVis(int gridx, int gridy) const = 0; 00533 }; 00534 00535 SCF_VERSION (iIsoMaterialWrapperIndex, 0, 0, 1); 00536 00542 struct iIsoMaterialWrapperIndex: public iBase 00543 { 00545 virtual int GetIndex() const = 0; 00547 virtual void SetIndex(int i) = 0; 00548 }; 00549 #endif Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |