From 467a9582c7f336eaba5e35275af7f815bcb6600b Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Mon, 15 Sep 2014 13:29:03 -0700 Subject: [PATCH] Somehow my reverting the ambient occlusion effect didn't take. --- interface/src/Application.cpp | 18 ++++++++---------- interface/src/Application.h | 1 + .../src/renderer/AmbientOcclusionEffect.cpp | 9 ++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8131b7b882..011df7757e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2895,6 +2895,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { // restore default, white specular glMaterialfv(GL_FRONT, GL_SPECULAR, WORLD_SPECULAR_COLOR); + // render the ambient occlusion effect if enabled + if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { + PerformanceTimer perfTimer("ambientOcclusion"); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "Application::displaySide() ... AmbientOcclusion..."); + _ambientOcclusionEffect.render(); + } + _nodeBoundsDisplay.draw(); } @@ -2910,16 +2918,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { _myAvatar->renderLaserPointers(); } } - - if (!selfAvatarOnly) { - // render the ambient occlusion effect if enabled - if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { - PerformanceTimer perfTimer("ambientOcclusion"); - PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), - "Application::displaySide() ... AmbientOcclusion..."); - _ambientOcclusionEffect.render(); - } - } { PerformanceTimer perfTimer("lighting"); diff --git a/interface/src/Application.h b/interface/src/Application.h index 799a0501c1..d17bacd413 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -248,6 +248,7 @@ public: GeometryCache* getGeometryCache() { return &_geometryCache; } AnimationCache* getAnimationCache() { return &_animationCache; } TextureCache* getTextureCache() { return &_textureCache; } + DeferredLightingEffect* getDeferredLightingEffect() { return &_deferredLightingEffect; } GlowEffect* getGlowEffect() { return &_glowEffect; } ControllerScriptingInterface* getControllerScriptingInterface() { return &_controllerScriptingInterface; } diff --git a/interface/src/renderer/AmbientOcclusionEffect.cpp b/interface/src/renderer/AmbientOcclusionEffect.cpp index 4941f715c0..33a0b6e77d 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.cpp +++ b/interface/src/renderer/AmbientOcclusionEffect.cpp @@ -42,7 +42,6 @@ void AmbientOcclusionEffect::init() { for (int i = 0; i < SAMPLE_KERNEL_SIZE; i++) { // square the length in order to increase density towards the center glm::vec3 vector = glm::sphericalRand(1.0f); - vector.z = glm::abs(vector.z); float scale = randFloat(); const float MIN_VECTOR_LENGTH = 0.01f; const float MAX_VECTOR_LENGTH = 1.0f; @@ -73,10 +72,10 @@ void AmbientOcclusionEffect::init() { unsigned char rotationData[ROTATION_WIDTH * ROTATION_HEIGHT * ELEMENTS_PER_PIXEL]; unsigned char* rotation = rotationData; for (int i = 0; i < ROTATION_WIDTH * ROTATION_HEIGHT; i++) { - float angle = randFloatInRange(0.0f, TWO_PI); - *rotation++ = ((glm::cos(angle) + 1.0f) / 2.0f) * 255.0f; - *rotation++ = ((glm::sin(angle) + 1.0f) / 2.0f) * 255.0f; - *rotation++ = 0.0f; + glm::vec3 vector = glm::sphericalRand(1.0f); + *rotation++ = ((vector.x + 1.0f) / 2.0f) * 255.0f; + *rotation++ = ((vector.y + 1.0f) / 2.0f) * 255.0f; + *rotation++ = ((vector.z + 1.0f) / 2.0f) * 255.0f; } glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ROTATION_WIDTH, ROTATION_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, rotationData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);