Merge remote-tracking branch 'origin/master'

This commit is contained in:
Stephen Birarda 2013-01-25 11:39:18 -08:00
commit fa3ffa8bc4
5 changed files with 29 additions and 10 deletions

View file

@ -11,7 +11,7 @@
Lattice::Lattice(int w, int h) { Lattice::Lattice(int w, int h) {
width = w; width = w;
height = h; height = h;
tilegap = 3; tilegap = 2;
lastindex = -1; lastindex = -1;
tiles = new Tile[width*height]; tiles = new Tile[width*height];
for (int i = 0; i < (width*height); i++) { for (int i = 0; i < (width*height); i++) {

View file

@ -110,7 +110,7 @@ Cloud cloud(0, // Particles
VoxelSystem voxels(0, box); VoxelSystem voxels(0, box);
Lattice lattice(15,10); Lattice lattice(160,100);
Finger myFinger(WIDTH, HEIGHT); Finger myFinger(WIDTH, HEIGHT);
#define RENDER_FRAME_MSECS 8 #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 yaw =0.f; // The yaw, pitch for the avatar head
float pitch = 0.f; // float pitch = 0.f; //
float start_yaw = 135.0; float start_yaw = 116;
float render_yaw = start_yaw; float render_yaw = start_yaw;
float render_pitch = 0.f; float render_pitch = 0.f;
float render_yaw_rate = 0.f; float render_yaw_rate = 0.f;
@ -129,7 +129,10 @@ float lateral_vel = 0.f;
// Manage speed and direction of motion // Manage speed and direction of motion
GLfloat fwd_vec[] = {0.0, 0.0, 1.0}; 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[] = { 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]}; GLfloat location[] = {start_location[0], start_location[1], start_location[2]};
float fwd_vel = 0.0f; float fwd_vel = 0.0f;
@ -253,10 +256,11 @@ void display_stats(void)
} }
#endif #endif
char adc[200]; char adc[200];
sprintf(adc, "location = %3.1f,%3.1f,%3.1f", sprintf(adc, "location = %3.1f,%3.1f,%3.1f, angle_to(origin) = %3.1f, head yaw = %3.1f, render_yaw = %3.1f",
location[0], location[1], location[2] -location[0], -location[1], -location[2],
angle_to(myHead.getPos()*-1.f, glm::vec3(0,0,0), render_yaw, myHead.getYaw()),
myHead.getYaw(), render_yaw
); );
drawtext(10, 50, 0.10, 0, 1.0, 0, adc); drawtext(10, 50, 0.10, 0, 1.0, 0, adc);
@ -618,7 +622,8 @@ void display(void)
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING); 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); //drawvec3(100, 100, 0.15, 0, 1.0, 0, myHead.getPos(), 0, 1, 0);
glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, pointer_attenuation_quadratic ); glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, pointer_attenuation_quadratic );

View file

@ -19,6 +19,17 @@ float randFloat () {
return (rand()%10000)/10000.f; return (rand()%10000)/10000.f;
} }
// Return the azimuth angle in degrees between two points.
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;
}
// Return the angle in degrees between the head and an object in the scene. The value is zero if you are looking right at it. The angle is negative if the object is to your right.
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) void render_vector(glm::vec3 * vec)
{ {

View file

@ -11,6 +11,9 @@
#include "glm.hpp" #include "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); void outstring(char * string, int length);
float randFloat(); float randFloat();
void render_world_box(); void render_world_box();