Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3615 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Mar 21, 2005, 2:37:43 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: finishing work on primitives for the moment. got some good features now

Location:
orxonox/trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/primitive.cc

    r3614 r3615  
    3434{
    3535  this->form = form;
     36  this->size = 0.2f;
     37  this->segments = 6;
    3638  this->object = gluNewQuadric();
    3739 
     
    8183
    8284/**
     85   \brief set number of segments
     86   \param segment count
     87
     88   the more segments the body has, the smoother it seems. This function makes only
     89   sense with speres and cylinders, cubes have constant number of segments :)
     90*/
     91void Primitive::setSegments(int segments)
     92{
     93  if( segments <= 0)
     94    {
     95      PRINTF(1)("number of segments must be more than 0! not setting segment number\n");
     96    }
     97  this->segments = segments;
     98}
     99
     100/**
    83101   \brief stets the material
    84102   \param material to be set
     
    156174    {
    157175    case P_SPHERE:
    158       gluSphere(this->object, 0.2, 6, 6);
     176      gluSphere(this->object, this->size, this->segments, this->segments);
    159177      break;
    160178    case P_CUBE:
     
    162180      break;
    163181    case P_CYLINDER:
    164       gluCylinder(this->object, 1, 1, 2, 6, 6);
     182      gluCylinder(this->object, this->size, this->size, this->size * 2, this->segments, this->segments);
    165183      break;
    166184    case P_DISK:
    167       gluDisk(this->object, 1, 2, 6, 6);
     185      gluDisk(this->object, this->size, 2, this->segments, this->segments);
    168186      break;
    169187    default:
  • orxonox/trunk/src/world_entities/primitive.h

    r3614 r3615  
    1919  void setForm(pForm form);
    2020  void setSize(float size);
     21  void setSegments(int segments);
    2122  void setMaterial(Material* material);
    2223  void setTexture(char* name);
     
    3637  char* textureName;
    3738  float size;
     39  float segments;
    3840
    3941  void glDrawCube();
Note: See TracChangeset for help on using the changeset viewer.