- Timestamp:
- Jan 10, 2006, 12:39:08 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/grid.h
r6454 r6457 26 26 unsigned int columns() const { return this->_columns; }; 27 27 28 float& height(unsigned int row, unsigned int column) { return this->vertex(row*_columns + row).y;}; 28 float& height(unsigned int row, unsigned int column) { return this->vertex(row*this->_columns + column).y;}; 29 30 31 void rebuidNormals(); 29 32 30 33 private: -
trunk/src/story_entities/game_world.cc
r6434 r6457 328 328 329 329 this->tick(this->dataTank->objectManager->getObjectList(OM_DEAD_TICK), this->dtS); 330 this->tick(this->dataTank->objectManager->getObjectList(OM_ENVIRON), this->dtS); 330 331 this->tick(this->dataTank->objectManager->getObjectList(OM_COMMON), this->dtS); 331 332 this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_00), this->dtS); -
trunk/src/world_entities/environments/water.cc
r6456 r6457 21 21 22 22 #include "grid.h" 23 #include "material.h" 23 24 24 25 using namespace std; … … 30 31 { 31 32 this->setClassID(CL_WATER, "Water"); 32 this->toList(OM_ENVIRON _NOTICK);33 this->toList(OM_ENVIRON); 33 34 34 35 this->resX = this->resY = 10; … … 40 41 41 42 this->rebuildGrid(); 43 this->waterMaterial = new Material(); 42 44 } 43 45 … … 45 47 { 46 48 delete this->grid; 47 49 delete this->waterMaterial; 48 50 } 49 51 … … 67 69 this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY); 68 70 71 this->grid->debug(); 69 72 this->setModel(this->grid, 0); 70 73 } … … 78 81 void Water::setSize(float sizeX, float sizeY) 79 82 { 80 printf("%f %f\n", sizeX, sizeY);81 82 83 this->sizeX = sizeX; 83 84 this->sizeY = sizeY; 84 85 } 85 86 87 void Water::draw() const 88 { 89 this->waterMaterial->select(); 90 WorldEntity::draw(); 91 } 86 92 87 93 void Water::tick(float dt) 88 94 { 89 95 phase += dt *.1; 96 for (unsigned int i = 0; i < this->grid->rows(); i++) 97 { 98 for (unsigned int j = 0; j < this->grid->columns(); j++) 99 { 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); 102 } 103 } 90 104 } -
trunk/src/world_entities/environments/water.h
r6456 r6457 30 30 void rebuildGrid(); 31 31 32 void draw() const; 32 33 void tick(float dt); 33 34 34 35 private: 35 36 Grid* grid; //!< The water-surface-model to render with 37 Material* waterMaterial; 36 38 37 39 unsigned int resX, resY; 38 40 float sizeX, sizeY; 41 42 float phase; 39 43 }; 40 44
Note: See TracChangeset
for help on using the changeset viewer.