Example #1
0
// menu callback
// XXX: NEEDS TO BE IMPLEMENTED
void World::menu(int value){
   
  switch(value){
  case 24:
    reset();
    break;
  case 1:
    // load rectangle
    mesh.loadOff(models[value]);
    drawRect= true;
    break;
  case 2:
  case 3:
  case 4:	
  case 5:	
  case 6:
  case 7:
  case 8:
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
    mesh.correctTexture(textureCorrection);
      if(models[value] == "data/bunny2.off" || models[value] == "data/cow.off" || models[value] == "data/cone.off"){ mesh.setWinding(TriMesh::CCW); }
    else mesh.setWinding(TriMesh::CW);
    mesh.loadOff(models[value]);
    mesh.center();
    mesh.unitize();
    mesh.computeNormals();
    mesh.computeSphereUVs();
    drawRect= false;
    drawMesh= true;
    break;
  case 14:
    drawMesh= false;
    break;
  case 15:
    lighting= !lighting;
    break;
  case 16:
    showTexture= !showTexture;
    break;
  case 17:
    showCoordinates= !showCoordinates;
    break;
  case 18:
    showOrigin= !showOrigin;
    break;

  case 19:
    textureCorrection= !textureCorrection;
    // enable/disable texture correction in Image (not obligatory, but useful for debugging)
    textureCorrection= !textureCorrection;
    mesh.correctTexture(textureCorrection);
    mesh.reload();
    mesh.center();
    mesh.unitize();
    mesh.computeNormals();
    mesh.computeSphereUVs();
    break;
  case 20:
    // set texture wrapping in Image (not obligatory, but useful for debugging)
    if(wrap==GL_REPEAT) wrap= GL_CLAMP_TO_BORDER;
    else wrap= GL_REPEAT;
    texture.setWrap(wrap);
    break;
    break;
  case 21:
    environmentMapping= !environmentMapping;
    if(!environmentMapping) moveEnvironment= false;
    break;
  case 22:
    reset();
    moveEnvironment= !moveEnvironment;
    break;
  default:
    break;
  }
 Context::displayWorldWindow();
}