Exemple #1
0
Cylinder::Cylinder(const AttributeSet& attributes):capped(false)
{
  for(unsigned int i=0; i<attributes.size(); i++)
  {
    std::string attributeName(attributes[i].attribute);
    if(attributeName == "name")
    {
      name = attributes[i].value;
    }
    else if(attributeName == "radius")
    {
      radius = ParserUtilities::toDouble(attributes[i].value);
    }
    else if(attributeName == "height")
    {
      height = ParserUtilities::toDouble(attributes[i].value);
    }
    else if(attributeName == "canCollide")
    {
      collideBit = ParserUtilities::toBool(attributes[i].value);
    }
    else if(attributeName == "capped")
    {
      capped = ParserUtilities::toBool(attributes[i].value);
    }
  }
  calculateCorners();
  graphicsHandle = graphicsManager->createNewCylinder(radius, height, capped);
}
void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect)
{
  void *data = PlaneDistortWarpImageOperation::initializeTileData(rect);

  /* get corner values once, by reading inputs at (0,0)
   * XXX this assumes invariable values (no image inputs),
   * we don't have a nice generic system for that yet
   */
  lockMutex();
  if (!m_corners_ready) {
    /* corner sockets start at index 1 */
    SocketReader *readers[4] = {
        getInputSocketReader(1),
        getInputSocketReader(2),
        getInputSocketReader(3),
        getInputSocketReader(4),
    };
    float corners[4][2];
    readCornersFromSockets(rect, readers, corners);
    calculateCorners(corners, true, 0);

    m_corners_ready = true;
  }
  unlockMutex();

  return data;
}
Exemple #3
0
void init()
{
  glMatrixMode(GL_PROJECTION);
  glOrtho(0,WIDTH,0,HEIGHT,1,-1);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  glClearColor(0,0,0,0);
  glClear(GL_COLOR_BUFFER_BIT);

  myImage = new pixelBuffer(WIDTH * MINIPIXELS,HEIGHT * MINIPIXELS);
  eyePos = new vector(0.0,0.0,0.0);
  topLeftCornerPos = new vector();
  topRightCornerPos = new vector();
  bottomLeftCornerPos = new vector();
  bottomRightCornerPos = new vector();
  calculateCorners();
}