/* ** Haaf's Game Engine 1.7 ** Copyright (C) 2003-2007, Relish Games ** hge.relishgames.com ** ** hgeDistortionMesh helper class implementation */ #include "../../include/JGE.h" #include "../../include/JTypes.h" #include "../../include/JRenderer.h" #include "../../include/JFileSystem.h" #include "../../include/hge/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; quad = NULL; disp_array=new Vertex[rows*cols]; for(i=0;imTex) { tw=(float)quad->mTex->mTexWidth; th=(float)quad->mTex->mTexHeight; } else { tw = w; th = h; } cellw=w/(nCols-1); cellh=h/(nRows-1); for(j=0; jSetTextureRect(disp_array[idx].u, disp_array[idx].v, cellw, cellh); points[0].x = x+disp_array[idx+nCols].x; points[0].y = y+disp_array[idx+nCols].y; points[0].z = disp_array[idx+nCols].z; points[0].color = disp_array[idx+nCols].color; points[1].x = x+disp_array[idx+nCols+1].x; points[1].y = y+disp_array[idx+nCols+1].y; points[1].z = disp_array[idx+nCols+1].z; points[1].color = disp_array[idx+nCols+1].color; points[2].x = x+disp_array[idx+1].x; points[2].y = y+disp_array[idx+1].y; points[2].z = disp_array[idx+1].z; points[2].color = disp_array[idx+1].color; points[3].x = x+disp_array[idx].x; points[3].y = y+disp_array[idx].y; points[3].z = disp_array[idx].z; points[3].color = disp_array[idx].color; renderer->RenderQuad(quad, points); } } void hgeDistortionMesh::SetZ(int col, int row, float z) { if(row