mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 00:36:34 +02:00
Compiling
This commit is contained in:
parent
253a71a20c
commit
80a55e2ae9
5 changed files with 16 additions and 64 deletions
|
@ -403,7 +403,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
|
||||||
auto& ambientOcclusionFramebuffer = inputs.get3();
|
auto& ambientOcclusionFramebuffer = inputs.get3();
|
||||||
auto& velocityFramebuffer = inputs.get4();
|
auto& velocityFramebuffer = inputs.get4();
|
||||||
auto& frameTransform = inputs.get5();
|
auto& frameTransform = inputs.get5();
|
||||||
auto& lightFrame = inputs.get6();
|
auto& shadowFrame = inputs.get6();
|
||||||
|
|
||||||
gpu::doInBatch("DebugDeferredBuffer::run", args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("DebugDeferredBuffer::run", args->_context, [&](gpu::Batch& batch) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
|
@ -439,16 +439,14 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
|
||||||
batch.setResourceTexture(Textures::DebugTexture0, velocityFramebuffer->getVelocityTexture());
|
batch.setResourceTexture(Textures::DebugTexture0, velocityFramebuffer->getVelocityTexture());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
if (!shadowFrame->_objects.empty()) {
|
||||||
assert(lightStage);
|
const auto& globalShadow = shadowFrame->_objects[0];
|
||||||
assert(lightStage->getNumLights() > 0);
|
if (globalShadow) {
|
||||||
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow(*lightFrame);
|
batch.setResourceTexture(Textures::Shadow, globalShadow->map);
|
||||||
const auto& globalShadow = lightAndShadow.second;
|
batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer());
|
||||||
if (globalShadow) {
|
batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer());
|
||||||
batch.setResourceTexture(Textures::Shadow, globalShadow->map);
|
batch.setUniformBuffer(UBOs::DebugDeferredParams, _parameters);
|
||||||
batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer());
|
}
|
||||||
batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer());
|
|
||||||
batch.setUniformBuffer(UBOs::DebugDeferredParams, _parameters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linearDepthTarget) {
|
if (linearDepthTarget) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
AmbientOcclusionFramebufferPointer,
|
AmbientOcclusionFramebufferPointer,
|
||||||
VelocityFramebufferPointer,
|
VelocityFramebufferPointer,
|
||||||
DeferredFrameTransformPointer,
|
DeferredFrameTransformPointer,
|
||||||
LightStage::FramePointer>;
|
LightStage::ShadowFramePointer>;
|
||||||
using Config = DebugDeferredBufferConfig;
|
using Config = DebugDeferredBufferConfig;
|
||||||
using JobModel = render::Job::ModelI<DebugDeferredBuffer, Inputs, Config>;
|
using JobModel = render::Job::ModelI<DebugDeferredBuffer, Inputs, Config>;
|
||||||
|
|
||||||
|
|
|
@ -350,27 +350,9 @@ LightStage::Index LightStage::addLight(const LightPointer& light, const bool sho
|
||||||
return lightId;
|
return lightId;
|
||||||
}
|
}
|
||||||
|
|
||||||
LightStage::Index LightStage::addShadow(Index lightIndex, float maxDistance, unsigned int cascadeCount) {
|
|
||||||
auto light = getLight(lightIndex);
|
|
||||||
Index shadowId = INVALID_INDEX;
|
|
||||||
if (light) {
|
|
||||||
assert(_descs[lightIndex].shadowId == INVALID_INDEX);
|
|
||||||
shadowId = _shadows.newElement(std::make_shared<Shadow>(light, maxDistance, cascadeCount));
|
|
||||||
_descs[lightIndex].shadowId = shadowId;
|
|
||||||
}
|
|
||||||
return shadowId;
|
|
||||||
}
|
|
||||||
|
|
||||||
LightStage::LightPointer LightStage::removeLight(Index index) {
|
LightStage::LightPointer LightStage::removeLight(Index index) {
|
||||||
LightPointer removedLight = _lights.freeElement(index);
|
LightPointer removedLight = _lights.freeElement(index);
|
||||||
if (removedLight) {
|
if (removedLight) {
|
||||||
auto shadowId = _descs[index].shadowId;
|
|
||||||
// Remove shadow if one exists for this light
|
|
||||||
if (shadowId != INVALID_INDEX) {
|
|
||||||
auto removedShadow = _shadows.freeElement(shadowId);
|
|
||||||
assert(removedShadow);
|
|
||||||
assert(removedShadow->getLight() == removedLight);
|
|
||||||
}
|
|
||||||
_lightMap.erase(removedLight);
|
_lightMap.erase(removedLight);
|
||||||
_descs[index] = Desc();
|
_descs[index] = Desc();
|
||||||
}
|
}
|
||||||
|
@ -394,35 +376,6 @@ LightStage::LightPointer LightStage::getCurrentAmbientLight(const LightStage::Fr
|
||||||
return _lights.get(keyLightId);
|
return _lights.get(keyLightId);
|
||||||
}
|
}
|
||||||
|
|
||||||
LightStage::ShadowPointer LightStage::getCurrentKeyShadow(const LightStage::Frame& frame) const {
|
|
||||||
Index keyLightId { _defaultLightId };
|
|
||||||
if (!frame._sunLights.empty()) {
|
|
||||||
keyLightId = frame._sunLights.front();
|
|
||||||
}
|
|
||||||
auto shadow = getShadow(keyLightId);
|
|
||||||
assert(shadow == nullptr || shadow->getLight() == getLight(keyLightId));
|
|
||||||
return shadow;
|
|
||||||
}
|
|
||||||
|
|
||||||
LightStage::LightAndShadow LightStage::getCurrentKeyLightAndShadow(const LightStage::Frame& frame) const {
|
|
||||||
Index keyLightId { _defaultLightId };
|
|
||||||
if (!frame._sunLights.empty()) {
|
|
||||||
keyLightId = frame._sunLights.front();
|
|
||||||
}
|
|
||||||
auto shadow = getShadow(keyLightId);
|
|
||||||
auto light = getLight(keyLightId);
|
|
||||||
assert(shadow == nullptr || shadow->getLight() == light);
|
|
||||||
return LightAndShadow(light, shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
LightStage::Index LightStage::getShadowId(Index lightId) const {
|
|
||||||
if (checkLightId(lightId)) {
|
|
||||||
return _descs[lightId].shadowId;
|
|
||||||
} else {
|
|
||||||
return INVALID_INDEX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LightStage::updateLightArrayBuffer(Index lightId) {
|
void LightStage::updateLightArrayBuffer(Index lightId) {
|
||||||
auto lightSize = sizeof(graphics::Light::LightSchema);
|
auto lightSize = sizeof(graphics::Light::LightSchema);
|
||||||
if (!_lightArrayBuffer) {
|
if (!_lightArrayBuffer) {
|
||||||
|
|
|
@ -218,12 +218,12 @@ void ExtractFrustums::run(const render::RenderContextPointer& renderContext, con
|
||||||
for (auto i = 0; i < SHADOW_CASCADE_FRUSTUM_COUNT; i++) {
|
for (auto i = 0; i < SHADOW_CASCADE_FRUSTUM_COUNT; i++) {
|
||||||
auto& shadowFrustum = output[SHADOW_CASCADE0_FRUSTUM+i].edit<ViewFrustumPointer>();
|
auto& shadowFrustum = output[SHADOW_CASCADE0_FRUSTUM+i].edit<ViewFrustumPointer>();
|
||||||
if (lightStage) {
|
if (lightStage) {
|
||||||
auto globalShadow = lightStage->getCurrentKeyShadow(*lightFrame);
|
/* auto globalShadow = lightStage->getCurrentKeyShadow(*lightFrame);
|
||||||
|
|
||||||
if (globalShadow && i<(int)globalShadow->getCascadeCount()) {
|
if (globalShadow && i<(int)globalShadow->getCascadeCount()) {
|
||||||
auto& cascade = globalShadow->getCascade(i);
|
auto& cascade = globalShadow->getCascade(i);
|
||||||
shadowFrustum = cascade.getFrustum();
|
shadowFrustum = cascade.getFrustum();
|
||||||
} else {
|
} else*/ {
|
||||||
shadowFrustum.reset();
|
shadowFrustum.reset();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -298,7 +298,8 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input
|
||||||
// RenderShadowTask out
|
// RenderShadowTask out
|
||||||
const auto& shadowOut = inputs.get1();
|
const auto& shadowOut = inputs.get1();
|
||||||
|
|
||||||
const auto& renderShadowTaskOut = shadowOut[0];
|
const auto& renderShadowTaskOut = shadowOut[0];
|
||||||
|
const auto& shadowFrame = shadowOut[1];
|
||||||
|
|
||||||
// Extract the Lighting Stages Current frame ( and zones)
|
// Extract the Lighting Stages Current frame ( and zones)
|
||||||
const auto lightingStageInputs = inputs.get2();
|
const auto lightingStageInputs = inputs.get2();
|
||||||
|
@ -401,7 +402,7 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input
|
||||||
{
|
{
|
||||||
|
|
||||||
// Debugging Deferred buffer job
|
// Debugging Deferred buffer job
|
||||||
const auto debugFramebuffers = DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, velocityBuffer, deferredFrameTransform, lightFrame).asVarying();
|
const auto debugFramebuffers = DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, velocityBuffer, deferredFrameTransform, shadowFrame).asVarying();
|
||||||
task.addJob<DebugDeferredBuffer>("DebugDeferredBuffer", debugFramebuffers);
|
task.addJob<DebugDeferredBuffer>("DebugDeferredBuffer", debugFramebuffers);
|
||||||
|
|
||||||
const auto debugSubsurfaceScatteringInputs = DebugSubsurfaceScattering::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
const auto debugSubsurfaceScatteringInputs = DebugSubsurfaceScattering::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
||||||
|
@ -446,7 +447,7 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs&
|
||||||
const auto& lightFrame = inputs.get2();
|
const auto& lightFrame = inputs.get2();
|
||||||
const auto& lightingModel = inputs.get3();
|
const auto& lightingModel = inputs.get3();
|
||||||
const auto& lightClusters = inputs.get4();
|
const auto& lightClusters = inputs.get4();
|
||||||
// Not used yet but will be: const auto& shadowFrame = inputs.get5();
|
const auto& shadowFrame = inputs.get5();
|
||||||
const auto jitter = inputs.get6();
|
const auto jitter = inputs.get6();
|
||||||
auto deferredLightingEffect = DependencyManager::get<DeferredLightingEffect>();
|
auto deferredLightingEffect = DependencyManager::get<DeferredLightingEffect>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue