/* ** Haaf's Game Engine 1.7 ** Copyright (C) 2003-2007, Relish Games ** hge.relishgames.com ** ** hgeDistortionMesh helper class implementation */ #include "hgedistort.h" HGE *hgeDistortionMesh::hge=0; hgeDistortionMesh::hgeDistortionMesh(int cols, int rows) { int i; hge=hgeCreate(HGE_VERSION); nRows=rows; nCols=cols; cellw=cellh=0; quad.tex=0; quad.blend=BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_ZWRITE; disp_array=new hgeVertex[rows*cols]; for(i=0;iRelease(); } hgeDistortionMesh& hgeDistortionMesh::operator= (const hgeDistortionMesh &dm) { if(this!=&dm) { nRows=dm.nRows; nCols=dm.nCols; cellw=dm.cellw; cellh=dm.cellh; tx=dm.tx; ty=dm.ty; width=dm.width; height=dm.height; quad=dm.quad; delete[] disp_array; disp_array=new hgeVertex[nRows*nCols]; memcpy(disp_array, dm.disp_array, sizeof(hgeVertex)*nRows*nCols); } return *this; } void hgeDistortionMesh::SetTexture(HTEXTURE tex) { quad.tex=tex; } void hgeDistortionMesh::SetTextureRect(float x, float y, float w, float h) { int i,j; float tw,th; tx=x; ty=y; width=w; height=h; if (quad.tex) { tw=(float)hge->Texture_GetWidth(quad.tex); th=(float)hge->Texture_GetHeight(quad.tex); } else { tw = w; th = h; } cellw=w/(nCols-1); cellh=h/(nRows-1); for(j=0; jGfx_RenderQuad(&quad); } } void hgeDistortionMesh::SetZ(int col, int row, float z) { if(row