added grid plane to aid in testing avatar navigation

This commit is contained in:
Jeffrey Ventrella 2013-04-09 21:14:24 -07:00
parent 81b311f753
commit 1b833fb4a9
2 changed files with 69 additions and 14 deletions

View file

@ -103,15 +103,15 @@ enum AvatarBones
struct AvatarBone
{
AvatarBones parent;
glm::vec3 worldPosition;
glm::vec3 defaultPosePosition;
glm::dvec3 velocity;
float yaw;
float pitch;
float roll;
Orientation worldOrientation;
float length;
AvatarBones parent; // which bone is this bone connected to?
glm::vec3 worldPosition; // the position at the "end" of the bone
glm::vec3 defaultPosePosition; // the parent relative position when the avatar is in the "T-pose"
glm::dvec3 velocity; // pertains to spring physics
float yaw; // the yaw Euler angle of the bone rotation off the parent
float pitch; // the pitch Euler angle of the bone rotation off the parent
float roll; // the roll Euler angle of the bone rotation off the parent
Orientation worldOrientation; // three orthogonal normals determined by yaw, pitch, roll
float length; // the length of the bone
};
struct Avatar

View file

@ -109,6 +109,8 @@ int starsTiles = 20;
double starsLod = 1.0;
#endif
bool showingVoxels = false;
glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE);
ParticleSystem balls(0,
box,
@ -569,8 +571,42 @@ int render_test_direction = 1;
void drawGroundPlaneGrid( float size, int resolution )
{
glColor3f( 0.4f, 0.5f, 0.3f );
glLineWidth(2.0);
float gridSize = 10.0;
int gridResolution = 10;
for (int g=0; g<gridResolution; g++)
{
float fraction = (float)g / (float)( gridResolution - 1 );
float inc = -gridSize * ONE_HALF + fraction * gridSize;
glBegin( GL_LINE_STRIP );
glVertex3f( inc, 0.0f, -gridSize * ONE_HALF );
glVertex3f( inc, 0.0f, gridSize * ONE_HALF );
glEnd();
}
for (int g=0; g<gridResolution; g++)
{
float fraction = (float)g / (float)( gridResolution - 1 );
float inc = -gridSize * ONE_HALF + fraction * gridSize;
glBegin( GL_LINE_STRIP );
glVertex3f( -gridSize * ONE_HALF, 0.0f, inc );
glVertex3f( gridSize * ONE_HALF, 0.0f, inc );
glEnd();
}
}
void display(void)
{
//printf( "avatar head lookat = %f, %f, %f\n", myHead.getAvatarHeadLookatDirection().x, myHead.getAvatarHeadLookatDirection().y, myHead.getAvatarHeadLookatDirection().z );
PerfStat("display");
glEnable(GL_LINE_SMOOTH);
@ -620,7 +656,7 @@ void display(void)
// set the camera to third-person view behind my av
//----------------------------------------------------
myCamera.setYaw ( 180.0 - myHead.getAvatarYaw() );
myCamera.setPitch ( 10.0 );
myCamera.setPitch ( 0.0 );
myCamera.setRoll ( 0.0 );
myCamera.setUp ( 0.2 );
myCamera.setDistance( 1.6 );
@ -644,17 +680,34 @@ void display(void)
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
//---------------------------------------------
// draw a red sphere
//---------------------------------------------
float sphereRadius = 0.25f;
glColor3f(1,0,0);
glutSolidSphere(0.25, 15, 15);
glPushMatrix();
glTranslatef( 0.0f, sphereRadius, 0.0f );
glutSolidSphere( sphereRadius, 15, 15 );
glPopMatrix();
//---------------------------------------------
// draw a grid gound plane....
//---------------------------------------------
drawGroundPlaneGrid( 5.0f, 9 );
// Draw cloud of dots
glDisable( GL_POINT_SPRITE_ARB );
glDisable( GL_TEXTURE_2D );
// if (!display_head) cloud.render();
// Draw voxels
voxels.render();
if ( showingVoxels )
{
voxels.render();
}
// Draw field vectors
if (display_field) field.render();
@ -1160,6 +1213,8 @@ void audioMixerUpdate(in_addr_t newMixerAddress, in_port_t newMixerPort) {
}
#endif
int main(int argc, const char * argv[])
{
const char* domainIP = getCmdOption(argc, argv, "--domain");