コード例 #1
0
ファイル: menger.cpp プロジェクト: TTU-Graphics/FinalProject
void Menger::subdivideInverseMenger(vec3 cube, float radius, int subs) {
  float subLength = 2./3.;
  if(subs > 0) {
    for(int y=-1; y<=1; y++) {
      for(int x=-1; x<=1; x++) {
        for(int z=-1; z<=1; z++) {
          if(y != 0) { // do upper and lower round of cubes
            if(x != 0 || z != 0) { // don't subdivide center cube
              subdivideInverseMenger(
                  cube + vec3(x,y,z) * radius * subLength,
                  radius / 3.0,
                  subs - 1);
            } else {
              buildCube(cube + vec3(x,y,z) * radius * subLength,
                  radius/3.0);
            }
          } else { // do middle layer
            if(x != 0 && z!= 0) { // don't subdivide middle cubes
              subdivideInverseMenger(
                  cube + vec3(x,y,z) * radius * subLength,
                  radius / 3.0,
                  subs - 1);
            } else {
              buildCube(cube + vec3(x,y,z) * radius * subLength,
                  radius/3.0);
            }
          }
        }
      }
    }
  }
}
コード例 #2
0
void CubeDrawer::InitialiseGraphics(TickParameters& tp)
{
   mEffect->InitialiseGraphics(tp);
   mTexture->InitialiseGraphics(tp);

   mPositionAttributeHandle = mEffect->GetAttributeLocation("InputPosition");
   mTexcAttributeHandle = mEffect->GetAttributeLocation("InputTextureCoord");
   mTransformUniformHandle = mEffect->GetUniformLocation("Transform");

   //Initialise VBO
   glGenBuffers(1, &mVBO);
   buildCube();
}
コード例 #3
0
ファイル: snake.c プロジェクト: Rees29/work1
// Construct body
void buildBody(Body* value){
	if(value != NULL)
	{	
		glColor3f (0.5,0.5,1.0);
		glTranslatef(value->points->x, value->points->y, value->points->z);
		buildCube();
		glTranslatef(-value->points->x, -value->points->y, -value->points->z);
		glColor3f (1.0,1.0,1.0);
		buildBody(value->next);
		glutPostRedisplay();
	}
	
}
コード例 #4
0
ファイル: snake.c プロジェクト: Rees29/work1
/* construct plateau */
void buildPlateau(){
	int i = 0;
	int j = 0;
	int couleur = 0;
	glTranslatef(-nb_case/2, -nb_case/2, 0);
	for(i=0; i<nb_case; i++){
		for(j=0; j<nb_case ; j++){
			buildCube();
			glTranslatef(0.0, 1.0, 0.0);
		}
		glTranslatef(1.0, -nb_case, 0.0);
	}
	glTranslatef(-nb_case, 0.0, 0.0);
}
コード例 #5
0
ファイル: Cube.cpp プロジェクト: Keeo/GreenBerry
Cube::Cube(sf::Vector3i position) : ADrawable(sf::Vector3i(0,0,0), 40)
{
    sf::Vector3i vertexes[8];
    
    const int cm = 32;
    
    vertexes[0] = position + sf::Vector3i(0,0,0) * cm;
    vertexes[1] = position + sf::Vector3i(1,0,0) * cm;
    vertexes[2] = position + sf::Vector3i(1,0,1) * cm;
    vertexes[3] = position + sf::Vector3i(0,0,1) * cm;
    
    vertexes[4] = position + sf::Vector3i(0,1,0) * cm;
    vertexes[5] = position + sf::Vector3i(1,1,0) * cm;
    vertexes[6] = position + sf::Vector3i(1,1,1) * cm;
    vertexes[7] = position + sf::Vector3i(0,1,1) * cm;
    buildCube(vertexes);
}
コード例 #6
0
ファイル: ex4.cpp プロジェクト: Ilink/Rain2
int main (int argc, char * argv[]) 
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(320, 320);
	glutCreateWindow("VBO Example");
	glutDisplayFunc(renderScene);
	glutIdleFunc(renderScene);
	glutReshapeFunc(changeSize);
	glutKeyboardFunc(processNormalKeys);
	glEnable(GL_DEPTH_TEST);
	buildCube();
	initVBO();
	glutMainLoop();
    return 0;
}
コード例 #7
0
ファイル: Cube.cpp プロジェクト: Keeo/GreenBerry
Cube::Cube(sf::Vector3i position, sf::Vector3i vertexes[]) : ADrawable(position * 32)
{
    buildCube(vertexes);
}
コード例 #8
0
ファイル: Cube.cpp プロジェクト: Keeo/GreenBerry
Cube::Cube() : ADrawable(sf::Vector3i(0,0,0), 40)
{
    buildCube(0);
}