hgedistort.h
上传用户:jnfxsk
上传日期:2022-06-16
资源大小:3675k
文件大小:2k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. /*
  2. ** Haaf's Game Engine 1.7
  3. ** Copyright (C) 2003-2007, Relish Games
  4. ** hge.relishgames.com
  5. **
  6. ** hgeDistortionMesh helper class header
  7. */
  8. #ifndef HGEDISTORT_H
  9. #define HGEDISTORT_H
  10. #include "hge.h"
  11. #define HGEDISP_NODE 0
  12. #define HGEDISP_TOPLEFT 1
  13. #define HGEDISP_CENTER 2
  14. /*
  15. ** HGE Distortion mesh class
  16. */
  17. class hgeDistortionMesh
  18. {
  19. public:
  20.      hgeDistortionMesh(int cols, int rows);
  21.      hgeDistortionMesh(const hgeDistortionMesh &dm);
  22.      ~hgeDistortionMesh();
  23.  hgeDistortionMesh& operator= (const hgeDistortionMesh &dm);
  24.      void Render(float x, float y);
  25.      void Clear(DWORD col=0xFFFFFFFF, float z=0.5f);
  26.      void SetTexture(HTEXTURE tex);
  27.      void SetTextureRect(float x, float y, float w, float h);
  28.      void SetBlendMode(int blend);
  29.      void SetZ(int col, int row, float z);
  30.      void SetColor(int col, int row, DWORD color);
  31.      void SetDisplacement(int col, int row, float dx, float dy, int ref);
  32.      HTEXTURE GetTexture() const {return quad.tex;}
  33.      void GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; }
  34.      int GetBlendMode() const { return quad.blend; }
  35.      float GetZ(int col, int row) const;
  36.      DWORD GetColor(int col, int row) const;
  37.      void GetDisplacement(int col, int row, float *dx, float *dy, int ref) const;
  38.  int GetRows() { return nRows; }
  39.  int GetCols() { return nCols; }
  40. private:
  41. hgeDistortionMesh();
  42. static HGE *hge;
  43. hgeVertex *disp_array;
  44. int nRows, nCols;
  45. float cellw,cellh;
  46. float tx,ty,width,height;
  47. hgeQuad quad;
  48. };
  49. #endif