mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 15:20:11 +02:00
Working on the "real" shadow volume.
This commit is contained in:
parent
758246309a
commit
dcc926a0db
2 changed files with 9 additions and 8 deletions
|
@ -2772,9 +2772,10 @@ void Application::updateShadowMap() {
|
|||
glm::vec3 lightDirection = -getSunDirection();
|
||||
glm::quat rotation = glm::inverse(rotationBetween(IDENTITY_FRONT, lightDirection));
|
||||
glm::vec3 translation = glm::vec3();
|
||||
float nearScale = 0.0f;
|
||||
float farScale = 0.00000244f;
|
||||
/* glm::vec3 points[] = {
|
||||
float nearScale = 0.0f; // (1.0f - _viewFrustum.getNearClip()) / (_viewFrustum.getFarClip() - _viewFrustum.getNearClip());
|
||||
float farScale = (2.0f - _viewFrustum.getNearClip()) / (_viewFrustum.getFarClip() - _viewFrustum.getNearClip());
|
||||
loadViewFrustum(_myCamera, _viewFrustum);
|
||||
glm::vec3 points[] = {
|
||||
rotation * (glm::mix(_viewFrustum.getNearTopLeft(), _viewFrustum.getFarTopLeft(), nearScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearTopRight(), _viewFrustum.getFarTopRight(), nearScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearBottomLeft(), _viewFrustum.getFarBottomLeft(), nearScale) + translation),
|
||||
|
@ -2782,14 +2783,14 @@ void Application::updateShadowMap() {
|
|||
rotation * (glm::mix(_viewFrustum.getNearTopLeft(), _viewFrustum.getFarTopLeft(), farScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearTopRight(), _viewFrustum.getFarTopRight(), farScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearBottomLeft(), _viewFrustum.getFarBottomLeft(), farScale) + translation),
|
||||
rotation * (glm::mix(_viewFrustum.getNearBottomRight(), _viewFrustum.getFarBottomRight(), farScale) + translation) }; */
|
||||
glm::vec3 points[] = {
|
||||
rotation * (glm::mix(_viewFrustum.getNearBottomRight(), _viewFrustum.getFarBottomRight(), farScale) + translation) };
|
||||
/* glm::vec3 points[] = {
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(-1, 0, 0) + translation),
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(1, 0, 0) + translation),
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(0, -1, 0) + translation),
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(0, 1, 0) + translation),
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(0, 0, -1) + translation),
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(0, 0, 1) + translation) };
|
||||
rotation * (_myAvatar.getPosition() + glm::vec3(0, 0, 1) + translation) }; */
|
||||
glm::vec3 minima(FLT_MAX, FLT_MAX, FLT_MAX), maxima(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||
for (int i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
|
||||
minima = glm::min(minima, points[i]);
|
||||
|
@ -3381,7 +3382,7 @@ void Application::displayOverlay() {
|
|||
_webcam.renderPreview(_glWidget->width(), _glWidget->height());
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Shadows) && false) {
|
||||
glBindTexture(GL_TEXTURE_2D, _textureCache.getShadowDepthTextureID());
|
||||
glBindTexture(GL_TEXTURE_2D, _textureCache.getShadowFramebufferObject()->texture());
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ QOpenGLFramebufferObject* TextureCache::getTertiaryFramebufferObject() {
|
|||
|
||||
QOpenGLFramebufferObject* TextureCache::getShadowFramebufferObject() {
|
||||
if (_shadowFramebufferObject == NULL) {
|
||||
const int SHADOW_MAP_SIZE = 1024;
|
||||
const int SHADOW_MAP_SIZE = 2048;
|
||||
_shadowFramebufferObject = new QOpenGLFramebufferObject(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
|
||||
QOpenGLFramebufferObject::NoAttachment, GL_TEXTURE_2D, GL_RGB);
|
||||
|
||||
|
|
Loading…
Reference in a new issue