mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:53:25 +02:00
Remove the code here; will be replacing it based on glow effect work.
This commit is contained in:
parent
94e5c8d4a1
commit
28d306a228
3 changed files with 4 additions and 66 deletions
|
@ -3193,7 +3193,7 @@ void Application::displaySide(Camera& whichCamera) {
|
||||||
// Render the world box
|
// Render the world box
|
||||||
if (!_lookingInMirror->isChecked() && _renderStatsOn->isChecked()) { renderWorldBox(); }
|
if (!_lookingInMirror->isChecked() && _renderStatsOn->isChecked()) { renderWorldBox(); }
|
||||||
|
|
||||||
_ambientOcclusionEffect.render(_glWidget->width(), _glWidget->height());
|
_ambientOcclusionEffect.render();
|
||||||
|
|
||||||
// brad's frustum for debugging
|
// brad's frustum for debugging
|
||||||
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
if (_frustumOn->isChecked()) renderViewFrustum(_viewFrustum);
|
||||||
|
|
|
@ -11,60 +11,6 @@
|
||||||
#include "AmbientOcclusionEffect.h"
|
#include "AmbientOcclusionEffect.h"
|
||||||
#include "ProgramObject.h"
|
#include "ProgramObject.h"
|
||||||
|
|
||||||
ProgramObject* AmbientOcclusionEffect::_program = 0;
|
void AmbientOcclusionEffect::render() {
|
||||||
|
|
||||||
AmbientOcclusionEffect::AmbientOcclusionEffect() : _depthTextureID(0) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void AmbientOcclusionEffect::render(int screenWidth, int screenHeight) {
|
|
||||||
// copy the z buffer into a depth texture
|
|
||||||
if (_depthTextureID == 0) {
|
|
||||||
glGenTextures(1, &_depthTextureID);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, _depthTextureID);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
||||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, screenWidth, screenHeight, 0);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, _depthTextureID);
|
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screenWidth, screenHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now render a full screen quad with that texture
|
|
||||||
if (_program == 0) {
|
|
||||||
switchToResourcesParentIfRequired();
|
|
||||||
_program = new ProgramObject();
|
|
||||||
_program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/ambient_occlusion.frag");
|
|
||||||
_program->link();
|
|
||||||
|
|
||||||
_program->bind();
|
|
||||||
_program->setUniformValue("depthTexture", 0);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_program->bind();
|
|
||||||
}
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
glTexCoord2f(0.0f, 0.0f);
|
|
||||||
glVertex2f(-1.0f, -1.0f);
|
|
||||||
glTexCoord2f(1.0f, 0.0f);
|
|
||||||
glVertex2f(1.0f, -1.0f);
|
|
||||||
glTexCoord2f(1.0f, 1.0f);
|
|
||||||
glVertex2f(1.0f, 1.0f);
|
|
||||||
glTexCoord2f(0.0f, 1.0f);
|
|
||||||
glVertex2f(-1.0f, 1.0f);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
_program->release();
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,7 @@ class ProgramObject;
|
||||||
class AmbientOcclusionEffect {
|
class AmbientOcclusionEffect {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AmbientOcclusionEffect();
|
void render();
|
||||||
|
|
||||||
void render(int screenWidth, int screenHeight);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
GLuint _depthTextureID;
|
|
||||||
|
|
||||||
static ProgramObject* _program;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__AmbientOcclusionEffect__) */
|
#endif /* defined(__interface__AmbientOcclusionEffect__) */
|
||||||
|
|
Loading…
Reference in a new issue