moved renderOrientstionDiretions to Utils

This commit is contained in:
Jeffrey Ventrella 2013-04-16 23:39:43 -07:00
parent bd7c4273c3
commit a6f82e1236
5 changed files with 49 additions and 7 deletions

View file

@ -602,7 +602,9 @@ void Head::render(int faceToFace, int isMine) {
}
//this has been moved to Utils.cpp
/*
void Head::renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) {
glm::vec3 pRight = position + orientation.right * size;
glm::vec3 pUp = position + orientation.up * size;
@ -610,22 +612,23 @@ void Head::renderOrientationDirections( glm::vec3 position, Orientation orientat
glColor3f( 1.0f, 0.0f, 0.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, bone[ AVATAR_BONE_HEAD ].position.z );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pRight.x, pRight.y, pRight.z );
glEnd();
glColor3f( 0.0f, 1.0f, 0.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, bone[ AVATAR_BONE_HEAD ].position.z );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pUp.x, pUp.y, pUp.z );
glEnd();
glColor3f( 0.0f, 0.0f, 1.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, bone[ AVATAR_BONE_HEAD ].position.z );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pFront.x, pFront.y, pFront.z );
glEnd();
}
*/

View file

@ -12,7 +12,7 @@
#include <iostream>
#include <AvatarData.h>
#include <Orientation.h> // added by Ventrella as a utility
#include <Orientation.h>
#include "Field.h"
#include "world.h"
@ -139,7 +139,7 @@ class Head : public AvatarData {
void renderBody();
void renderHead( int faceToFace, int isMine );
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
//void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
void simulate(float);

View file

@ -16,6 +16,7 @@
#include "world.h"
#include "Util.h"
// 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.0f / PIf;
@ -202,3 +203,30 @@ void drawGroundPlaneGrid( float size, int resolution )
}
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) {
glm::vec3 pRight = position + orientation.right * size;
glm::vec3 pUp = position + orientation.up * size;
glm::vec3 pFront = position + orientation.front * size;
glColor3f( 1.0f, 0.0f, 0.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pRight.x, pRight.y, pRight.z );
glEnd();
glColor3f( 0.0f, 1.0f, 0.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pUp.x, pUp.y, pUp.z );
glEnd();
glColor3f( 0.0f, 0.0f, 1.0f );
glBegin( GL_LINE_STRIP );
glVertex3f( position.x, position.y, position.z );
glVertex3f( pFront.x, pFront.y, pFront.z );
glEnd();
}

View file

@ -17,6 +17,9 @@
#include <glm/glm.hpp>
#include <Orientation.h>
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);
@ -30,7 +33,8 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
float r=1.0, float g=1.0, float b=1.0);
double diffclock(timeval *clock1,timeval *clock2);
void drawGroundPlaneGrid( float size, int resolution );
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
#endif

View file

@ -769,6 +769,13 @@ void display(void)
//quick test for camera ortho-normal sanity check...
if (::starsOn) {
// should be the first rendering pass - w/o depth buffer / lighting
stars.render(fov);