Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SER431 Lecture 06

SER431 Lecture 06

Advanced Graphics
Programming Activity 02
(201809)

Javier Gonzalez-Sanchez

September 03, 2018
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs SER 431 Advanced Graphics Lecture 06: Quiz 02 Javier

    Gonzalez-Sanchez [email protected] PERALTA 230U Office Hours: By appointment
  2. 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);
  3. 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) }
  4. 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)
  5. 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();
  6. 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 // );
  7. 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
  8. Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 11 jgs

    Up and Down § Look UP camera_viewing_y += (10); § Look DOWN camera_viewing_y -= (10);
  9. 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);
  10. 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);
  11. 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)
  12. 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.