Somehow my reverting the ambient occlusion effect didn't take.

This commit is contained in:
Andrzej Kapolka 2014-09-15 13:29:03 -07:00
parent e3a1341be1
commit 467a9582c7
3 changed files with 13 additions and 15 deletions

View file

@ -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");

View file

@ -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; }

View file

@ -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);