Merge branch 'master' of https://github.com/worklist/hifi into voxel_animation

This commit is contained in:
ZappoMan 2013-05-23 12:20:34 -07:00
commit 089d8d525e
3 changed files with 37 additions and 37 deletions

View file

@ -52,7 +52,7 @@ using namespace std;
static char STAR_FILE[] = "https://s3-us-west-1.amazonaws.com/highfidelity/stars.txt";
static char STAR_CACHE_FILE[] = "cachedStars.txt";
const glm::vec3 START_LOCATION(6.1f, 0, 1.4f); // Where one's own agent begins in the world
const glm::vec3 START_LOCATION(0.f, 0.f, 0.f); // Where one's own agent begins in the world
// (will be overwritten if avatar data file is found)
const int IDLE_SIMULATE_MSECS = 16; // How often should call simulate and other stuff
@ -308,8 +308,7 @@ void Application::paintGL() {
} else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
_myCamera.setTargetPosition(_myAvatar.getSpringyHeadPosition());
_myCamera.setTargetRotation(_myAvatar.getAbsoluteHeadYaw(),
0.0f,
//-_myAvatar.getAbsoluteHeadPitch(),
_myAvatar.getAbsoluteHeadPitch(),
0.0f);
// Take a look at whether we are inside head, don't render it if so.
const float HEAD_RENDER_DISTANCE = 0.5;
@ -1238,7 +1237,7 @@ void Application::initMenu() {
_renderStatsOn->setShortcut(Qt::Key_Slash);
(_logOn = toolsMenu->addAction("Log"))->setCheckable(true);
_logOn->setChecked(true);
_logOn->setChecked(false);
_logOn->setShortcut(Qt::CTRL | Qt::Key_L);
QMenu* voxelMenu = menuBar->addMenu("Voxels");
@ -2055,7 +2054,6 @@ void Application::deleteVoxelUnderCursor() {
}
void Application::resetSensors() {
_myAvatar.setPosition(START_LOCATION);
_headMouseX = _mouseX = _glWidget->width() / 2;
_headMouseY = _mouseY = _glWidget->height() / 2;

View file

@ -67,7 +67,7 @@ float lightBlue [] = {0.7, 0.8, 1.0 };
bool usingBigSphereCollisionTest = true;
float chatMessageScale = 0.0015;
float chatMessageHeight = 0.45;
float chatMessageHeight = 0.10;
Avatar::Avatar(bool isMine) :
_isMine(isMine),
@ -380,11 +380,13 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
// Compute instantaneous acceleration
float acceleration = glm::distance(getVelocity(), oldVelocity) / deltaTime;
const float ACCELERATION_PITCH_DECAY = 0.4f;
const float ACCELERATION_YAW_DECAY = 0.4f;
// Decay HeadPitch as a function of acceleration, so that you look straight ahead when
// you start moving, but don't do this with an HMD like the Oculus.
if (!OculusManager::isConnected()) {
_head.setPitch(_head.getPitch() * (1.f - acceleration * ACCELERATION_PITCH_DECAY * deltaTime));
_head.setYaw(_head.getYaw() * (1.f - acceleration * ACCELERATION_YAW_DECAY * deltaTime));
}
//apply the head lean values to the springy position...
@ -729,7 +731,7 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
_cameraPosition = cameraPosition; // store this for use in various parts of the code
if (usingBigSphereCollisionTest) {
if (_isMine && usingBigSphereCollisionTest) {
// show TEST big sphere
glColor4f(0.5f, 0.6f, 0.8f, 0.7);
glPushMatrix();
@ -772,7 +774,9 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
float modelview[16];
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
glTranslatef(_position.x, _position.y + chatMessageHeight, _position.z);
glTranslatef(_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.x,
_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.y + chatMessageHeight,
_joint[AVATAR_JOINT_HEAD_BASE].springyPosition.z);
glRotatef(atan2(-modelview[2], -modelview[10]) * 180 / PI, 0, 1, 0);
glColor3f(0, 0.8, 0);
@ -837,8 +841,6 @@ void Avatar::initializeSkeleton() {
_joint[ AVATAR_JOINT_RIGHT_COLLAR ].parent = AVATAR_JOINT_CHEST;
_joint[ AVATAR_JOINT_RIGHT_SHOULDER ].parent = AVATAR_JOINT_RIGHT_COLLAR;
_joint[ AVATAR_JOINT_RIGHT_ELBOW ].parent = AVATAR_JOINT_RIGHT_SHOULDER;
_joint[ AVATAR_JOINT_RIGHT_WRIST ].parent = AVATAR_JOINT_RIGHT_ELBOW;
_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].parent = AVATAR_JOINT_RIGHT_WRIST;
_joint[ AVATAR_JOINT_LEFT_HIP ].parent = AVATAR_JOINT_PELVIS;
_joint[ AVATAR_JOINT_LEFT_KNEE ].parent = AVATAR_JOINT_LEFT_HIP;
_joint[ AVATAR_JOINT_LEFT_HEEL ].parent = AVATAR_JOINT_LEFT_KNEE;
@ -1137,12 +1139,12 @@ void Avatar::renderBody(bool lookingInMirror) {
_head.render(lookingInMirror);
}
} else {
glColor3f(
skinColor[0] + _joint[b].touchForce * 0.3f,
skinColor[1] - _joint[b].touchForce * 0.2f,
skinColor[2] - _joint[b].touchForce * 0.1f
);
skinColor[0] + _joint[b].touchForce * 0.3f,
skinColor[1] - _joint[b].touchForce * 0.2f,
skinColor[2] - _joint[b].touchForce * 0.1f
);
glPushMatrix();
glTranslatef(_joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z);
@ -1152,29 +1154,28 @@ void Avatar::renderBody(bool lookingInMirror) {
}
for (int j = 1; j < NUM_AVATAR_JOINTS; j++) {
if (_joint[j].parent != AVATAR_JOINT_NULL)
if ((j != AVATAR_JOINT_HEAD_TOP )
&& (j != AVATAR_JOINT_HEAD_BASE )
&& (j != AVATAR_JOINT_PELVIS )
&& (j != AVATAR_JOINT_TORSO )
&& (j != AVATAR_JOINT_CHEST )
&& (j != AVATAR_JOINT_LEFT_COLLAR )
&& (j != AVATAR_JOINT_LEFT_SHOULDER )
&& (j != AVATAR_JOINT_RIGHT_COLLAR )
&& (j != AVATAR_JOINT_RIGHT_SHOULDER)) {
// Render cone sections connecting the joint positions
glColor3fv(darkSkinColor);
renderJointConnectingCone
(
_joint[_joint[j].parent ].springyPosition,
_joint[j ].springyPosition,
_joint[_joint[j].parent ].radius * 0.8,
_joint[j ].radius * 0.8
);
}
if (_joint[j].parent != AVATAR_JOINT_NULL)
if ((j != AVATAR_JOINT_HEAD_TOP )
&& (j != AVATAR_JOINT_HEAD_BASE )
&& (j != AVATAR_JOINT_PELVIS )
&& (j != AVATAR_JOINT_TORSO )
&& (j != AVATAR_JOINT_CHEST )
&& (j != AVATAR_JOINT_LEFT_COLLAR )
&& (j != AVATAR_JOINT_LEFT_SHOULDER )
&& (j != AVATAR_JOINT_RIGHT_COLLAR )
&& (j != AVATAR_JOINT_RIGHT_SHOULDER)) {
// Render cone sections connecting the joint positions
glColor3fv(darkSkinColor);
renderJointConnectingCone
(
_joint[_joint[j].parent ].springyPosition,
_joint[j ].springyPosition,
_joint[_joint[j].parent ].radius * 0.8,
_joint[j ].radius * 0.8
);
}
}
}
void Avatar::setHeadFromGyros(glm::vec3* eulerAngles, glm::vec3* angularVelocity, float deltaTime, float smoothingTime) {
//
// Given absolute position and angular velocity information, update the avatar's head angles

View file

@ -28,7 +28,8 @@ LogDisplay LogDisplay::instance;
LogDisplay::LogDisplay() :
_textRenderer(MONO_FONT_FAMILY, -1, -1, false, TextRenderer::SHADOW_EFFECT),
_textRenderer(SANS_FONT_FAMILY, -1, -1, false, TextRenderer::SHADOW_EFFECT),
_stream(DEFAULT_STREAM),
_chars(0l),
_lines(0l),