Merge remote-tracking branch 'upstream/master' into particles

This commit is contained in:
Jeffrey Ventrella 2013-07-10 18:32:42 -07:00
commit 420ecddafb
5 changed files with 28 additions and 12 deletions

11
interface/external/Leap/readme.txt vendored Normal file
View file

@ -0,0 +1,11 @@
Instructions for adding the Leap driver to Interface
Eric Johnston, July 10, 2013
NOTE: Without doing step 2, you will crash at program start time.
1. Copy the Leap sdk folders (lib, include, etc.) into the interface/external/Leap folder. There should be a folder already there called "stub", and this read me.txt should be there as well.
2. IMPORTANT: Copy the file interface/external/Leap/lib/libc++/libLeap.dylib to /usr/lib
3. Delete your build directory, run cmake and build, and you should be all set.

View file

@ -2252,6 +2252,15 @@ void Application::displayOculus(Camera& whichCamera) {
void Application::displaySide(Camera& whichCamera) {
// transform by eye offset
// flip x if in mirror mode (also requires reversing winding order for backface culling)
if (_lookingInMirror->isChecked()) {
glScalef(-1.0f, 1.0f, 1.0f);
glFrontFace(GL_CW);
} else {
glFrontFace(GL_CCW);
}
glm::vec3 eyeOffsetPos = whichCamera.getEyeOffsetPosition();
glm::quat eyeOffsetOrient = whichCamera.getEyeOffsetOrientation();
glm::vec3 eyeOffsetAxis = glm::axis(eyeOffsetOrient);

View file

@ -324,7 +324,7 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyA
// Update torso lean distance based on accelerometer data
const float TORSO_LENGTH = 0.5f;
const float MAX_LEAN = 45.0f;
_head.setLeanSideways(glm::clamp(glm::degrees(atanf(-estimatedPosition.x * _leanScale / TORSO_LENGTH)),
_head.setLeanSideways(glm::clamp(glm::degrees(atanf(estimatedPosition.x * _leanScale / TORSO_LENGTH)),
-MAX_LEAN, MAX_LEAN));
_head.setLeanForward(glm::clamp(glm::degrees(atanf(estimatedPosition.z * _leanScale / TORSO_LENGTH)),
-MAX_LEAN, MAX_LEAN));
@ -1222,7 +1222,7 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) {
// Always render other people, and render myself when beyond threshold distance
if (b == BODY_BALL_HEAD_BASE) { // the head is rendered as a special
if (alpha > 0.0f) {
_head.render(lookingInMirror, alpha);
_head.render(alpha);
}
} else if (alpha > 0.0f) {
// Render the body ball sphere

View file

@ -67,7 +67,6 @@ Head::Head(Avatar* owningAvatar) :
_audioAttack(0.0f),
_returnSpringScale(1.0f),
_bodyRotation(0.0f, 0.0f, 0.0f),
_lookingInMirror(false),
_renderLookatVectors(false),
_mohawkTriangleFan(NULL),
_mohawkColors(NULL),
@ -283,11 +282,10 @@ void Head::calculateGeometry() {
}
void Head::render(bool lookingInMirror, float alpha) {
void Head::render(float alpha) {
_renderAlpha = alpha;
_lookingInMirror = lookingInMirror;
calculateGeometry();
glEnable(GL_DEPTH_TEST);
@ -375,8 +373,8 @@ void Head::renderMohawk() {
} else {
glPushMatrix();
glTranslatef(_position.x, _position.y, _position.z);
glRotatef((_lookingInMirror ? (_bodyRotation.y - _yaw) : (_bodyRotation.y + _yaw)), 0, 1, 0);
glRotatef(_lookingInMirror ? _roll: -_roll, 0, 0, 1);
glRotatef(_bodyRotation.y + _yaw, 0, 1, 0);
glRotatef(-_roll, 0, 0, 1);
glRotatef(-_pitch - _bodyRotation.x, 1, 0, 0);
glBegin(GL_TRIANGLE_FAN);
@ -391,8 +389,7 @@ void Head::renderMohawk() {
}
glm::quat Head::getOrientation() const {
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ?
glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll)));
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(glm::vec3(_pitch, _yaw, _roll)));
}
glm::quat Head::getCameraOrientation () const {

View file

@ -35,7 +35,7 @@ public:
void init();
void reset();
void simulate(float deltaTime, bool isMine);
void render(bool lookingInMirror, float alpha);
void render(float alpha);
void renderMohawk();
void setScale (float scale ) { _scale = scale; }
@ -102,7 +102,6 @@ private:
float _audioAttack;
float _returnSpringScale; //strength of return springs
glm::vec3 _bodyRotation;
bool _lookingInMirror;
bool _renderLookatVectors;
HairTuft _hairTuft[NUM_HAIR_TUFTS];
glm::vec3* _mohawkTriangleFan;