Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/trunk: enhanced primitives, now more properties to set

File:
1 edited

Legend:

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

    r3612 r3614  
    4040 
    4141  this->material = new Material("Sphere");
    42   //this->material->setDiffuseMap("../data/pictures/load_screen.jpg");
    4342  this->material->setIllum(3);
    4443  this->material->setAmbient(1, .5, 1);
     
    5453  free(this->object);
    5554}
     55
     56
     57/**
     58   \brief sets the form of the primitive body
     59   \param form (enumeration) from pForm
     60*/
     61void Primitive::setForm(pForm form)
     62{
     63  this->form = form;
     64}
     65
     66
     67/**
     68   \brief sets the size of the body
     69   \param size from [0..1]
     70*/
     71void Primitive::setSize(float size)
     72{
     73  if( size < 0 || size > 1)
     74    {
     75      PRINTF(1)("size must be value between 0 and 1 [0..1]. resetting it to 1\n");
     76      size = 1.0;
     77    }
     78  this->size = size;
     79}
     80
     81
     82/**
     83   \brief stets the material
     84   \param material to be set
     85*/
     86void Primitive::setMaterial(Material* material)
     87{
     88  if( material == NULL)
     89    {
     90      PRINTF(1)("material reference is NULL, returning without modifications\n");
     91      return;
     92    }
     93  this->material = material;
     94}
     95
     96
     97/**
     98   \brief sets the texture name
     99   \param path to the texture
     100
     101   eg: name could have following value: "../data/pictures/load_screen.jpg"
     102*/
     103void Primitive::setTexture(char* name)
     104{
     105  if( name == NULL )
     106    {
     107      PRINTF(1)("texture char reference is NULL, returning without modifications\n");
     108      return;
     109    }
     110  this->textureName = name;
     111  this->material->setDiffuseMap( name);
     112}
     113
    56114
    57115/**
     
    98156    {
    99157    case P_SPHERE:
    100       gluSphere(this->object, 1, 6, 6);
     158      gluSphere(this->object, 0.2, 6, 6);
    101159      break;
    102160    case P_CUBE:
Note: See TracChangeset for help on using the changeset viewer.