Share
Embed
SER431 Lecture 06
Advanced Graphics
Programming Activity 02
(201809)
Javier Gonzalez-Sanchez PRO
September 03, 2018
Transcript
17 slides
-
jgs SER 431 Advanced Graphics Lecture 06: Quiz 02 Javier
Gonzalez-Sanchez [email protected] PERALTA 230U Office Hours: By appointment -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 1 jgs
Quiz 01 Solution -
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); -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 3 jgs
noise.h § #include <math.h> § 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) } -
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) -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 5 jgs
mesh.h | cube vs skybox vertex -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 6 jgs
mesh.h | cube texture -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 7 jgs
mesh.h | skybox texture -
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(); -
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 // ); -
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 -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 11 jgs
Up and Down § Look UP camera_viewing_y += (10); § Look DOWN camera_viewing_y -= (10); -
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); -
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); -
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 14 jgs
Quiz 01 Solution -
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) -
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.