mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 09:42:23 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fd30c92d8b
5 changed files with 29 additions and 10 deletions
|
@ -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++) {
|
||||
|
|
|
@ -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,11 @@ 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(origin) = %3.1f, head yaw = %3.1f, render_yaw = %3.1f",
|
||||
-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);
|
||||
|
||||
|
@ -564,7 +568,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]);
|
||||
|
@ -596,7 +600,7 @@ void display(void)
|
|||
|
||||
|
||||
if (!display_head) balls.render();
|
||||
|
||||
|
||||
// Render the world box
|
||||
if (!display_head && stats_on) render_world_box();
|
||||
|
||||
|
@ -618,7 +622,8 @@ 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 );
|
||||
|
||||
|
|
|
@ -19,6 +19,17 @@ float randFloat () {
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#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);
|
||||
float randFloat();
|
||||
void render_world_box();
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue