diff --git a/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate b/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate index 3777b3430e..ffc75fe28f 100644 Binary files a/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate and b/interface.xcodeproj/project.xcworkspace/xcuserdata/philip.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/lattice.cpp b/lattice.cpp index f6b67fe639..58ecb95093 100644 --- a/lattice.cpp +++ b/lattice.cpp @@ -11,7 +11,7 @@ Lattice::Lattice(int w, int h) { width = w; height = h; - tilegap = 3; + tilegap = 2; lastindex = -1; tiles = new Tile[width*height]; for (int i = 0; i < (width*height); i++) { diff --git a/main.cpp b/main.cpp index b1b3f06690..5f79193e59 100644 --- a/main.cpp +++ b/main.cpp @@ -110,7 +110,7 @@ Cloud cloud(0, // Particles VoxelSystem voxels(0, box); -Lattice lattice(15,10); +Lattice lattice(160,100); Finger myFinger(WIDTH, HEIGHT); #define RENDER_FRAME_MSECS 8 @@ -119,7 +119,7 @@ int steps_per_frame = 0; float yaw =0.f; // The yaw, pitch for the avatar head float pitch = 0.f; // -float start_yaw = 135.0; +float start_yaw = 116; float render_yaw = start_yaw; float render_pitch = 0.f; float render_yaw_rate = 0.f; @@ -129,7 +129,10 @@ float lateral_vel = 0.f; // Manage speed and direction of motion GLfloat fwd_vec[] = {0.0, 0.0, 1.0}; //GLfloat start_location[] = { WORLD_SIZE*1.5, -WORLD_SIZE/2.0, -WORLD_SIZE/3.0}; -GLfloat start_location[] = { 0.1, -0.15, 0.1}; +//GLfloat start_location[] = { 0.1, -0.15, 0.1}; + +GLfloat start_location[] = {6.1, -2.0, 1.4}; + GLfloat location[] = {start_location[0], start_location[1], start_location[2]}; float fwd_vel = 0.0f; @@ -253,10 +256,12 @@ void display_stats(void) } #endif - char adc[200]; - sprintf(adc, "location = %3.1f,%3.1f,%3.1f", - location[0], location[1], location[2] + sprintf(adc, "location = %3.1f,%3.1f,%3.1f, angle_to 0,0,0 = %3.1f, head yaw = %3.1f, render_yaw = %3.1f, together = %3.1f", + -location[0], -location[1], -location[2], + azimuth_to(myHead.getPos()*-1.f, glm::vec3(0,0,0)), + myHead.getYaw(), render_yaw, + angle_to(myHead.getPos()*-1.f, glm::vec3(0,0,0), render_yaw, myHead.getYaw()) ); drawtext(10, 50, 0.10, 0, 1.0, 0, adc); @@ -560,7 +565,7 @@ void display(void) glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color); glMateriali(GL_FRONT, GL_SHININESS, 96); - // Rotate, translate to camera location + // Rotate, translate to camera location glRotatef(render_pitch, 1, 0, 0); glRotatef(render_yaw, 0, 1, 0); glTranslatef(location[0], location[1], location[2]); @@ -592,11 +597,16 @@ void display(void) if (!display_head) balls.render(); - + // Render the world box if (!display_head && stats_on) render_world_box(); - //glm::vec3 test(0.5, 0.5, 0.5); + glPushMatrix(); + glTranslatef(2,2,2); + glColor3f(1,0,0); + glutSolidCube(1.0); + glPopMatrix(); + //glm::vec3 test(0.5, 0.5, 0.5); //render_vector(&test); glPopMatrix(); @@ -609,7 +619,7 @@ void display(void) glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); - lattice.render(WIDTH, HEIGHT); + //lattice.render(WIDTH, HEIGHT); //drawvec3(100, 100, 0.15, 0, 1.0, 0, myHead.getPos(), 0, 1, 0); glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, pointer_attenuation_quadratic ); diff --git a/util.cpp b/util.cpp index 35933b85a5..91ff2124fa 100644 --- a/util.cpp +++ b/util.cpp @@ -19,6 +19,17 @@ float randFloat () { return (rand()%10000)/10000.f; } +// Return the azimuth angle in degrees between a head position and a sound source, +// given the two positions. +float azimuth_to(glm::vec3 head_pos, glm::vec3 source_pos) { + return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180 / PI; +} + +float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float head_yaw) { + return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180 / PI + render_yaw + head_yaw; +} + + void render_vector(glm::vec3 * vec) { diff --git a/util.h b/util.h index 963d2edff7..3bd3898661 100644 --- a/util.h +++ b/util.h @@ -11,6 +11,9 @@ #include "glm/glm.hpp" +float azimuth_to(glm::vec3 head_pos, glm::vec3 source_pos); +float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float head_yaw); + void outstring(char * string, int length); float randFloat(); void render_world_box();