mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
Use only skyboxTexture in DeferredLightingEffect
This commit is contained in:
parent
95d98e3ed7
commit
1817b8ef2f
3 changed files with 12 additions and 14 deletions
|
@ -3818,8 +3818,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
|
||||
// Setup the current Zone Entity lighting
|
||||
{
|
||||
auto sun = DependencyManager::get<SceneScriptingInterface>()->getSkyStage()->getSunLight();
|
||||
DependencyManager::get<DeferredLightingEffect>()->setGlobalLight(sun);
|
||||
auto stage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||
DependencyManager::get<DeferredLightingEffect>()->setGlobalLight(stage->getSunLight(), stage->getSkybox()->getCubemap());
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -312,15 +312,13 @@ void DeferredLightingEffect::render(const render::RenderContextPointer& renderCo
|
|||
|
||||
// First Global directional light and ambient pass
|
||||
{
|
||||
bool useSkyboxCubemap = (_skybox) && (_skybox->getCubemap());
|
||||
|
||||
auto& program = _shadowMapEnabled ? _directionalLightShadow : _directionalLight;
|
||||
LightLocationsPtr locations = _shadowMapEnabled ? _directionalLightShadowLocations : _directionalLightLocations;
|
||||
|
||||
// Setup the global directional pass pipeline
|
||||
{
|
||||
if (_shadowMapEnabled) {
|
||||
if (useSkyboxCubemap) {
|
||||
if (_skyboxTexture) {
|
||||
program = _directionalSkyboxLightShadow;
|
||||
locations = _directionalSkyboxLightShadowLocations;
|
||||
} else if (_ambientLightMode > -1) {
|
||||
|
@ -328,7 +326,7 @@ void DeferredLightingEffect::render(const render::RenderContextPointer& renderCo
|
|||
locations = _directionalAmbientSphereLightShadowLocations;
|
||||
}
|
||||
} else {
|
||||
if (useSkyboxCubemap) {
|
||||
if (_skyboxTexture) {
|
||||
program = _directionalSkyboxLight;
|
||||
locations = _directionalSkyboxLightLocations;
|
||||
} else if (_ambientLightMode > -1) {
|
||||
|
@ -356,7 +354,7 @@ void DeferredLightingEffect::render(const render::RenderContextPointer& renderCo
|
|||
geometryCache->renderQuad(batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, color);
|
||||
}
|
||||
|
||||
if (useSkyboxCubemap) {
|
||||
if (_skyboxTexture) {
|
||||
batch.setResourceTexture(SKYBOX_MAP_UNIT, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -501,9 +499,8 @@ void DeferredLightingEffect::setupKeyLightBatch(gpu::Batch& batch, int lightBuff
|
|||
batch.setUniformBuffer(lightBufferUnit, globalLight->getSchemaBuffer());
|
||||
}
|
||||
|
||||
bool useSkyboxCubemap = (_skybox) && (_skybox->getCubemap());
|
||||
if (useSkyboxCubemap && (skyboxCubemapUnit >= 0)) {
|
||||
batch.setResourceTexture(skyboxCubemapUnit, _skybox->getCubemap());
|
||||
if (_skyboxTexture && (skyboxCubemapUnit >= 0)) {
|
||||
batch.setResourceTexture(skyboxCubemapUnit, _skyboxTexture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,13 +559,15 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
|
|||
|
||||
}
|
||||
|
||||
void DeferredLightingEffect::setGlobalLight(const model::LightPointer& light) {
|
||||
void DeferredLightingEffect::setGlobalLight(const model::LightPointer& light, const gpu::TexturePointer& skyboxTexture) {
|
||||
auto globalLight = _allocatedLights.front();
|
||||
globalLight->setDirection(light->getDirection());
|
||||
globalLight->setColor(light->getColor());
|
||||
globalLight->setIntensity(light->getIntensity());
|
||||
globalLight->setAmbientIntensity(light->getAmbientIntensity());
|
||||
globalLight->setAmbientSphere(light->getAmbientSphere());
|
||||
|
||||
_skyboxTexture = skyboxTexture;
|
||||
}
|
||||
|
||||
model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <NumericalConstants.h>
|
||||
|
||||
#include "model/Light.h"
|
||||
#include "model/Stage.h"
|
||||
#include "model/Geometry.h"
|
||||
|
||||
#include "render/Context.h"
|
||||
|
@ -49,7 +48,7 @@ public:
|
|||
void setupKeyLightBatch(gpu::Batch& batch, int lightBufferUnit, int skyboxCubemapUnit);
|
||||
|
||||
// update global lighting
|
||||
void setGlobalLight(const model::LightPointer& light);
|
||||
void setGlobalLight(const model::LightPointer& light, const gpu::TexturePointer& skyboxTexture);
|
||||
|
||||
const LightStage& getLightStage() { return _lightStage; }
|
||||
void setShadowMapEnabled(bool enable) { _shadowMapEnabled = enable; };
|
||||
|
@ -96,7 +95,7 @@ private:
|
|||
std::vector<int> _spotLights;
|
||||
|
||||
int _ambientLightMode = 0;
|
||||
model::SkyboxPointer _skybox;
|
||||
gpu::TexturePointer _skyboxTexture;
|
||||
|
||||
// Class describing the uniform buffer with all the parameters common to the deferred shaders
|
||||
class DeferredTransform {
|
||||
|
|
Loading…
Reference in a new issue