mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:40:27 +02:00
Merge remote-tracking branch 'upstream/master' into menu
This commit is contained in:
commit
98b144d675
13 changed files with 305 additions and 57 deletions
|
@ -45,6 +45,12 @@ endforeach(SUBDIR)
|
||||||
# project subdirectories
|
# project subdirectories
|
||||||
add_subdirectory(src/starfield)
|
add_subdirectory(src/starfield)
|
||||||
|
|
||||||
|
find_package(Qt5Core REQUIRED)
|
||||||
|
find_package(Qt5Gui REQUIRED)
|
||||||
|
find_package(Qt5Network REQUIRED)
|
||||||
|
find_package(Qt5OpenGL REQUIRED)
|
||||||
|
find_package(Qt5Svg REQUIRED)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# set how the icon shows up in the Info.plist file
|
# set how the icon shows up in the Info.plist file
|
||||||
SET(MACOSX_BUNDLE_ICON_FILE interface.icns)
|
SET(MACOSX_BUNDLE_ICON_FILE interface.icns)
|
||||||
|
@ -64,15 +70,8 @@ if (APPLE)
|
||||||
SET(INTERFACE_SRCS ${INTERFACE_SRCS} ${DIR_CONTENTS})
|
SET(INTERFACE_SRCS ${INTERFACE_SRCS} ${DIR_CONTENTS})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
|
||||||
find_package(Qt5Gui REQUIRED)
|
|
||||||
find_package(Qt5Network REQUIRED)
|
|
||||||
find_package(Qt5OpenGL REQUIRED)
|
|
||||||
find_package(Qt5Svg REQUIRED)
|
|
||||||
|
|
||||||
set(QUAZIP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/quazip)
|
set(QUAZIP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/quazip)
|
||||||
add_subdirectory(external/fervor/)
|
add_subdirectory(external/fervor/)
|
||||||
include_directories(external/fervor/)
|
include_directories(external/fervor/)
|
||||||
|
@ -101,12 +100,12 @@ find_package(UVCCameraControl)
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
|
|
||||||
# let the source know that we have OpenNI/NITE for Kinect
|
# let the source know that we have OpenNI/NITE for Kinect
|
||||||
if (OPENNI_FOUND)
|
if (OPENNI_FOUND AND NOT DISABLE_OPENNI)
|
||||||
add_definitions(-DHAVE_OPENNI)
|
add_definitions(-DHAVE_OPENNI)
|
||||||
include_directories(SYSTEM ${OPENNI_INCLUDE_DIRS})
|
include_directories(SYSTEM ${OPENNI_INCLUDE_DIRS})
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${OPENNI_INCLUDE_DIRS}")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${OPENNI_INCLUDE_DIRS}")
|
||||||
target_link_libraries(${TARGET_NAME} ${OPENNI_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${OPENNI_LIBRARIES})
|
||||||
endif (OPENNI_FOUND)
|
endif (OPENNI_FOUND AND NOT DISABLE_OPENNI)
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Core Gui Network OpenGL Svg)
|
qt5_use_modules(${TARGET_NAME} Core Gui Network OpenGL Svg)
|
||||||
|
|
||||||
|
|
28
interface/resources/shaders/diffuse.frag
Normal file
28
interface/resources/shaders/diffuse.frag
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
//
|
||||||
|
// diffuse.frag
|
||||||
|
// fragment shader
|
||||||
|
//
|
||||||
|
// Created by Andrzej Kapolka on 8/14/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
// the texture containing the original color
|
||||||
|
uniform sampler2D originalTexture;
|
||||||
|
|
||||||
|
// the texture containing the diffused color
|
||||||
|
uniform sampler2D diffusedTexture;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
float ds = dFdx(gl_TexCoord[0].s);
|
||||||
|
float dt = dFdy(gl_TexCoord[0].t);
|
||||||
|
gl_FragColor = (texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(-ds, -dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(0.0, -dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(ds, -dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(ds, 0.0)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(ds, dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(0.0, dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(-ds, dt)) +
|
||||||
|
texture2D(diffusedTexture, gl_TexCoord[0].st + vec2(-ds, 0.0))) / 8.5 + texture2D(originalTexture, gl_TexCoord[0].st) * 0.1;
|
||||||
|
}
|
17
interface/resources/shaders/glow_add.frag
Normal file
17
interface/resources/shaders/glow_add.frag
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
//
|
||||||
|
// glow_add.frag
|
||||||
|
// fragment shader
|
||||||
|
//
|
||||||
|
// Created by Andrzej Kapolka on 8/14/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
// the texture containing the original color
|
||||||
|
uniform sampler2D originalTexture;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
vec4 color = texture2D(originalTexture, gl_TexCoord[0].st);
|
||||||
|
gl_FragColor = color * (1.0 + color.a);
|
||||||
|
}
|
20
interface/resources/shaders/glow_add_separate.frag
Normal file
20
interface/resources/shaders/glow_add_separate.frag
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
//
|
||||||
|
// glow_add_separate.frag
|
||||||
|
// fragment shader
|
||||||
|
//
|
||||||
|
// Created by Andrzej Kapolka on 8/14/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
// the texture containing the original color
|
||||||
|
uniform sampler2D originalTexture;
|
||||||
|
|
||||||
|
// the texture containing the blurred color
|
||||||
|
uniform sampler2D blurredTexture;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
vec4 blurred = texture2D(blurredTexture, gl_TexCoord[0].st);
|
||||||
|
gl_FragColor = blurred * blurred.a + texture2D(originalTexture, gl_TexCoord[0].st) * (1.0 + blurred.a * 0.5);
|
||||||
|
}
|
|
@ -4,25 +4,21 @@
|
||||||
// vertical_blur.frag
|
// vertical_blur.frag
|
||||||
// fragment shader
|
// fragment shader
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 8/8/13.
|
// Created by Andrzej Kapolka on 8/14/13.
|
||||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
// the texture containing the original color
|
|
||||||
uniform sampler2D originalTexture;
|
|
||||||
|
|
||||||
// the texture containing the horizontally blurred color
|
// the texture containing the horizontally blurred color
|
||||||
uniform sampler2D horizontallyBlurredTexture;
|
uniform sampler2D originalTexture;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
float dt = dFdy(gl_TexCoord[0].t);
|
float dt = dFdy(gl_TexCoord[0].t);
|
||||||
vec4 blurred = (texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -7.5)) +
|
gl_FragColor = (texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * -7.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -5.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * -5.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -3.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * -3.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -1.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * -1.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 1.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * 1.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 3.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * 3.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 5.5)) +
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * 5.5)) +
|
||||||
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 7.5))) / 8.0;
|
texture2D(originalTexture, gl_TexCoord[0].st + vec2(0.0, dt * 7.5))) / 8.0;
|
||||||
gl_FragColor = blurred * blurred.a + texture2D(originalTexture, gl_TexCoord[0].st) * (1.0 + blurred.a * 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
28
interface/resources/shaders/vertical_blur_add.frag
Normal file
28
interface/resources/shaders/vertical_blur_add.frag
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
//
|
||||||
|
// vertical_blur_add.frag
|
||||||
|
// fragment shader
|
||||||
|
//
|
||||||
|
// Created by Andrzej Kapolka on 8/8/13.
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
// the texture containing the original color
|
||||||
|
uniform sampler2D originalTexture;
|
||||||
|
|
||||||
|
// the texture containing the horizontally blurred color
|
||||||
|
uniform sampler2D horizontallyBlurredTexture;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
float dt = dFdy(gl_TexCoord[0].t);
|
||||||
|
vec4 blurred = (texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -7.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -5.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -3.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * -1.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 1.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 3.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 5.5)) +
|
||||||
|
texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 7.5))) / 8.0;
|
||||||
|
gl_FragColor = blurred * blurred.a + texture2D(originalTexture, gl_TexCoord[0].st) * (1.0 + blurred.a * 0.5);
|
||||||
|
}
|
|
@ -1929,17 +1929,20 @@ void Application::updateAvatar(float deltaTime) {
|
||||||
|
|
||||||
const float MIDPOINT_OF_SCREEN = 0.5;
|
const float MIDPOINT_OF_SCREEN = 0.5;
|
||||||
|
|
||||||
|
// Only use gyro to set lookAt if mouse hasn't selected an avatar
|
||||||
|
if (!_isLookingAtOtherAvatar) {
|
||||||
|
|
||||||
// Set lookAtPosition if an avatar is at the center of the screen
|
// Set lookAtPosition if an avatar is at the center of the screen
|
||||||
glm::vec3 screenCenterRayOrigin, screenCenterRayDirection;
|
glm::vec3 screenCenterRayOrigin, screenCenterRayDirection;
|
||||||
_viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
|
_viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
|
||||||
|
|
||||||
glm::vec3 eyePosition;
|
glm::vec3 eyePosition;
|
||||||
|
|
||||||
_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition);
|
_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition);
|
||||||
if (_isLookingAtOtherAvatar) {
|
if (_isLookingAtOtherAvatar) {
|
||||||
glm::vec3 myLookAtFromMouse(eyePosition);
|
glm::vec3 myLookAtFromMouse(eyePosition);
|
||||||
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2343,6 +2346,7 @@ void Application::displaySide(Camera& whichCamera) {
|
||||||
if (!avatar->isInitialized()) {
|
if (!avatar->isInitialized()) {
|
||||||
avatar->init();
|
avatar->init();
|
||||||
}
|
}
|
||||||
|
// Set lookAt to myCamera on client side if other avatars are looking at client
|
||||||
if (isLookingAtMyAvatar(avatar)) {
|
if (isLookingAtMyAvatar(avatar)) {
|
||||||
avatar->getHead().setLookAtPosition(_myCamera.getPosition());
|
avatar->getHead().setLookAtPosition(_myCamera.getPosition());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,19 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
int main(int argc, const char * argv[]) {
|
int main(int argc, const char * argv[]) {
|
||||||
timeval startup_time;
|
timeval startup_time;
|
||||||
gettimeofday(&startup_time, NULL);
|
gettimeofday(&startup_time, NULL);
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
const QString QT_RELEASE_PLUGIN_PATH = "/usr/local/lib/qt5/plugins";
|
||||||
|
QCoreApplication::addLibraryPath(QT_RELEASE_PLUGIN_PATH);
|
||||||
|
#endif
|
||||||
|
|
||||||
Application app(argc, const_cast<char**>(argv), startup_time);
|
Application app(argc, const_cast<char**>(argv), startup_time);
|
||||||
|
|
||||||
qDebug( "Created QT Application.\n" );
|
qDebug( "Created QT Application.\n" );
|
||||||
int exitCode = app.exec();
|
int exitCode = app.exec();
|
||||||
qDebug("Normal exit.\n");
|
qDebug("Normal exit.\n");
|
||||||
|
|
|
@ -14,9 +14,12 @@
|
||||||
#include "GlowEffect.h"
|
#include "GlowEffect.h"
|
||||||
#include "ProgramObject.h"
|
#include "ProgramObject.h"
|
||||||
|
|
||||||
static ProgramObject* createBlurProgram(const QString& direction) {
|
GlowEffect::GlowEffect() : _renderMode(BLUR_ADD_MODE) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProgramObject* createProgram(const QString& name) {
|
||||||
ProgramObject* program = new ProgramObject();
|
ProgramObject* program = new ProgramObject();
|
||||||
program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/" + direction + "_blur.frag");
|
program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/" + name + ".frag");
|
||||||
program->link();
|
program->link();
|
||||||
|
|
||||||
program->bind();
|
program->bind();
|
||||||
|
@ -28,12 +31,25 @@ static ProgramObject* createBlurProgram(const QString& direction) {
|
||||||
|
|
||||||
void GlowEffect::init() {
|
void GlowEffect::init() {
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
_horizontalBlurProgram = createBlurProgram("horizontal");
|
|
||||||
_verticalBlurProgram = createBlurProgram("vertical");
|
|
||||||
|
|
||||||
_verticalBlurProgram->bind();
|
_addProgram = createProgram("glow_add");
|
||||||
_verticalBlurProgram->setUniformValue("horizontallyBlurredTexture", 1);
|
_horizontalBlurProgram = createProgram("horizontal_blur");
|
||||||
_verticalBlurProgram->release();
|
_verticalBlurAddProgram = createProgram("vertical_blur_add");
|
||||||
|
_verticalBlurProgram = createProgram("vertical_blur");
|
||||||
|
_addSeparateProgram = createProgram("glow_add_separate");
|
||||||
|
_diffuseProgram = createProgram("diffuse");
|
||||||
|
|
||||||
|
_verticalBlurAddProgram->bind();
|
||||||
|
_verticalBlurAddProgram->setUniformValue("horizontallyBlurredTexture", 1);
|
||||||
|
_verticalBlurAddProgram->release();
|
||||||
|
|
||||||
|
_addSeparateProgram->bind();
|
||||||
|
_addSeparateProgram->setUniformValue("blurredTexture", 1);
|
||||||
|
_addSeparateProgram->release();
|
||||||
|
|
||||||
|
_diffuseProgram->bind();
|
||||||
|
_diffuseProgram->setUniformValue("diffusedTexture", 1);
|
||||||
|
_diffuseProgram->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlowEffect::prepare() {
|
void GlowEffect::prepare() {
|
||||||
|
@ -43,8 +59,8 @@ void GlowEffect::prepare() {
|
||||||
_isEmpty = true;
|
_isEmpty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlowEffect::begin(float amount) {
|
void GlowEffect::begin(float intensity) {
|
||||||
glBlendColor(0.0f, 0.0f, 0.0f, amount);
|
glBlendColor(0.0f, 0.0f, 0.0f, intensity);
|
||||||
_isEmpty = false;
|
_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +109,42 @@ void GlowEffect::render() {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_renderMode == ADD_MODE) {
|
||||||
|
_addProgram->bind();
|
||||||
|
renderFullscreenQuad();
|
||||||
|
_addProgram->release();
|
||||||
|
|
||||||
|
} else if (_renderMode == DIFFUSE_ADD_MODE) {
|
||||||
|
// diffuse into the secondary/tertiary (alternating between frames)
|
||||||
|
QOpenGLFramebufferObject* oldDiffusedFBO =
|
||||||
|
Application::getInstance()->getTextureCache()->getSecondaryFramebufferObject();
|
||||||
|
QOpenGLFramebufferObject* newDiffusedFBO =
|
||||||
|
Application::getInstance()->getTextureCache()->getTertiaryFramebufferObject();
|
||||||
|
if ((_isOddFrame = !_isOddFrame)) {
|
||||||
|
qSwap(oldDiffusedFBO, newDiffusedFBO);
|
||||||
|
}
|
||||||
|
newDiffusedFBO->bind();
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, oldDiffusedFBO->texture());
|
||||||
|
|
||||||
|
_diffuseProgram->bind();
|
||||||
|
renderFullscreenQuad();
|
||||||
|
_diffuseProgram->release();
|
||||||
|
|
||||||
|
newDiffusedFBO->release();
|
||||||
|
|
||||||
|
// add diffused texture to the primary
|
||||||
|
glBindTexture(GL_TEXTURE_2D, newDiffusedFBO->texture());
|
||||||
|
|
||||||
|
_addSeparateProgram->bind();
|
||||||
|
renderFullscreenQuad();
|
||||||
|
_addSeparateProgram->release();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
|
} else { // _renderMode == BLUR_ADD_MODE || _renderMode == BLUR_PERSIST_ADD_MODE
|
||||||
// render the primary to the secondary with the horizontal blur
|
// render the primary to the secondary with the horizontal blur
|
||||||
QOpenGLFramebufferObject* secondaryFBO =
|
QOpenGLFramebufferObject* secondaryFBO =
|
||||||
Application::getInstance()->getTextureCache()->getSecondaryFramebufferObject();
|
Application::getInstance()->getTextureCache()->getSecondaryFramebufferObject();
|
||||||
|
@ -105,14 +156,49 @@ void GlowEffect::render() {
|
||||||
|
|
||||||
secondaryFBO->release();
|
secondaryFBO->release();
|
||||||
|
|
||||||
|
if (_renderMode == BLUR_ADD_MODE) {
|
||||||
// render the secondary to the screen with the vertical blur
|
// render the secondary to the screen with the vertical blur
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, secondaryFBO->texture());
|
glBindTexture(GL_TEXTURE_2D, secondaryFBO->texture());
|
||||||
|
|
||||||
|
_verticalBlurAddProgram->bind();
|
||||||
|
renderFullscreenQuad();
|
||||||
|
_verticalBlurAddProgram->release();
|
||||||
|
|
||||||
|
} else { // _renderMode == BLUR_PERSIST_ADD_MODE
|
||||||
|
// render the secondary to the tertiary with horizontal blur and persistence
|
||||||
|
QOpenGLFramebufferObject* tertiaryFBO =
|
||||||
|
Application::getInstance()->getTextureCache()->getTertiaryFramebufferObject();
|
||||||
|
tertiaryFBO->bind();
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_ONE_MINUS_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);
|
||||||
|
const float PERSISTENCE_SMOOTHING = 0.9f;
|
||||||
|
glBlendColor(0.0f, 0.0f, 0.0f, PERSISTENCE_SMOOTHING);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, secondaryFBO->texture());
|
||||||
|
|
||||||
_verticalBlurProgram->bind();
|
_verticalBlurProgram->bind();
|
||||||
renderFullscreenQuad();
|
renderFullscreenQuad();
|
||||||
_verticalBlurProgram->release();
|
_verticalBlurProgram->release();
|
||||||
|
|
||||||
|
glBlendColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
// now add the tertiary to the primary buffer
|
||||||
|
tertiaryFBO->release();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, primaryFBO->texture());
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, tertiaryFBO->texture());
|
||||||
|
|
||||||
|
_addSeparateProgram->bind();
|
||||||
|
renderFullscreenQuad();
|
||||||
|
_addSeparateProgram->release();
|
||||||
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
|
@ -126,3 +212,7 @@ void GlowEffect::render() {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlowEffect::cycleRenderMode() {
|
||||||
|
_renderMode = (RenderMode)((_renderMode + 1) % RENDER_MODE_COUNT);
|
||||||
|
}
|
||||||
|
|
|
@ -9,26 +9,51 @@
|
||||||
#ifndef __interface__GlowEffect__
|
#ifndef __interface__GlowEffect__
|
||||||
#define __interface__GlowEffect__
|
#define __interface__GlowEffect__
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
class ProgramObject;
|
class ProgramObject;
|
||||||
|
|
||||||
class GlowEffect {
|
/// A generic full screen glow effect.
|
||||||
|
class GlowEffect : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
GlowEffect();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
/// Prepares the glow effect for rendering the current frame. To be called before rendering the scene.
|
||||||
void prepare();
|
void prepare();
|
||||||
|
|
||||||
void begin(float amount = 1.0f);
|
/// Starts using the glow effect.
|
||||||
|
/// \param intensity the desired glow intensity, from zero to one
|
||||||
|
void begin(float intensity = 1.0f);
|
||||||
|
|
||||||
|
/// Stops using the glow effect.
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
|
/// Renders the glow effect. To be called after rendering the scene.
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void cycleRenderMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ProgramObject* _horizontalBlurProgram;
|
enum RenderMode { ADD_MODE, BLUR_ADD_MODE, BLUR_PERSIST_ADD_MODE, DIFFUSE_ADD_MODE, RENDER_MODE_COUNT };
|
||||||
ProgramObject* _verticalBlurProgram;
|
|
||||||
|
|
||||||
bool _isEmpty;
|
RenderMode _renderMode;
|
||||||
|
ProgramObject* _addProgram;
|
||||||
|
ProgramObject* _horizontalBlurProgram;
|
||||||
|
ProgramObject* _verticalBlurAddProgram;
|
||||||
|
ProgramObject* _verticalBlurProgram;
|
||||||
|
ProgramObject* _addSeparateProgram;
|
||||||
|
ProgramObject* _diffuseProgram;
|
||||||
|
|
||||||
|
bool _isEmpty; ///< set when nothing in the scene is currently glowing
|
||||||
|
bool _isOddFrame; ///< controls the alternation between texture targets in diffuse add mode
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__GlowEffect__) */
|
#endif /* defined(__interface__GlowEffect__) */
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "TextureCache.h"
|
#include "TextureCache.h"
|
||||||
|
|
||||||
TextureCache::TextureCache() : _permutationNormalTextureID(0),
|
TextureCache::TextureCache() : _permutationNormalTextureID(0),
|
||||||
_primaryFramebufferObject(NULL), _secondaryFramebufferObject(NULL) {
|
_primaryFramebufferObject(NULL), _secondaryFramebufferObject(NULL), _tertiaryFramebufferObject(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureCache::~TextureCache() {
|
TextureCache::~TextureCache() {
|
||||||
|
@ -27,6 +27,9 @@ TextureCache::~TextureCache() {
|
||||||
if (_secondaryFramebufferObject != NULL) {
|
if (_secondaryFramebufferObject != NULL) {
|
||||||
delete _secondaryFramebufferObject;
|
delete _secondaryFramebufferObject;
|
||||||
}
|
}
|
||||||
|
if (_tertiaryFramebufferObject != NULL) {
|
||||||
|
delete _tertiaryFramebufferObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint TextureCache::getPermutationNormalTextureID() {
|
GLuint TextureCache::getPermutationNormalTextureID() {
|
||||||
|
@ -72,6 +75,14 @@ QOpenGLFramebufferObject* TextureCache::getSecondaryFramebufferObject() {
|
||||||
return _secondaryFramebufferObject;
|
return _secondaryFramebufferObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QOpenGLFramebufferObject* TextureCache::getTertiaryFramebufferObject() {
|
||||||
|
if (_tertiaryFramebufferObject == NULL) {
|
||||||
|
_tertiaryFramebufferObject = new QOpenGLFramebufferObject(Application::getInstance()->getGLWidget()->size());
|
||||||
|
Application::getInstance()->getGLWidget()->installEventFilter(this);
|
||||||
|
}
|
||||||
|
return _tertiaryFramebufferObject;
|
||||||
|
}
|
||||||
|
|
||||||
bool TextureCache::eventFilter(QObject* watched, QEvent* event) {
|
bool TextureCache::eventFilter(QObject* watched, QEvent* event) {
|
||||||
if (event->type() == QEvent::Resize) {
|
if (event->type() == QEvent::Resize) {
|
||||||
QSize size = static_cast<QResizeEvent*>(event)->size();
|
QSize size = static_cast<QResizeEvent*>(event)->size();
|
||||||
|
@ -83,6 +94,10 @@ bool TextureCache::eventFilter(QObject* watched, QEvent* event) {
|
||||||
delete _secondaryFramebufferObject;
|
delete _secondaryFramebufferObject;
|
||||||
_secondaryFramebufferObject = NULL;
|
_secondaryFramebufferObject = NULL;
|
||||||
}
|
}
|
||||||
|
if (_tertiaryFramebufferObject != NULL && _tertiaryFramebufferObject->size() != size) {
|
||||||
|
delete _tertiaryFramebufferObject;
|
||||||
|
_tertiaryFramebufferObject = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
|
|
||||||
QOpenGLFramebufferObject* getPrimaryFramebufferObject();
|
QOpenGLFramebufferObject* getPrimaryFramebufferObject();
|
||||||
QOpenGLFramebufferObject* getSecondaryFramebufferObject();
|
QOpenGLFramebufferObject* getSecondaryFramebufferObject();
|
||||||
|
QOpenGLFramebufferObject* getTertiaryFramebufferObject();
|
||||||
|
|
||||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ private:
|
||||||
|
|
||||||
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
||||||
QOpenGLFramebufferObject* _secondaryFramebufferObject;
|
QOpenGLFramebufferObject* _secondaryFramebufferObject;
|
||||||
|
QOpenGLFramebufferObject* _tertiaryFramebufferObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__TextureCache__) */
|
#endif /* defined(__interface__TextureCache__) */
|
||||||
|
|
|
@ -140,3 +140,20 @@ parameterizedJob.with {
|
||||||
tasks / 'hudson.plugins.postbuildtask.TaskProperties' / script).setValue(curlCommand)
|
tasks / 'hudson.plugins.postbuildtask.TaskProperties' / script).setValue(curlCommand)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doxygenJob = hifiJob('docs', false)
|
||||||
|
doxygenJob.with {
|
||||||
|
scm {
|
||||||
|
git(GIT_REPO_URL, 'master') {}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure { project ->
|
||||||
|
(project / builders).setValue('')
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
shell('doxygen')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queue doxygenJob
|
Loading…
Reference in a new issue