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
Line 
1/*
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:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
17
18#include "water.h"
19#include "factory.h"
20#include "load_param.h"
21
22#include "grid.h"
23
24using namespace std;
25
26CREATE_FACTORY(Water, CL_WATER);
27
28
29Water::Water(const TiXmlElement* root)
30{
31  this->resX = this->resY = 10;
32  this->sizeX = this->sizeY = 1.0;
33  this->grid = NULL;
34
35  if (root != NULL)
36    this->loadParams(root);
37}
38
39Water::~Water()
40{
41
42}
43
44void Water::loadParams(const TiXmlElement* root)
45{
46  WorldEntity::loadParams(root);
47
48  LoadParam(root, "size", this, Water, setSize)
49      .describe("the size of the WaterSurface")
50      .defaultValues(2, 1.0f, 1.0f);
51
52  LoadParam(root, "resolution", this, Water, setResolution)
53      .describe("sets the resolution of the water surface")
54      .defaultValues(2, 10, 10);
55}
56
57void Water::rebuildGrid()
58{
59  if (this->grid != NULL)
60    delete this->grid;
61  this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY);
62
63}
64
65void Water::setResolution(unsigned int resX, unsigned int resY)
66{
67  this->resX = resX;
68  this->resY = resY;
69}
70
71void Water::setSize(float sizeX, float sizeY)
72{
73  this->sizeX = sizeX;
74  this->sizeY = sizeY;
75}
76
Note: See TracBrowser for help on using the repository browser.