Ejemplo n.º 1
0
void DebugDrawer::drawTri(const Ogre::Vector3 *vertices,
                     const Ogre::ColourValue& colour,
                     bool isFilled)
{
	buildTri(vertices, colour);
	if (isFilled) buildFilledTriangle(vertices, colour, fillAlpha);
}
Ejemplo n.º 2
0
void TexTri::buildModel() {
  vec4* points = new vec4[vertexCount];
  vec2* tex = new vec2[vertexCount];
  
  buildTri(points,0,
      vec4(-1, -1, 0.0, 1.),
      vec4( 0.,  1, 0.0, 1.),
      vec4( 1, -1, 0.0, 1.));

  tex[0] = vec2(0, 0);
  tex[1] = vec2(.5, 1);
  tex[2] = vec2(1, 0);

  prog->setBuffer(buffers[0],BUFFER_OFFSET(0),GL_FLOAT,
      vertexCount,points,"vPosition");

  prog->setBuffer(buffers[1],BUFFER_OFFSET(0),GL_FLOAT,
      vertexCount,tex,"vTexture");

  printf("setting texture=%s\n",texture);
  prog->setTexture(texture,"Texture");
  //prog->setTexture("uv_checker.png",GL_TEXTURE0,0,"Texture");

  delete[] points;
  delete[] tex;
}
Ejemplo n.º 3
0
/*
 * The face variable should be formatted the following way:
 *
 * 0--1
 * | /|
 * |/ |
 * 3--2
 */
void Menger::buildFace(vec4* face, int col) {
  static vec4 cols[] = {
    hexToVec4("FFFFFF",1.0),  //+y = white
    hexToVec4("00FF00",1.0),  //+x = green?
    hexToVec4("0000FF",1.0),  //-x = blue
    hexToVec4("FF6600",1.0),  //-z = orange?
    hexToVec4("FFFF00",1.0),  //-y = yellow
    hexToVec4("FF0000",1.0),  //+z = red
  };

  buildTri(points, index, face[0], face[1], face[3]);
  buildTri(points, index+3, face[1], face[2], face[3]);

  //set colors and incrase index by 6
  for(int i=0; i<6; i++) {
    colors[index++] = cols[col];
  }
}
Ejemplo n.º 4
0
/**
 * p2 - p1
 * |  / |
 * | /  |
 * p3 - p4
 */
void Square::buildFace(vec3* points, int i, vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
  buildTri(points, i, p1, p2, p3);
  buildTri(points, i+3, p1, p4, p3);
}