Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6446 in orxonox.OLD for trunk/src/lib/graphics/importer


Ignore:
Timestamp:
Jan 9, 2006, 12:05:57 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added grid class

Location:
trunk/src/lib/graphics/importer
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/Makefile.am

    r6309 r6446  
    66libORXimporter_a_SOURCES = model.cc \
    77                           vertex_array_model.cc \
     8                           grid.cc \
    89                           static_model.cc \
    910                           objModel.cc \
     
    2122                 tc.h \
    2223                 vertex_array_model.h \
     24                 grid.h \
    2325                 static_model.h \
    2426                 objModel.h \
     
    3032                 height_map.h \
    3133                 anorms.h \
    32                  anormtab.h 
     34                 anormtab.h
  • trunk/src/lib/graphics/importer/grid.cc

    r6443 r6446  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "proto_class.h"
     18#include "grid.h"
    1919
    2020using namespace std;
     
    2525 * @todo this constructor is not jet implemented - do it
    2626*/
    27 ProtoClass::ProtoClass ()
     27Grid::Grid(float sizeX, float sizeY, unsigned int rows, unsigned int columns)
    2828{
    29    this->setClassID(CL_PROTO_ID, "ProtoClass");
    3029
    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  }
    3541
    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;
    4156}
    4257
     
    4560 * standard deconstructor
    4661*/
    47 ProtoClass::~ProtoClass ()
     62Grid::~Grid ()
    4863{
    4964  // delete what has to be deleted here
  • trunk/src/lib/graphics/importer/grid.h

    r6443 r6446  
    11/*!
    2  * @file proto_class.h
     2 * @file grid.h
    33 * @brief Definition of ...
    44*/
    55
    6 #ifndef _PROTO_CLASS_H
    7 #define _PROTO_CLASS_H
     6#ifndef _GRID_H
     7#define _GRID_H
    88
    9 #include "base_object.h"
     9#include "vertex_array_model.h"
    1010
    1111// FORWARD DECLARATION
     
    1414
    1515//! A class for ...
    16 class ProtoClass : public BaseObject {
     16class Grid : public VertexArrayModel
     17{
    1718
    18  public:
    19   ProtoClass();
    20   virtual ~ProtoClass();
     19public:
     20  Grid(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY);
     21  virtual ~Grid();
    2122
     23  void setSizeX(float sizeX) { this->_sizeX = sizeX; };
     24  void setSizeY(float sizeY) { this->_sizeY = sizeY; };
    2225
    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; };
    2430
     31  float& height(unsigned int row, unsigned int column);
     32
     33private:
     34  float             _sizeX;
     35  float             _sizeY;
     36
     37  unsigned int      _rows;
     38  unsigned int      _columns;
    2539};
    2640
    27 #endif /* _PROTO_CLASS_H */
     41#endif /* _GRID_H */
Note: See TracChangeset for help on using the changeset viewer.