/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Benjamin Grauer co-programmer: ... */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "water.h" #include "factory.h" #include "load_param.h" #include "grid.h" using namespace std; CREATE_FACTORY(Water, CL_WATER); Water::Water(const TiXmlElement* root) { this->resX = this->resY = 10; this->sizeX = this->sizeY = 1.0; this->grid = NULL; if (root != NULL) this->loadParams(root); } Water::~Water() { } void Water::loadParams(const TiXmlElement* root) { WorldEntity::loadParams(root); LoadParam(root, "size", this, Water, setSize) .describe("the size of the WaterSurface") .defaultValues(2, 1.0f, 1.0f); LoadParam(root, "resolution", this, Water, setResolution) .describe("sets the resolution of the water surface") .defaultValues(2, 10, 10); } void Water::rebuildGrid() { if (this->grid != NULL) delete this->grid; this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY); } void Water::setResolution(unsigned int resX, unsigned int resY) { this->resX = resX; this->resY = resY; } void Water::setSize(float sizeX, float sizeY) { this->sizeX = sizeX; this->sizeY = sizeY; }