Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/environments/water.cc @ 6455

Last change on this file since 6455 was 6455, checked in by bensch, 18 years ago

trunk: Simple water surface WE

File size: 1.5 KB
RevLine 
[4597]1/*
[3416]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
[4261]12   main-programmer: Benjamin Grauer
13   co-programmer: ...
[3411]14*/
15
[3590]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
17
[6455]18#include "water.h"
19#include "factory.h"
[5356]20#include "load_param.h"
[3608]21
[6455]22#include "grid.h"
23
[5356]24using namespace std;
[5357]25
[6455]26CREATE_FACTORY(Water, CL_WATER);
[3608]27
[4010]28
[6455]29Water::Water(const TiXmlElement* root)
[4010]30{
[6455]31  this->resX = this->resY = 10;
32  this->sizeX = this->sizeY = 1.0;
33  this->grid = NULL;
[4010]34
[6455]35  if (root != NULL)
36    this->loadParams(root);
[4010]37}
38
[6455]39Water::~Water()
[4261]40{
[4436]41
[4261]42}
43
[6455]44void Water::loadParams(const TiXmlElement* root)
[4010]45{
[6455]46  WorldEntity::loadParams(root);
[4620]47
[6455]48  LoadParam(root, "size", this, Water, setSize)
49      .describe("the size of the WaterSurface")
50      .defaultValues(2, 1.0f, 1.0f);
[6341]51
[6455]52  LoadParam(root, "resolution", this, Water, setResolution)
53      .describe("sets the resolution of the water surface")
54      .defaultValues(2, 10, 10);
[4012]55}
[3803]56
[6455]57void Water::rebuildGrid()
[4012]58{
[6455]59  if (this->grid != NULL)
60    delete this->grid;
61  this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY);
[3411]62
[6307]63}
[3411]64
[6455]65void Water::setResolution(unsigned int resX, unsigned int resY)
[3803]66{
[6455]67  this->resX = resX;
68  this->resY = resY;
[3803]69}
70
[6455]71void Water::setSize(float sizeX, float sizeY)
[3803]72{
[6455]73  this->sizeX = sizeX;
74  this->sizeY = sizeY;
[3803]75}
76
Note: See TracBrowser for help on using the repository browser.