u05-2 make tower more pretty

This commit is contained in:
Luca Conte 2024-04-25 16:03:58 +02:00
parent aba9d67151
commit d4c350721e
1 changed files with 11 additions and 17 deletions

View File

@ -278,7 +278,8 @@ void draw(void) {
GLfloat up[3] = {0.0f, 1.0f, 0.0f}; GLfloat up[3] = {0.0f, 1.0f, 0.0f};
GLfloat viewingTransformation[16]; GLfloat viewingTransformation[16];
lookAt(viewingTransformation, cameraPosition, origin, up); GLfloat fixedCameraPosition[3] = {cos(stepi) * 4.0f, 1.5f, sin(stepi) * 4.0f};
lookAt(viewingTransformation, fixedCameraPosition, origin, up);
@ -315,24 +316,17 @@ void draw(void) {
glUniformMatrix4fv(glGetUniformLocation(program, "globalTransformation"), 1, GL_FALSE, globalTransformation); glUniformMatrix4fv(glGetUniformLocation(program, "globalTransformation"), 1, GL_FALSE, globalTransformation);
GLfloat position[3] = {0.0f, -3.0f, 0.0f}; GLfloat position[3] = {0.0f, -2.0f, 0.0f};
GLfloat scaleVec[3] = {3.0f, 0.1f, 3.0f}; GLfloat scaleVec[3] = {3.0f, 0.2f, 3.0f};
GLfloat rotateVec[3] = {0.0f, 0.0f, 0.0f}; GLfloat rotateVec[3] = {0.0f, 0.0f, 0.0f};
drawCube(position, scaleVec, rotateVec); for (int i=0; i < 10; i++) {
position[1] += 0.4;
rotateVec[1] += 0.2;
scaleVec[0] -= 0.3;
scaleVec[2] -= 0.3;
drawCube(position, scaleVec, rotateVec);
}
position[1] = -2.8f;
scaleVec[0] = 2.0f;
scaleVec[2] = 2.0f;
rotateVec[0] = pi;
drawCube(position, scaleVec, rotateVec);
position[1] = -2.4f;
scaleVec[0] = 1.0f;
scaleVec[1] = 0.3f;
scaleVec[2] = 1.0f;
rotateVec[0] = 0.0f;
rotateVec[1] = pi / 4;
drawCube(position, scaleVec, rotateVec);
} }
void framebuffer_size_callback(GLFWwindow *window, int width, int height) { void framebuffer_size_callback(GLFWwindow *window, int width, int height) {