Ground plane moved to 0->10 and lines are exactly 1 meter

This commit is contained in:
Philip Rosedale 2013-05-02 22:28:41 -07:00
parent 581365f1f1
commit 9716ea9550
4 changed files with 24 additions and 33 deletions

View file

@ -1508,8 +1508,13 @@ glm::vec3 Avatar::getGravity(glm::vec3 pos) {
// For now, we'll test this with a simple global lookup, but soon we will add getting this
// from the domain/voxelserver (or something similar)
//
if (glm::length(pos) < 5.f) {
// If near the origin sphere, turn gravity ON
if ((pos.x > 0.f) &&
(pos.x < 10.f) &&
(pos.z > 0.f) &&
(pos.z < 10.f) &&
(pos.y > 0.f) &&
(pos.y < 3.f)) {
// If above ground plane, turn gravity on
return glm::vec3(0.f, -1.f, 0.f);
} else {
// If flying in space, turn gravity OFF

View file

@ -213,42 +213,28 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
}
void drawGroundPlaneGrid( float size, int resolution )
void drawGroundPlaneGrid(float size)
{
glColor3f( 0.4f, 0.5f, 0.3f );
glColor3f( 0.4f, 0.5f, 0.3f );
glLineWidth(2.0);
float gridSize = 10.0;
int gridResolution = 20;
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();
}
for (float x = 0; x <= size; x++) {
glBegin(GL_LINES);
glVertex3f(x, 0.0f, 0);
glVertex3f(x, 0.0f, size);
glVertex3f(0, 0.0f, x);
glVertex3f(size, 0.0f, x);
glEnd();
}
// Draw a translucent quad just underneath the grid.
glColor4f(0.5, 0.5, 0.5, 0.4);
glBegin(GL_QUADS);
glVertex3f(-gridSize * ONE_HALF, 0, -gridSize * ONE_HALF);
glVertex3f(gridSize * ONE_HALF, 0, -gridSize * ONE_HALF);
glVertex3f(gridSize * ONE_HALF, 0, gridSize * ONE_HALF);
glVertex3f(-gridSize * ONE_HALF, 0, gridSize * ONE_HALF);
glVertex3f(0, 0, 0);
glVertex3f(size, 0, 0);
glVertex3f(size, 0, size);
glVertex3f(0, 0, size);
glEnd();
}

View file

@ -42,7 +42,7 @@ 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 drawGroundPlaneGrid(float size);
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );

View file

@ -847,7 +847,7 @@ void display(void)
glPopMatrix();
//draw a grid ground plane....
drawGroundPlaneGrid( 5.0f, 9 );
drawGroundPlaneGrid(10.f);
// Draw voxels
if ( showingVoxels )