Ejemplo n.º 1
0
//--------------------------------------------------------------
// create buffers ready to send to display
void Ring::createBuffers()
{
  int ringSegments = 8;
  int vertexCount = ringSegments*4*RING_LENGTH_STEPS;

  m_farVertexes = mgVertexTA::newBuffer(vertexCount);
  m_farMaxWallIndexes = mgDisplay->newIndexBuffer(3*6*RING_LENGTH_STEPS);
  m_farMinWallIndexes = mgDisplay->newIndexBuffer(3*6*RING_LENGTH_STEPS);
  m_farRingIndexes = mgDisplay->newIndexBuffer(2*6*RING_LENGTH_STEPS);

  // create the max wall
  for (int j = 0; j < RING_LENGTH_STEPS; j++)
  {
    double edgeY = m_ringWidth/2 + m_wallWidth;

    m_farMaxWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMaxFar(j, edgeY);

    m_farMaxWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallTopFar(j, edgeY);

    m_farMaxWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMinFar(j, edgeY);
  }

  // create the surface and shell
  for (int j = 0; j < RING_LENGTH_STEPS; j++)
  {
    // create the ring surface and shell
    m_farRingIndexes->addRectIndex(m_farVertexes->getLength());
    createSurfaceFar(j);

    m_farRingIndexes->addRectIndex(m_farVertexes->getLength());
    createShellFar(j);
  }

  // create the min wall
  for (int j = 0; j < RING_LENGTH_STEPS; j++)
  {
    double edgeY = -m_ringWidth/2;
    m_farMinWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMaxFar(j, edgeY);

    m_farMinWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallTopFar(j, edgeY);

    m_farMinWallIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMinFar(j, edgeY);
  }
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
// create buffers ready to send to display
void Ring::createBuffers()
{
  m_shader = mgVertexTA::loadShader("litTextureArray");

  int ringSegments = 8;
  m_farVertexes = mgVertexTA::newBuffer(ringSegments*4*RING_LENGTH_STEPS);
  m_farIndexes = mgDisplay->newIndexBuffer(ringSegments*6*RING_LENGTH_STEPS);

  // create the max wall
  for (int j = 0; j < RING_LENGTH_STEPS; j++)
  {
    double edgeY = m_ringWidth/2 + m_wallWidth;

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMaxFar(j, edgeY);

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallTopFar(j, edgeY);

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMinFar(j, edgeY);

    // create the ring surface and shell
    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createSurfaceFar(j);

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createShellFar(j);

    edgeY = -m_ringWidth/2;
    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMaxFar(j, edgeY);

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallTopFar(j, edgeY);

    m_farIndexes->addRectIndex(m_farVertexes->getLength());
    createWallMinFar(j, edgeY);
  }
}