Changeset 6458 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 10, 2006, 1:20:12 AM (19 years ago)
- Location:
- trunk/src/world_entities/environments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environments/water.cc
r6457 r6458 34 34 35 35 this->resX = this->resY = 10; 36 this->sizeX = this->sizeY = 1.0; 36 this->sizeX = this->sizeY = 1.0f; 37 this->height = 0.5f; 37 38 this->grid = NULL; 38 39 … … 61 62 .describe("sets the resolution of the water surface") 62 63 .defaultValues(2, 10, 10); 64 65 LoadParam(root, "height", this, Water, setHeight) 66 .describe("the height of the Waves") 67 .defaultValues(1, 0.5f); 63 68 } 64 69 … … 69 74 this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY); 70 75 71 this->grid->debug();72 76 this->setModel(this->grid, 0); 73 77 } … … 85 89 } 86 90 91 void Water::setHeight(float height) 92 { 93 this->height = height; 94 } 95 96 87 97 void Water::draw() const 88 98 { … … 98 108 for (unsigned int j = 0; j < this->grid->columns(); j++) 99 109 { 100 this->grid->height(i,j) = 15.0*sin(((float)i/(float)this->grid->rows() *phase)+101 15*cos((float)j/(float)this->grid->columns()) * phase);110 this->grid->height(i,j) = this->height*sin(((float)i/(float)this->grid->rows() *phase)+ 111 this->height*cos((float)j/(float)this->grid->columns()) * phase); 102 112 } 103 113 } 114 this->grid->rebuildNormals(this->height); 104 115 } -
trunk/src/world_entities/environments/water.h
r6457 r6458 28 28 void setResolution(unsigned int resX, unsigned int resY); 29 29 void setSize(float sizeX, float sizeY); 30 void setHeight(float height); 30 31 void rebuildGrid(); 31 32 … … 36 37 Grid* grid; //!< The water-surface-model to render with 37 38 Material* waterMaterial; 39 float height; //!< The hight of the Water 38 40 39 41 unsigned int resX, resY;
Note: See TracChangeset
for help on using the changeset viewer.