Merge pull request #3504 from ey6es/master

Don't bother using a callback to render the eye vectors; just rely on th...
This commit is contained in:
Philip Rosedale 2014-09-29 12:33:34 -07:00
commit c4be35fa8a
4 changed files with 31 additions and 38 deletions

View file

@ -520,10 +520,9 @@ void Avatar::renderBody(RenderMode renderMode, bool postLighting, float glowLeve
renderAttachments(renderMode); renderAttachments(renderMode);
} }
} }
if (!postLighting) { getHead()->render(1.0f, modelRenderMode, postLighting);
getHead()->render(1.0f, modelRenderMode);
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { if (!postLighting && Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
// Render Hair // Render Hair
glPushMatrix(); glPushMatrix();
glm::vec3 headPosition = getHead()->getPosition(); glm::vec3 headPosition = getHead()->getPosition();
@ -535,7 +534,6 @@ void Avatar::renderBody(RenderMode renderMode, bool postLighting, float glowLeve
glPopMatrix(); glPopMatrix();
} }
} }
}
bool Avatar::shouldRenderHead(const glm::vec3& cameraPosition, RenderMode renderMode) const { bool Avatar::shouldRenderHead(const glm::vec3& cameraPosition, RenderMode renderMode) const {
return true; return true;

View file

@ -211,16 +211,15 @@ void Head::relaxLean(float deltaTime) {
_deltaLeanForward *= relaxationFactor; _deltaLeanForward *= relaxationFactor;
} }
void Head::render(float alpha, Model::RenderMode mode) { void Head::render(float alpha, Model::RenderMode mode, bool postLighting) {
_faceModel.render(alpha, mode); if (postLighting) {
if (_renderLookatVectors && mode != Model::SHADOW_RENDER_MODE) { if (_renderLookatVectors) {
Application::getInstance()->getDeferredLightingEffect()->addPostLightingRenderable(this);
}
}
void Head::renderPostLighting() {
renderLookatVectors(_leftEyePosition, _rightEyePosition, getCorrectedLookAtPosition()); renderLookatVectors(_leftEyePosition, _rightEyePosition, getCorrectedLookAtPosition());
} }
} else {
_faceModel.render(alpha, mode);
}
}
void Head::setScale (float scale) { void Head::setScale (float scale) {
if (_scale == scale) { if (_scale == scale) {

View file

@ -23,7 +23,6 @@
#include "FaceModel.h" #include "FaceModel.h"
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include "world.h" #include "world.h"
#include "renderer/DeferredLightingEffect.h"
enum eyeContactTargets { enum eyeContactTargets {
LEFT_EYE, LEFT_EYE,
@ -36,15 +35,14 @@ const float EYE_EAR_GAP = 0.08f;
class Avatar; class Avatar;
class ProgramObject; class ProgramObject;
class Head : public HeadData, public PostLightingRenderable { class Head : public HeadData {
public: public:
Head(Avatar* owningAvatar); Head(Avatar* owningAvatar);
void init(); void init();
void reset(); void reset();
void simulate(float deltaTime, bool isMine, bool billboard = false); void simulate(float deltaTime, bool isMine, bool billboard = false);
void render(float alpha, Model::RenderMode mode); void render(float alpha, Model::RenderMode mode, bool postLighting);
virtual void renderPostLighting();
void setScale(float scale); void setScale(float scale);
void setPosition(glm::vec3 position) { _position = position; } void setPosition(glm::vec3 position) { _position = position; }
void setAverageLoudness(float averageLoudness) { _averageLoudness = averageLoudness; } void setAverageLoudness(float averageLoudness) { _averageLoudness = averageLoudness; }

View file

@ -1147,10 +1147,9 @@ void MyAvatar::renderBody(RenderMode renderMode, bool postLighting, float glowLe
const Camera *camera = Application::getInstance()->getCamera(); const Camera *camera = Application::getInstance()->getCamera();
const glm::vec3 cameraPos = camera->getPosition() + (camera->getRotation() * glm::vec3(0.0f, 0.0f, 1.0f)) * camera->getDistance(); const glm::vec3 cameraPos = camera->getPosition() + (camera->getRotation() * glm::vec3(0.0f, 0.0f, 1.0f)) * camera->getDistance();
if (shouldRenderHead(cameraPos, renderMode)) { if (shouldRenderHead(cameraPos, renderMode)) {
if (!postLighting) { getHead()->render(1.0f, modelRenderMode, postLighting);
getHead()->render(1.0f, modelRenderMode);
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { if (!postLighting && Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
// Render Hair // Render Hair
glPushMatrix(); glPushMatrix();
glm::vec3 headPosition = getHead()->getPosition(); glm::vec3 headPosition = getHead()->getPosition();
@ -1162,7 +1161,6 @@ void MyAvatar::renderBody(RenderMode renderMode, bool postLighting, float glowLe
glPopMatrix(); glPopMatrix();
} }
} }
}
if (postLighting) { if (postLighting) {
getHand()->render(true, modelRenderMode); getHand()->render(true, modelRenderMode);
} }