Changeset 6446 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jan 9, 2006, 12:05:57 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/Makefile.am
r6309 r6446 6 6 libORXimporter_a_SOURCES = model.cc \ 7 7 vertex_array_model.cc \ 8 grid.cc \ 8 9 static_model.cc \ 9 10 objModel.cc \ … … 21 22 tc.h \ 22 23 vertex_array_model.h \ 24 grid.h \ 23 25 static_model.h \ 24 26 objModel.h \ … … 30 32 height_map.h \ 31 33 anorms.h \ 32 anormtab.h 34 anormtab.h -
trunk/src/lib/graphics/importer/grid.cc
r6443 r6446 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include " proto_class.h"18 #include "grid.h" 19 19 20 20 using namespace std; … … 25 25 * @todo this constructor is not jet implemented - do it 26 26 */ 27 ProtoClass::ProtoClass ()27 Grid::Grid(float sizeX, float sizeY, unsigned int rows, unsigned int columns) 28 28 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass");30 29 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS 30 GLuint i, j; 31 for (i = 0; i < rows; i++) 32 { 33 for (j = 0; j < columns; j++) 34 { 35 this->addVertex((float)i - (float)sizeY/2.0, 0.0, (float)j - (float)sizeX/2.0); 36 this->addNormal(0.0, 1, 0.0); 37 this->addTexCoor((float)i/(float)columns, (float)j/(float)rows); 38 this->addColor((float)i/20.0, 0.0, (float)j/20.0); 39 } 40 } 35 41 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 42 for (i = 0; i < rows-1; i++) 43 { 44 for (j = 0; j < columns; j++) 45 { 46 this->addIndice( rows*i + j ); 47 this->addIndice( rows*(i+1) + j ); 48 } 49 this->newStripe(); 50 } 51 52 this->_rows = rows; 53 this->_columns = columns; 54 this->_sizeX = sizeX; 55 this->_sizeY = sizeY; 41 56 } 42 57 … … 45 60 * standard deconstructor 46 61 */ 47 ProtoClass::~ProtoClass()62 Grid::~Grid () 48 63 { 49 64 // delete what has to be deleted here -
trunk/src/lib/graphics/importer/grid.h
r6443 r6446 1 1 /*! 2 * @file proto_class.h2 * @file grid.h 3 3 * @brief Definition of ... 4 4 */ 5 5 6 #ifndef _ PROTO_CLASS_H7 #define _ PROTO_CLASS_H6 #ifndef _GRID_H 7 #define _GRID_H 8 8 9 #include " base_object.h"9 #include "vertex_array_model.h" 10 10 11 11 // FORWARD DECLARATION … … 14 14 15 15 //! A class for ... 16 class ProtoClass : public BaseObject { 16 class Grid : public VertexArrayModel 17 { 17 18 18 19 ProtoClass();20 virtual ~ ProtoClass();19 public: 20 Grid(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY); 21 virtual ~Grid(); 21 22 23 void setSizeX(float sizeX) { this->_sizeX = sizeX; }; 24 void setSizeY(float sizeY) { this->_sizeY = sizeY; }; 22 25 23 private: 26 float sizeX() const { return this->_sizeX; }; 27 float sizeY() const { return this->_sizeY; }; 28 unsigned int rows() const { return this->_rows; }; 29 unsigned int columns() const { return this->_columns; }; 24 30 31 float& height(unsigned int row, unsigned int column); 32 33 private: 34 float _sizeX; 35 float _sizeY; 36 37 unsigned int _rows; 38 unsigned int _columns; 25 39 }; 26 40 27 #endif /* _ PROTO_CLASS_H */41 #endif /* _GRID_H */
Note: See TracChangeset
for help on using the changeset viewer.