Slide 1

Slide 1 text

jgs SER 431 Advanced Graphics Lecture 06: Quiz 02 Javier Gonzalez-Sanchez [email protected] PERALTA 230U Office Hours: By appointment

Slide 2

Slide 2 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 1 jgs Quiz 01 Solution

Slide 3

Slide 3 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 2 jgs texture.h § #include ”noise.h” § void codedTexture(UINT textureArray[], int n, int type) § float t_scale(float x) § Vec3f marbleMap(float a) § Vec3f skyMap(float a) § // ACTIVITY 1: add the lava/fire effect color-mapping § void loadBMP_custom(GLuint textures[], char *img_path, int n);

Slide 4

Slide 4 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 3 jgs noise.h § #include § class ImprovedNoise { § double perlinMarble(float x, float y) § double perlinMultiscale(float x, float y) § // ACTIVITY 2: add the lava/fire ecuation § double noise(double x, double y, double z) }

Slide 5

Slide 5 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 4 jgs mesh.h § struct Mesh § Mesh* loadFile(const char* file) § Mesh* createCube() § Mesh* createSkyBox(int w) § Mesh* createPlane(int width, int depth, int cell) § void calculateNormalPerFace(Mesh* m) § void calculateNormalPerVertex(Mesh* m)

Slide 6

Slide 6 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 5 jgs mesh.h | cube vs skybox vertex

Slide 7

Slide 7 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 6 jgs mesh.h | cube texture

Slide 8

Slide 8 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 7 jgs mesh.h | skybox texture

Slide 9

Slide 9 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 8 jgs render.h § GLuint meshToDisplayList(Mesh* mesh, int id, int texture) § glNewList(listID, GL_COMPILE); § glEnable(GL_TEXTURE_2D); § glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); § glBindTexture(GL_TEXTURE_2D, texture); § glBegin(GL_TRIANGLES); § for (/* for each triangle in a mesh */){ § // normal § // texture § // color § } § glEnd(); § glDisable(GL_TEXTURE_2D); § glEndList();

Slide 10

Slide 10 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 9 jgs controls.h § float camera_x = 0.0; § float camera_y = 300.0; § float camera_z = 320.0; § float camera_viewing_x = 0.0; § float camera_viewing_y = 301.0; § float camera_viewing_z = 0.0; § float total_moving_angle = 0.0; // gluLookAt( camera_x, camera_y, camera_z, // camera_viewing_x, camera_viewing_y, camera_viewing_z, // 0.0f, 1.0f, 0.0f // );

Slide 11

Slide 11 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 10 jgs Moving the Camera as a First Person Walk § Look up and down § Rotate Left or Right § Move forward or Backward

Slide 12

Slide 12 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 11 jgs Up and Down § Look UP camera_viewing_y += (10); § Look DOWN camera_viewing_y -= (10);

Slide 13

Slide 13 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 12 jgs Rotate Left and Rotate Right § Move LEFT total_moving_angle += -0.01; rotate_point(-0.01); § Move RIGHT total_moving_angle += 0.01; rotate_point(0.01);

Slide 14

Slide 14 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 13 jgs Front and Back § Move FRONT camera_x += (10) * sin(total_moving_angle); camera_z += (10) * -cos(total_moving_angle); camera_viewing_x += (10)* sin(total_moving_angle); camera_viewing_z += (10)* -cos(total_moving_angle);

Slide 15

Slide 15 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 14 jgs Quiz 01 Solution

Slide 16

Slide 16 text

Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 15 jgs Quiz 02 § // Lava / fire texture around the space to avoid get closed to the walls § // Terrain at the center. Add altitude to the pain with stone texture § // What about making a cube able to move (rotate or something). // But, the terrain will not be plain (it is a non-flat surface)

Slide 17

Slide 17 text

jgs SER431 Advanced Graphics Javier Gonzalez-Sanchez [email protected] Fall 2018 Disclaimer. These slides can only be used as study material for the class SER431 at ASU. They cannot be distributed or used for another purpose.