00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <water/WaterMapPoints.h>
00022 #include <water/Water2Patches.h>
00023 #include <graph/ModelRendererSimulator.h>
00024 #include <graph/ModelRendererMesh.h>
00025 #include <landscape/MapPoints.h>
00026 #include <landscapemap/LandscapeMaps.h>
00027 #include <GLEXT/GLGlobalState.h>
00028 #include <client/ScorchedClient.h>
00029 #include <common/OptionsTransient.h>
00030
00031 WaterMapPoints::WaterMapPoints()
00032 {
00033 }
00034
00035 WaterMapPoints::~WaterMapPoints()
00036 {
00037 }
00038
00039 void WaterMapPoints::draw(Water2Patches ¤tPatch)
00040 {
00041 GLGlobalState currentState(GLState::TEXTURE_OFF);
00042 for (int i=0; i<(int) pts_.size(); i++)
00043 {
00044 Vector ¤t = pts_[i];
00045 Water2Patch::Data *currentData =
00046 currentPatch.getPoint(int(current[0]) / 2, int(current[1]) / 2);
00047
00048 glPushMatrix();
00049 glTranslatef(current[0], current[1], currentData->z + 0.6f);
00050 glRotatef(currentData->nx * 90.0f, 1.0f, 0.0f, 0.0f);
00051 glRotatef(currentData->ny * 90.0f, 0.0f, 1.0f, 0.0f);
00052 glScalef(0.15f, 0.15f, 0.15f);
00053 switch(ScorchedClient::instance()->getOptionsTransient().getWallType())
00054 {
00055 case OptionsTransient::wallWrapAround:
00056 MapPoints::instance()->getBorderModelWrap()->draw();
00057 break;
00058 case OptionsTransient::wallBouncy:
00059 MapPoints::instance()->getBorderModelBounce()->draw();
00060 break;
00061 case OptionsTransient::wallConcrete:
00062 MapPoints::instance()->getBorderModelConcrete()->draw();
00063 break;
00064 default:
00065 break;
00066 }
00067 glPopMatrix();
00068 }
00069 }
00070
00071 void WaterMapPoints::generate()
00072 {
00073 pts_.clear();
00074
00075 int arenaX = ScorchedClient::instance()->getLandscapeMaps().getGroundMaps().getArenaX();
00076 int arenaY = ScorchedClient::instance()->getLandscapeMaps().getGroundMaps().getArenaY();
00077 int arenaWidth = ScorchedClient::instance()->getLandscapeMaps().getGroundMaps().getArenaWidth();
00078 int arenaHeight = ScorchedClient::instance()->getLandscapeMaps().getGroundMaps().getArenaHeight();
00079
00080 int pointsX = arenaWidth / 32;
00081 int pointsY = arenaHeight / 32;
00082
00083 int i;
00084 for (i=0; i<=pointsX; i++)
00085 {
00086 int pos = 32 * i;
00087
00088 pts_.push_back(Vector(arenaX + pos, arenaY));
00089 pts_.push_back(Vector(arenaX + pos, arenaY + arenaHeight));
00090 }
00091 for (i=1; i<=pointsY-1; i++)
00092 {
00093 int pos = 32 * i;
00094
00095 pts_.push_back(Vector(arenaX, arenaY + pos));
00096 pts_.push_back(Vector(arenaX + arenaWidth, arenaY + pos));
00097 }
00098 }