CMPS-4490 Game Design Lab-4

Overview:

Step 1:
The lab will start with a review of Blender.

Save your programming work on Odin at /4490/1/fps/

Your work will be modifications to the fps.cpp program.

Steps...

1. Choose an isometric 3-view drawing.

2. Bring it in to blender and construct your object.

3. The object should have a hole through it somewhere.

4. Export the object as a Wavefront .obj file.

5. Use one of our frameworks which imports blender objects.
   (we did it together on the big-screen)

6. On a key-press, have your player smoothly turn, find the object, and
   travel through the hole.
   


You should save your 3-view blender setup as a .blend file and store
it on Odin at /4490/4/lab4.blend so gordon can see it.

Sample iso images
Find a drawing on google,
draw one of your own on paper,
or
you may use one of these...








Export and import

When you export your blender object, you should first convert
all your faces to triangles.

  1. Edit mode
  2. Select all
  3. Ctrl T to triangulate

There are other ways to do this. Use google.

The following frameworks do import of blender models.
   object3D
   stencil_shad

   Look for them in /home/fac/gordon/p/4490/code/frameworks
   We will look at these later.

Here is the code from the lab class big-screen.
#include <iostream> #include <fstream> using namespace std; void drawBlenderObject() { float vert[100][3]; int face[100][3]; int nverts = 0; int nfaces = 0; ifstream fin("tris2.txt"); if (fin.fail()) { cout << "ERROR - File not opened!" << endl; exit(0); } char line[100]; fin.getline(line, 100); while (!fin.eof()) { //look for v if (*line == 'v') { float pt[3]; sscanf(line+1, "%f %f %f", &pt[0], &pt[1], &pt[2]); vert[nverts][0] = pt[0]; vert[nverts][1] = pt[1]; vert[nverts][2] = pt[2]; ++nverts; } //look for f if (*line == 'f') { int f[3]; sscanf(line+1, "%i %i %i", &f[0], &f[1], &f[2]); face[nfaces][0] = f[0]-1; face[nfaces][1] = f[1]-1; face[nfaces][2] = f[2]-1; ++nfaces; } fin.getline(line, 100); } fin.close(); glBegin(GL_TRIANGLES); for (int i=0; i<nfaces; i++) { for (int j=0; j<3; j++) { glVertex3f( vert[face[i][j]][0], vert[face[i][j]][1], vert[face[i][j]][2] ); } } glEnd(); }
To make this function more useful: 1. call this function just once when the program starts 2. pass in the file name 3. pass in the array pointers allocate and populate the arrays 4. return n triangles class for blender object


What to turn in...
Save your work on Odin.
Your work will be in the fps program from lab-1.