mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Sky working again.
This commit is contained in:
parent
c5ca23f4ea
commit
87833abd31
9 changed files with 169 additions and 117 deletions
|
@ -90,11 +90,10 @@ float evalFadeGradient(vec3 position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float evalFadeAlpha(vec3 position) {
|
float evalFadeAlpha(vec3 position) {
|
||||||
/* float edgeWidth = fadeParameters[fadeCategory]._edgeWidthInvWidth.x;
|
float edgeWidth = fadeParameters[fadeCategory]._edgeWidthInvWidth.x;
|
||||||
float cutoff = mix(-edgeWidth, 1.0+edgeWidth, fadeThreshold);
|
float cutoff = mix(-edgeWidth, 1.0+edgeWidth, fadeThreshold);
|
||||||
|
|
||||||
return evalFadeGradient(position)-cutoff;*/
|
return evalFadeGradient(position)-cutoff;
|
||||||
return evalFadeNoiseGradient(position)-fadeThreshold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyFadeClip(vec3 position) {
|
void applyFadeClip(vec3 position) {
|
||||||
|
|
|
@ -6,24 +6,32 @@
|
||||||
#include <Interpolate.h>
|
#include <Interpolate.h>
|
||||||
#include <gpu/Context.h>
|
#include <gpu/Context.h>
|
||||||
|
|
||||||
#define FADE_MIN_SCALE 0.001f
|
#define FADE_MIN_SCALE 0.001
|
||||||
#define FADE_MAX_SCALE 100000.f
|
#define FADE_MAX_SCALE 10000.0
|
||||||
|
|
||||||
|
inline float parameterToValuePow(float parameter, const double minValue, const double maxOverMinValue) {
|
||||||
|
return (float)(minValue * pow(maxOverMinValue, parameter));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float valueToParameterPow(float value, const double minValue, const double maxOverMinValue) {
|
||||||
|
return (float)(log(value / minValue) / log(maxOverMinValue));
|
||||||
|
}
|
||||||
|
|
||||||
void FadeSwitchJob::configure(const Config& config) {
|
void FadeSwitchJob::configure(const Config& config) {
|
||||||
_parameters->_isEditEnabled = config.editFade;
|
_parameters->_isEditEnabled = config.editFade;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeSwitchJob::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
void FadeSwitchJob::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
||||||
auto& normalOutputs = output.edit0();
|
auto& normalOutputs = output.edit0().edit0();
|
||||||
auto& fadeOutputs = output.edit1();
|
auto& fadeOutputs = output.edit1();
|
||||||
|
|
||||||
// Only shapes are affected by fade at this time.
|
// Only shapes are affected by fade at this time.
|
||||||
normalOutputs[RenderFetchCullSortTask::LIGHT] = input[RenderFetchCullSortTask::LIGHT];
|
normalOutputs[RenderFetchCullSortTask::LIGHT].edit<render::ItemBounds>() = input.get0()[RenderFetchCullSortTask::LIGHT].get<render::ItemBounds>();
|
||||||
normalOutputs[RenderFetchCullSortTask::META] = input[RenderFetchCullSortTask::META];
|
normalOutputs[RenderFetchCullSortTask::META].edit<render::ItemBounds>() = input.get0()[RenderFetchCullSortTask::META].get<render::ItemBounds>();
|
||||||
normalOutputs[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE] = input[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE];
|
normalOutputs[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE].edit<render::ItemBounds>() = input.get0()[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE].get<render::ItemBounds>();
|
||||||
normalOutputs[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE] = input[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE];
|
normalOutputs[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE].edit<render::ItemBounds>() = input.get0()[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE].get<render::ItemBounds>();
|
||||||
normalOutputs[RenderFetchCullSortTask::BACKGROUND] = input[RenderFetchCullSortTask::BACKGROUND];
|
normalOutputs[RenderFetchCullSortTask::BACKGROUND].edit<render::ItemBounds>() = input.get0()[RenderFetchCullSortTask::BACKGROUND].get<render::ItemBounds>();
|
||||||
normalOutputs[RenderFetchCullSortTask::SPATIAL_SELECTION] = input[RenderFetchCullSortTask::SPATIAL_SELECTION];
|
output.edit0().edit1() = input.get1();
|
||||||
|
|
||||||
// Find the nearest item that intersects the view direction
|
// Find the nearest item that intersects the view direction
|
||||||
const render::Item* editedItem = nullptr;
|
const render::Item* editedItem = nullptr;
|
||||||
|
@ -32,16 +40,20 @@ void FadeSwitchJob::run(const render::RenderContextPointer& renderContext, const
|
||||||
float nearestTransparentDistance = std::numeric_limits<float>::max();
|
float nearestTransparentDistance = std::numeric_limits<float>::max();
|
||||||
const render::Item* nearestItem;
|
const render::Item* nearestItem;
|
||||||
|
|
||||||
editedItem = findNearestItem(renderContext, input[RenderFetchCullSortTask::OPAQUE_SHAPE], nearestOpaqueDistance);
|
editedItem = findNearestItem(renderContext, input.get0()[RenderFetchCullSortTask::OPAQUE_SHAPE], nearestOpaqueDistance);
|
||||||
nearestItem = findNearestItem(renderContext, input[RenderFetchCullSortTask::TRANSPARENT_SHAPE], nearestTransparentDistance);
|
nearestItem = findNearestItem(renderContext, input.get0()[RenderFetchCullSortTask::TRANSPARENT_SHAPE], nearestTransparentDistance);
|
||||||
if (nearestTransparentDistance < nearestOpaqueDistance) {
|
if (nearestTransparentDistance < nearestOpaqueDistance) {
|
||||||
editedItem = nearestItem;
|
editedItem = nearestItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (editedItem) {
|
||||||
|
output.edit2() = editedItem->getBound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, distribute items that need to be faded accross both outputs
|
// Now, distribute items that need to be faded accross both outputs
|
||||||
distribute(renderContext, input[RenderFetchCullSortTask::OPAQUE_SHAPE], normalOutputs[RenderFetchCullSortTask::OPAQUE_SHAPE], fadeOutputs[OPAQUE_SHAPE], editedItem);
|
distribute(renderContext, input.get0()[RenderFetchCullSortTask::OPAQUE_SHAPE], normalOutputs[RenderFetchCullSortTask::OPAQUE_SHAPE], fadeOutputs[OPAQUE_SHAPE], editedItem);
|
||||||
distribute(renderContext, input[RenderFetchCullSortTask::TRANSPARENT_SHAPE], normalOutputs[RenderFetchCullSortTask::TRANSPARENT_SHAPE], fadeOutputs[TRANSPARENT_SHAPE], editedItem);
|
distribute(renderContext, input.get0()[RenderFetchCullSortTask::TRANSPARENT_SHAPE], normalOutputs[RenderFetchCullSortTask::TRANSPARENT_SHAPE], fadeOutputs[TRANSPARENT_SHAPE], editedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
const render::Item* FadeSwitchJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::Varying& input, float& minIsectDistance) const {
|
const render::Item* FadeSwitchJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::Varying& input, float& minIsectDistance) const {
|
||||||
|
@ -71,22 +83,21 @@ void FadeSwitchJob::distribute(const render::RenderContextPointer& renderContext
|
||||||
render::Varying& normalOutput, render::Varying& fadeOutput, const render::Item* editedItem) const {
|
render::Varying& normalOutput, render::Varying& fadeOutput, const render::Item* editedItem) const {
|
||||||
auto& scene = renderContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
assert(_parameters);
|
assert(_parameters);
|
||||||
const double fadeDuration = double(_parameters->_durations[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN]) * USECS_PER_SECOND;
|
|
||||||
const auto& inputItems = input.get<render::ItemBounds>();
|
const auto& inputItems = input.get<render::ItemBounds>();
|
||||||
|
|
||||||
// Clear previous values
|
// Clear previous values
|
||||||
normalOutput.template edit<render::ItemBounds>().clear();
|
normalOutput.edit<render::ItemBounds>().clear();
|
||||||
fadeOutput.template edit<render::ItemBounds>().clear();
|
fadeOutput.edit<render::ItemBounds>().clear();
|
||||||
|
|
||||||
for (const auto& itemBound : inputItems) {
|
for (const auto& itemBound : inputItems) {
|
||||||
auto& item = scene->getItem(itemBound.id);
|
auto& item = scene->getItem(itemBound.id);
|
||||||
|
|
||||||
if (!item.mustFade() && &item!=editedItem) {
|
if (!item.mustFade() && &item!=editedItem) {
|
||||||
// No need to fade
|
// No need to fade
|
||||||
normalOutput.template edit<render::ItemBounds>().emplace_back(itemBound);
|
normalOutput.edit<render::ItemBounds>().emplace_back(itemBound);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fadeOutput.template edit<render::ItemBounds>().emplace_back(itemBound);
|
fadeOutput.edit<render::ItemBounds>().emplace_back(itemBound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,30 +119,30 @@ float FadeJobConfig::getDuration() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setBaseSizeX(float value) {
|
void FadeJobConfig::setBaseSizeX(float value) {
|
||||||
baseSize[editedCategory].x = FADE_MIN_SCALE*powf(FADE_MAX_SCALE/ FADE_MIN_SCALE, value);
|
baseSize[editedCategory].x = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE/ FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getBaseSizeX() const {
|
float FadeJobConfig::getBaseSizeX() const {
|
||||||
return logf(baseSize[editedCategory].x / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(baseSize[editedCategory].x, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setBaseSizeY(float value) {
|
void FadeJobConfig::setBaseSizeY(float value) {
|
||||||
baseSize[editedCategory].y = FADE_MIN_SCALE*powf(FADE_MAX_SCALE / FADE_MIN_SCALE, value);
|
baseSize[editedCategory].y = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getBaseSizeY() const {
|
float FadeJobConfig::getBaseSizeY() const {
|
||||||
return logf(baseSize[editedCategory].y / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(baseSize[editedCategory].y, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setBaseSizeZ(float value) {
|
void FadeJobConfig::setBaseSizeZ(float value) {
|
||||||
baseSize[editedCategory].z = FADE_MIN_SCALE*powf(FADE_MAX_SCALE / FADE_MIN_SCALE, value);
|
baseSize[editedCategory].z = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getBaseSizeZ() const {
|
float FadeJobConfig::getBaseSizeZ() const {
|
||||||
return logf(baseSize[editedCategory].z / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(baseSize[editedCategory].z, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setBaseLevel(float value) {
|
void FadeJobConfig::setBaseLevel(float value) {
|
||||||
|
@ -149,30 +160,30 @@ bool FadeJobConfig::isBaseInverted() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setNoiseSizeX(float value) {
|
void FadeJobConfig::setNoiseSizeX(float value) {
|
||||||
noiseSize[editedCategory].x = FADE_MIN_SCALE*powf(FADE_MAX_SCALE / FADE_MIN_SCALE, value);
|
noiseSize[editedCategory].x = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getNoiseSizeX() const {
|
float FadeJobConfig::getNoiseSizeX() const {
|
||||||
return logf(noiseSize[editedCategory].x / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(noiseSize[editedCategory].x, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setNoiseSizeY(float value) {
|
void FadeJobConfig::setNoiseSizeY(float value) {
|
||||||
noiseSize[editedCategory].y = FADE_MIN_SCALE*powf(FADE_MAX_SCALE / FADE_MIN_SCALE, value);
|
noiseSize[editedCategory].y = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getNoiseSizeY() const {
|
float FadeJobConfig::getNoiseSizeY() const {
|
||||||
return logf(noiseSize[editedCategory].y / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(noiseSize[editedCategory].y, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setNoiseSizeZ(float value) {
|
void FadeJobConfig::setNoiseSizeZ(float value) {
|
||||||
noiseSize[editedCategory].z = FADE_MIN_SCALE*powf(FADE_MAX_SCALE / FADE_MIN_SCALE, value);
|
noiseSize[editedCategory].z = parameterToValuePow(value, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeJobConfig::getNoiseSizeZ() const {
|
float FadeJobConfig::getNoiseSizeZ() const {
|
||||||
return logf(noiseSize[editedCategory].z / FADE_MIN_SCALE) / logf(FADE_MAX_SCALE / FADE_MIN_SCALE);
|
return valueToParameterPow(noiseSize[editedCategory].z, FADE_MIN_SCALE, FADE_MAX_SCALE / FADE_MIN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setNoiseLevel(float value) {
|
void FadeJobConfig::setNoiseLevel(float value) {
|
||||||
|
@ -251,7 +262,7 @@ void FadeConfigureJob::configure(const Config& config) {
|
||||||
configuration._noiseInvSizeAndLevel.y = 1.f / config.noiseSize[i].y;
|
configuration._noiseInvSizeAndLevel.y = 1.f / config.noiseSize[i].y;
|
||||||
configuration._noiseInvSizeAndLevel.z = 1.f / config.noiseSize[i].z;
|
configuration._noiseInvSizeAndLevel.z = 1.f / config.noiseSize[i].z;
|
||||||
configuration._noiseInvSizeAndLevel.w = config.noiseLevel[i];
|
configuration._noiseInvSizeAndLevel.w = config.noiseLevel[i];
|
||||||
configuration._invertBase = config.baseInverted[i];
|
configuration._invertBase = config.baseInverted[i] & 1;
|
||||||
configuration._edgeWidthInvWidth.x = config.edgeWidth[i];
|
configuration._edgeWidthInvWidth.x = config.edgeWidth[i];
|
||||||
configuration._edgeWidthInvWidth.y = 1.f / configuration._edgeWidthInvWidth.x;
|
configuration._edgeWidthInvWidth.y = 1.f / configuration._edgeWidthInvWidth.x;
|
||||||
configuration._innerEdgeColor = config.edgeInnerColor[i];
|
configuration._innerEdgeColor = config.edgeInnerColor[i];
|
||||||
|
@ -260,10 +271,13 @@ void FadeConfigureJob::configure(const Config& config) {
|
||||||
_isBufferDirty = true;
|
_isBufferDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeConfigureJob::run(const render::RenderContextPointer& renderContext, Output& output) {
|
void FadeConfigureJob::run(const render::RenderContextPointer& renderContext, const Input& input, Output& output) {
|
||||||
if (_isBufferDirty) {
|
if (_isBufferDirty || _parameters->_isEditEnabled) {
|
||||||
auto& configurations = output.edit1().edit();
|
auto& configurations = output.edit1().edit();
|
||||||
std::copy(_configurations, _configurations + FadeJobConfig::EVENT_CATEGORY_COUNT, configurations.parameters);
|
std::copy(_configurations, _configurations + FadeJobConfig::EVENT_CATEGORY_COUNT, configurations.parameters);
|
||||||
|
if (_parameters->_editedCategory == FadeJobConfig::USER_ENTER_LEAVE_DOMAIN) {
|
||||||
|
configurations.parameters[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN]._baseInvSizeAndLevel.y = 2.f / input.getDimensions().y;
|
||||||
|
}
|
||||||
_isBufferDirty = false;
|
_isBufferDirty = false;
|
||||||
}
|
}
|
||||||
output.edit0() = _fadeMaskMap;
|
output.edit0() = _fadeMaskMap;
|
||||||
|
@ -290,14 +304,6 @@ void FadeRenderJob::run(const render::RenderContextPointer& renderContext, const
|
||||||
|
|
||||||
defaultKeyBuilder.withFade();
|
defaultKeyBuilder.withFade();
|
||||||
|
|
||||||
// Update interactive edit effect
|
|
||||||
if (_parameters->_isEditEnabled) {
|
|
||||||
updateFadeEdit();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_editStartTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
|
|
||||||
|
@ -306,6 +312,14 @@ void FadeRenderJob::run(const render::RenderContextPointer& renderContext, const
|
||||||
_currentFadeMaskMap = fadeMaskMap;
|
_currentFadeMaskMap = fadeMaskMap;
|
||||||
_currentFadeBuffer = &fadeParamBuffer;
|
_currentFadeBuffer = &fadeParamBuffer;
|
||||||
|
|
||||||
|
// Update interactive edit effect
|
||||||
|
if (_parameters->_isEditEnabled) {
|
||||||
|
updateFadeEdit(inItems.front());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_editStartTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup camera, projection and viewport for all items
|
// Setup camera, projection and viewport for all items
|
||||||
batch.setViewportTransform(args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
batch.setStateScissorRect(args->_viewport);
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
@ -365,18 +379,18 @@ float FadeRenderJob::computeFadePercent(quint64 startTime) {
|
||||||
return _currentInstance->computeElementEnterThreshold(time);
|
return _currentInstance->computeElementEnterThreshold(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeRenderJob::updateFadeEdit() {
|
void FadeRenderJob::updateFadeEdit(const render::ItemBound& itemBounds) {
|
||||||
if (_editStartTime == 0) {
|
if (_editStartTime == 0) {
|
||||||
_editStartTime = usecTimestampNow();
|
_editStartTime = usecTimestampNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
const double time = (int64_t(usecTimestampNow()) - int64_t(_editStartTime)) / double(USECS_PER_SECOND);
|
const double time = (int64_t(usecTimestampNow()) - int64_t(_editStartTime)) / double(USECS_PER_SECOND);
|
||||||
|
const float eventDuration = _parameters->_durations[_parameters->_editedCategory];
|
||||||
|
|
||||||
switch (_parameters->_editedCategory) {
|
switch (_parameters->_editedCategory) {
|
||||||
case FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN:
|
case FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN:
|
||||||
{
|
{
|
||||||
const double waitTime = 0.5; // Wait between fade in and out
|
const double waitTime = 0.5; // Wait between fade in and out
|
||||||
const float eventDuration = _parameters->_durations[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN];
|
|
||||||
double cycleTime = fmod(time, (eventDuration+waitTime) * 2.0);
|
double cycleTime = fmod(time, (eventDuration+waitTime) * 2.0);
|
||||||
|
|
||||||
if (cycleTime < eventDuration) {
|
if (cycleTime < eventDuration) {
|
||||||
|
@ -401,7 +415,35 @@ void FadeRenderJob::updateFadeEdit() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FadeJobConfig::USER_ENTER_LEAVE_DOMAIN:
|
case FadeJobConfig::USER_ENTER_LEAVE_DOMAIN:
|
||||||
break;
|
{
|
||||||
|
const double waitTime = 0.5; // Wait between fade in and out
|
||||||
|
double cycleTime = fmod(time, (eventDuration + waitTime) * 2.0);
|
||||||
|
|
||||||
|
_editNoiseOffset.x = time*0.5;
|
||||||
|
_editNoiseOffset.y = 0.f;
|
||||||
|
_editNoiseOffset.z = time*0.75;
|
||||||
|
|
||||||
|
_editBaseOffset.x = 0.f;
|
||||||
|
_editBaseOffset.y = -itemBounds.bound.getDimensions().y;
|
||||||
|
_editBaseOffset.z = 0.f;
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cycleTime < eventDuration) {
|
||||||
|
_editThreshold = 1.f - computeElementEnterThreshold(cycleTime);
|
||||||
|
}
|
||||||
|
else if (cycleTime < (eventDuration + waitTime)) {
|
||||||
|
_editThreshold = 0.f;
|
||||||
|
}
|
||||||
|
else if (cycleTime < (2 * eventDuration + waitTime)) {
|
||||||
|
_editThreshold = computeElementEnterThreshold(cycleTime - (eventDuration + waitTime));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_editThreshold = 1.f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case FadeJobConfig::AVATAR_CHANGE:
|
case FadeJobConfig::AVATAR_CHANGE:
|
||||||
break;
|
break;
|
||||||
|
@ -443,6 +485,8 @@ bool FadeRenderJob::bindPerItem(gpu::Batch& batch, const gpu::Pipeline* pipeline
|
||||||
if (fadeNoiseOffsetLocation >= 0 || fadeBaseOffsetLocation>=0 || fadeThresholdLocation >= 0 || fadeCategoryLocation>=0) {
|
if (fadeNoiseOffsetLocation >= 0 || fadeBaseOffsetLocation>=0 || fadeThresholdLocation >= 0 || fadeCategoryLocation>=0) {
|
||||||
float threshold;
|
float threshold;
|
||||||
int eventCategory = FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN;
|
int eventCategory = FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN;
|
||||||
|
glm::vec3 noiseOffset = offset;
|
||||||
|
glm::vec3 baseOffset = offset;
|
||||||
|
|
||||||
threshold = 1.f-computeFadePercent(startTime);
|
threshold = 1.f-computeFadePercent(startTime);
|
||||||
|
|
||||||
|
@ -451,14 +495,16 @@ bool FadeRenderJob::bindPerItem(gpu::Batch& batch, const gpu::Pipeline* pipeline
|
||||||
if (_currentInstance->_parameters->_isEditEnabled) {
|
if (_currentInstance->_parameters->_isEditEnabled) {
|
||||||
eventCategory = _currentInstance->_parameters->_editedCategory;
|
eventCategory = _currentInstance->_parameters->_editedCategory;
|
||||||
threshold = _currentInstance->_editThreshold;
|
threshold = _currentInstance->_editThreshold;
|
||||||
|
noiseOffset += _currentInstance->_editNoiseOffset;
|
||||||
|
baseOffset += _currentInstance->_editBaseOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
batch._glUniform1i(fadeCategoryLocation, eventCategory);
|
batch._glUniform1i(fadeCategoryLocation, eventCategory);
|
||||||
batch._glUniform1f(fadeThresholdLocation, threshold);
|
batch._glUniform1f(fadeThresholdLocation, threshold);
|
||||||
// This is really temporary
|
// This is really temporary
|
||||||
batch._glUniform3f(fadeNoiseOffsetLocation, offset.x, offset.y, offset.z);
|
batch._glUniform3f(fadeNoiseOffsetLocation, noiseOffset.x, noiseOffset.y, noiseOffset.z);
|
||||||
// This is really temporary
|
// This is really temporary
|
||||||
batch._glUniform3f(fadeBaseOffsetLocation, offset.x, offset.y, offset.z);
|
batch._glUniform3f(fadeBaseOffsetLocation, baseOffset.x, baseOffset.y, baseOffset.z);
|
||||||
|
|
||||||
return threshold > 0.f;
|
return threshold > 0.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,15 +126,29 @@ public:
|
||||||
float getEdgeOuterIntensity() const { return edgeOuterColor[editedCategory].a; }
|
float getEdgeOuterIntensity() const { return edgeOuterColor[editedCategory].a; }
|
||||||
|
|
||||||
int editedCategory{ ELEMENT_ENTER_LEAVE_DOMAIN };
|
int editedCategory{ ELEMENT_ENTER_LEAVE_DOMAIN };
|
||||||
glm::vec3 baseSize[EVENT_CATEGORY_COUNT]{
|
glm::vec3 noiseSize[EVENT_CATEGORY_COUNT]{
|
||||||
{ 0.4f, 0.4f, 0.4f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
{ 1.f, 1.f, 1.f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_OWNER
|
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_OWNER
|
||||||
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_TRESPASSER
|
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_TRESPASSER
|
||||||
{ 0.875f, 0.4f, 0.875f }, // USER_ENTER_LEAVE_DOMAIN
|
{ 10.f, 0.01f, 10.0f }, // USER_ENTER_LEAVE_DOMAIN
|
||||||
|
{ 0.4f, 0.4f, 0.4f }, // AVATAR_CHANGE
|
||||||
|
};
|
||||||
|
float noiseLevel[EVENT_CATEGORY_COUNT]{
|
||||||
|
1.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
|
1.0f, // BUBBLE_ISECT_OWNER
|
||||||
|
1.0f, // BUBBLE_ISECT_TRESPASSER
|
||||||
|
0.70f, // USER_ENTER_LEAVE_DOMAIN
|
||||||
|
1.0f, // AVATAR_CHANGE
|
||||||
|
};
|
||||||
|
glm::vec3 baseSize[EVENT_CATEGORY_COUNT]{
|
||||||
|
{ 1.0f, 1.0f, 1.0f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
|
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_OWNER
|
||||||
|
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_TRESPASSER
|
||||||
|
{ 10000.f, 1.0f, 10000.0f }, // USER_ENTER_LEAVE_DOMAIN
|
||||||
{ 0.4f, 0.4f, 0.4f }, // AVATAR_CHANGE
|
{ 0.4f, 0.4f, 0.4f }, // AVATAR_CHANGE
|
||||||
};
|
};
|
||||||
float baseLevel[EVENT_CATEGORY_COUNT]{
|
float baseLevel[EVENT_CATEGORY_COUNT]{
|
||||||
1.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
0.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
1.0f, // BUBBLE_ISECT_OWNER
|
1.0f, // BUBBLE_ISECT_OWNER
|
||||||
1.0f, // BUBBLE_ISECT_TRESPASSER
|
1.0f, // BUBBLE_ISECT_TRESPASSER
|
||||||
1.0f, // USER_ENTER_LEAVE_DOMAIN
|
1.0f, // USER_ENTER_LEAVE_DOMAIN
|
||||||
|
@ -147,20 +161,6 @@ public:
|
||||||
true, // USER_ENTER_LEAVE_DOMAIN
|
true, // USER_ENTER_LEAVE_DOMAIN
|
||||||
false, // AVATAR_CHANGE
|
false, // AVATAR_CHANGE
|
||||||
};
|
};
|
||||||
glm::vec3 noiseSize[EVENT_CATEGORY_COUNT]{
|
|
||||||
{ 0.41f, 0.41f, 0.41f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
|
||||||
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_OWNER
|
|
||||||
{ 0.4f, 0.4f, 0.4f }, // BUBBLE_ISECT_TRESPASSER
|
|
||||||
{ 0.4f, 0.4f, 0.4f }, // USER_ENTER_LEAVE_DOMAIN
|
|
||||||
{ 0.4f, 0.4f, 0.4f }, // AVATAR_CHANGE
|
|
||||||
};
|
|
||||||
float noiseLevel[EVENT_CATEGORY_COUNT]{
|
|
||||||
1.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
|
||||||
1.0f, // BUBBLE_ISECT_OWNER
|
|
||||||
1.0f, // BUBBLE_ISECT_TRESPASSER
|
|
||||||
1.0f, // USER_ENTER_LEAVE_DOMAIN
|
|
||||||
1.0f, // AVATAR_CHANGE
|
|
||||||
};
|
|
||||||
float _duration[EVENT_CATEGORY_COUNT]{
|
float _duration[EVENT_CATEGORY_COUNT]{
|
||||||
4.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
4.0f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
0.0f, // BUBBLE_ISECT_OWNER
|
0.0f, // BUBBLE_ISECT_OWNER
|
||||||
|
@ -172,21 +172,21 @@ public:
|
||||||
0.10f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
0.10f, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
0.10f, // BUBBLE_ISECT_OWNER
|
0.10f, // BUBBLE_ISECT_OWNER
|
||||||
0.10f, // BUBBLE_ISECT_TRESPASSER
|
0.10f, // BUBBLE_ISECT_TRESPASSER
|
||||||
0.10f, // USER_ENTER_LEAVE_DOMAIN
|
0.529f, // USER_ENTER_LEAVE_DOMAIN
|
||||||
0.05f, // AVATAR_CHANGE
|
0.05f, // AVATAR_CHANGE
|
||||||
};
|
};
|
||||||
glm::vec4 edgeInnerColor[EVENT_CATEGORY_COUNT]{
|
glm::vec4 edgeInnerColor[EVENT_CATEGORY_COUNT]{
|
||||||
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 0.0f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 0.0f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
{ 31.f / 255.f, 198.f / 255.f, 166.f / 255.f, 1.0f }, // BUBBLE_ISECT_OWNER
|
{ 31.f / 255.f, 198.f / 255.f, 166.f / 255.f, 1.0f }, // BUBBLE_ISECT_OWNER
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // BUBBLE_ISECT_TRESPASSER
|
{ 1.0f, 1.0f, 1.0f, 1.0f }, // BUBBLE_ISECT_TRESPASSER
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // USER_ENTER_LEAVE_DOMAIN
|
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 0.25f }, // USER_ENTER_LEAVE_DOMAIN
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // AVATAR_CHANGE
|
{ 1.0f, 1.0f, 1.0f, 1.0f }, // AVATAR_CHANGE
|
||||||
};
|
};
|
||||||
glm::vec4 edgeOuterColor[EVENT_CATEGORY_COUNT]{
|
glm::vec4 edgeOuterColor[EVENT_CATEGORY_COUNT]{
|
||||||
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 1.0f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 1.0f }, // ELEMENT_ENTER_LEAVE_DOMAIN
|
||||||
{ 31.f / 255.f, 198.f / 255.f, 166.f / 255.f, 1.0f }, // BUBBLE_ISECT_OWNER
|
{ 31.f / 255.f, 198.f / 255.f, 166.f / 255.f, 1.0f }, // BUBBLE_ISECT_OWNER
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // BUBBLE_ISECT_TRESPASSER
|
{ 1.0f, 1.0f, 1.0f, 1.0f }, // BUBBLE_ISECT_TRESPASSER
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // USER_ENTER_LEAVE_DOMAIN
|
{ 78.f / 255.f, 215.f / 255.f, 255.f / 255.f, 1.0f }, // USER_ENTER_LEAVE_DOMAIN
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // AVATAR_CHANGE
|
{ 1.0f, 1.0f, 1.0f, 1.0f }, // AVATAR_CHANGE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ public:
|
||||||
using FadeOutput = render::VaryingArray<render::ItemBounds, FadeBuckets::NUM_BUCKETS>;
|
using FadeOutput = render::VaryingArray<render::ItemBounds, FadeBuckets::NUM_BUCKETS>;
|
||||||
|
|
||||||
using Input = RenderFetchCullSortTask::Output;
|
using Input = RenderFetchCullSortTask::Output;
|
||||||
using Output = render::VaryingSet2<RenderFetchCullSortTask::Output, FadeOutput>;
|
using Output = render::VaryingSet3 < RenderFetchCullSortTask::Output, FadeOutput, render::Item::Bound > ;
|
||||||
using Config = FadeSwitchJobConfig;
|
using Config = FadeSwitchJobConfig;
|
||||||
using JobModel = render::Job::ModelIO<FadeSwitchJob, Input, Output, Config>;
|
using JobModel = render::Job::ModelIO<FadeSwitchJob, Input, Output, Config>;
|
||||||
|
|
||||||
|
@ -263,16 +263,17 @@ class FadeConfigureJob {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using UniformBuffer = gpu::StructBuffer<FadeConfiguration>;
|
using UniformBuffer = gpu::StructBuffer<FadeConfiguration>;
|
||||||
|
using Input = render::Item::Bound ;
|
||||||
using Output = render::VaryingSet2<gpu::TexturePointer, UniformBuffer>;
|
using Output = render::VaryingSet2<gpu::TexturePointer, UniformBuffer>;
|
||||||
using Config = FadeJobConfig;
|
using Config = FadeJobConfig;
|
||||||
using JobModel = render::Job::ModelO<FadeConfigureJob, Output, Config>;
|
using JobModel = render::Job::ModelIO<FadeConfigureJob, Input, Output, Config>;
|
||||||
|
|
||||||
FadeConfigureJob(FadeCommonParameters::Pointer commonParams);
|
FadeConfigureJob(FadeCommonParameters::Pointer commonParams);
|
||||||
|
|
||||||
const gpu::TexturePointer getFadeMaskMap() const { return _fadeMaskMap; }
|
const gpu::TexturePointer getFadeMaskMap() const { return _fadeMaskMap; }
|
||||||
|
|
||||||
void configure(const Config& config);
|
void configure(const Config& config);
|
||||||
void run(const render::RenderContextPointer& renderContext, Output& output);
|
void run(const render::RenderContextPointer& renderContext, const Input& input, Output& output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -316,8 +317,10 @@ private:
|
||||||
// Everything needed for interactive edition
|
// Everything needed for interactive edition
|
||||||
uint64_t _editStartTime{ 0 };
|
uint64_t _editStartTime{ 0 };
|
||||||
float _editThreshold{ 0.f };
|
float _editThreshold{ 0.f };
|
||||||
|
glm::vec3 _editNoiseOffset{ 0.f, 0.f, 0.f };
|
||||||
|
glm::vec3 _editBaseOffset{ 0.f, 0.f, 0.f };
|
||||||
|
|
||||||
void updateFadeEdit();
|
void updateFadeEdit(const render::ItemBound& itemBounds);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_FadeEffect_h
|
#endif // hifi_FadeEffect_h
|
||||||
|
|
|
@ -55,24 +55,26 @@ void RenderDeferredTask::configure(const Config& config)
|
||||||
void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
|
void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
|
||||||
auto commonFadeParameters = std::make_shared<FadeCommonParameters>();
|
auto commonFadeParameters = std::make_shared<FadeCommonParameters>();
|
||||||
const auto fadeSwitchOutputs = task.addJob<FadeSwitchJob>("FadeSwitch", input, commonFadeParameters).get<FadeSwitchJob::Output>();
|
const auto fadeSwitchOutputs = task.addJob<FadeSwitchJob>("FadeSwitch", input, commonFadeParameters).get<FadeSwitchJob::Output>();
|
||||||
const auto fadeConfigureOutputs = task.addJob<FadeConfigureJob>("FadeConfigure", commonFadeParameters).get<FadeConfigureJob::Output>();
|
|
||||||
|
|
||||||
const auto& items = fadeSwitchOutputs.get0();
|
const auto& items = fadeSwitchOutputs.get0();
|
||||||
const auto& fadeItems = fadeSwitchOutputs.get1();
|
const auto& fadeItems = fadeSwitchOutputs.get1();
|
||||||
|
const auto& fadeEditedItem = fadeSwitchOutputs[2];
|
||||||
|
|
||||||
|
const auto fadeConfigureOutputs = task.addJob<FadeConfigureJob>("FadeConfigure", fadeEditedItem, commonFadeParameters).get<FadeConfigureJob::Output>();
|
||||||
|
|
||||||
// Prepare the ShapePipelines
|
// Prepare the ShapePipelines
|
||||||
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
||||||
initDeferredPipelines(*shapePlumber);
|
initDeferredPipelines(*shapePlumber);
|
||||||
|
|
||||||
// Extract opaques / transparents / lights / metas / overlays / background
|
// Extract opaques / transparents / lights / metas / overlays / background
|
||||||
const auto opaques = items[RenderFetchCullSortTask::OPAQUE_SHAPE];
|
const auto& opaques = items.get0()[RenderFetchCullSortTask::OPAQUE_SHAPE];
|
||||||
const auto transparents = items[RenderFetchCullSortTask::TRANSPARENT_SHAPE];
|
const auto& transparents = items.get0()[RenderFetchCullSortTask::TRANSPARENT_SHAPE];
|
||||||
const auto lights = items[RenderFetchCullSortTask::LIGHT];
|
const auto& lights = items.get0()[RenderFetchCullSortTask::LIGHT];
|
||||||
const auto metas = items[RenderFetchCullSortTask::META];
|
const auto& metas = items.get0()[RenderFetchCullSortTask::META];
|
||||||
const auto overlayOpaques = items[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE];
|
const auto& overlayOpaques = items.get0()[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE];
|
||||||
const auto overlayTransparents = items[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE];
|
const auto& overlayTransparents = items.get0()[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE];
|
||||||
const auto background = items[RenderFetchCullSortTask::BACKGROUND];
|
const auto& background = items.get0()[RenderFetchCullSortTask::BACKGROUND];
|
||||||
const auto spatialSelection = items[RenderFetchCullSortTask::SPATIAL_SELECTION];
|
const auto& spatialSelection = items[1];
|
||||||
|
|
||||||
// Filter the non antialiaased overlays
|
// Filter the non antialiaased overlays
|
||||||
const int LAYER_NO_AA = 3;
|
const int LAYER_NO_AA = 3;
|
||||||
|
@ -87,7 +89,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
|
|
||||||
const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques");
|
const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques");
|
||||||
|
|
||||||
const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).hasVarying();
|
const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).asVarying();
|
||||||
const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs);
|
const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs);
|
||||||
const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0);
|
const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0);
|
||||||
const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1);
|
const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1);
|
||||||
|
@ -96,11 +98,11 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
|
task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
|
||||||
|
|
||||||
// Render opaque objects in DeferredBuffer
|
// Render opaque objects in DeferredBuffer
|
||||||
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).hasVarying();
|
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying();
|
||||||
task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber);
|
task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber);
|
||||||
|
|
||||||
const auto fadeOpaques = fadeItems[FadeSwitchJob::OPAQUE_SHAPE];
|
const auto fadeOpaques = fadeItems[FadeSwitchJob::OPAQUE_SHAPE];
|
||||||
const auto fadeOpaqueInputs = FadeRenderJob::Input(fadeOpaques, lightingModel, fadeConfigureOutputs).hasVarying();
|
const auto fadeOpaqueInputs = FadeRenderJob::Input(fadeOpaques, lightingModel, fadeConfigureOutputs).asVarying();
|
||||||
task.addJob<FadeRenderJob>("DrawFadeOpaque", fadeOpaqueInputs, commonFadeParameters, shapePlumber);
|
task.addJob<FadeRenderJob>("DrawFadeOpaque", fadeOpaqueInputs, commonFadeParameters, shapePlumber);
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,12 +112,12 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
// Opaque all rendered
|
// Opaque all rendered
|
||||||
|
|
||||||
// Linear Depth Pass
|
// Linear Depth Pass
|
||||||
const auto linearDepthPassInputs = LinearDepthPass::Inputs(deferredFrameTransform, deferredFramebuffer).hasVarying();
|
const auto linearDepthPassInputs = LinearDepthPass::Inputs(deferredFrameTransform, deferredFramebuffer).asVarying();
|
||||||
const auto linearDepthPassOutputs = task.addJob<LinearDepthPass>("LinearDepth", linearDepthPassInputs);
|
const auto linearDepthPassOutputs = task.addJob<LinearDepthPass>("LinearDepth", linearDepthPassInputs);
|
||||||
const auto linearDepthTarget = linearDepthPassOutputs.getN<LinearDepthPass::Outputs>(0);
|
const auto linearDepthTarget = linearDepthPassOutputs.getN<LinearDepthPass::Outputs>(0);
|
||||||
|
|
||||||
// Curvature pass
|
// Curvature pass
|
||||||
const auto surfaceGeometryPassInputs = SurfaceGeometryPass::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
const auto surfaceGeometryPassInputs = SurfaceGeometryPass::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).asVarying();
|
||||||
const auto surfaceGeometryPassOutputs = task.addJob<SurfaceGeometryPass>("SurfaceGeometry", surfaceGeometryPassInputs);
|
const auto surfaceGeometryPassOutputs = task.addJob<SurfaceGeometryPass>("SurfaceGeometry", surfaceGeometryPassInputs);
|
||||||
const auto surfaceGeometryFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(0);
|
const auto surfaceGeometryFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(0);
|
||||||
const auto curvatureFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(1);
|
const auto curvatureFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(1);
|
||||||
|
@ -126,7 +128,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
const auto scatteringResource = task.addJob<SubsurfaceScattering>("Scattering");
|
const auto scatteringResource = task.addJob<SubsurfaceScattering>("Scattering");
|
||||||
|
|
||||||
// AO job
|
// AO job
|
||||||
const auto ambientOcclusionInputs = AmbientOcclusionEffect::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
const auto ambientOcclusionInputs = AmbientOcclusionEffect::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).asVarying();
|
||||||
const auto ambientOcclusionOutputs = task.addJob<AmbientOcclusionEffect>("AmbientOcclusion", ambientOcclusionInputs);
|
const auto ambientOcclusionOutputs = task.addJob<AmbientOcclusionEffect>("AmbientOcclusion", ambientOcclusionInputs);
|
||||||
const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
||||||
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
||||||
|
@ -140,13 +142,13 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
|
|
||||||
// Light Clustering
|
// Light Clustering
|
||||||
// Create the cluster grid of lights, cpu job for now
|
// Create the cluster grid of lights, cpu job for now
|
||||||
const auto lightClusteringPassInputs = LightClusteringPass::Inputs(deferredFrameTransform, lightingModel, linearDepthTarget).hasVarying();
|
const auto lightClusteringPassInputs = LightClusteringPass::Inputs(deferredFrameTransform, lightingModel, linearDepthTarget).asVarying();
|
||||||
const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
|
const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
|
||||||
|
|
||||||
|
|
||||||
// DeferredBuffer is complete, now let's shade it into the LightingBuffer
|
// DeferredBuffer is complete, now let's shade it into the LightingBuffer
|
||||||
const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
||||||
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource, lightClusters).hasVarying();
|
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource, lightClusters).asVarying();
|
||||||
|
|
||||||
task.addJob<RenderDeferred>("RenderDeferred", deferredLightingInputs);
|
task.addJob<RenderDeferred>("RenderDeferred", deferredLightingInputs);
|
||||||
|
|
||||||
|
@ -154,16 +156,16 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<DrawBackgroundStage>("DrawBackgroundDeferred", lightingModel);
|
task.addJob<DrawBackgroundStage>("DrawBackgroundDeferred", lightingModel);
|
||||||
|
|
||||||
// Render transparent objects forward in LightingBuffer
|
// Render transparent objects forward in LightingBuffer
|
||||||
const auto transparentsInputs = DrawDeferred::Inputs(transparents, lightingModel).hasVarying();
|
const auto transparentsInputs = DrawDeferred::Inputs(transparents, lightingModel).asVarying();
|
||||||
task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
|
task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
|
||||||
|
|
||||||
const auto fadeTransparents = fadeItems[FadeSwitchJob::TRANSPARENT_SHAPE];
|
const auto fadeTransparents = fadeItems[FadeSwitchJob::TRANSPARENT_SHAPE];
|
||||||
const auto fadeTransparentInputs = FadeRenderJob::Input(fadeTransparents, lightingModel, fadeConfigureOutputs).hasVarying();
|
const auto fadeTransparentInputs = FadeRenderJob::Input(fadeTransparents, lightingModel, fadeConfigureOutputs).asVarying();
|
||||||
task.addJob<FadeRenderJob>("DrawFadeTransparent", fadeTransparentInputs, commonFadeParameters, shapePlumber);
|
task.addJob<FadeRenderJob>("DrawFadeTransparent", fadeTransparentInputs, commonFadeParameters, shapePlumber);
|
||||||
|
|
||||||
// LIght Cluster Grid Debuging job
|
// LIght Cluster Grid Debuging job
|
||||||
{
|
{
|
||||||
const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, linearDepthTarget, lightClusters).hasVarying();
|
const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, linearDepthTarget, lightClusters).asVarying();
|
||||||
task.addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
|
task.addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,8 +186,8 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlays
|
// Overlays
|
||||||
const auto overlayOpaquesInputs = DrawOverlay3D::Inputs(overlayOpaques, lightingModel).hasVarying();
|
const auto overlayOpaquesInputs = DrawOverlay3D::Inputs(overlayOpaques, lightingModel).asVarying();
|
||||||
const auto overlayTransparentsInputs = DrawOverlay3D::Inputs(overlayTransparents, lightingModel).hasVarying();
|
const auto overlayTransparentsInputs = DrawOverlay3D::Inputs(overlayTransparents, lightingModel).asVarying();
|
||||||
task.addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
task.addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
||||||
task.addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
task.addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
||||||
|
|
||||||
|
@ -201,10 +203,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
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,
|
||||||
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource).hasVarying();
|
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource).asVarying();
|
||||||
task.addJob<DebugSubsurfaceScattering>("DebugScattering", debugSubsurfaceScatteringInputs);
|
task.addJob<DebugSubsurfaceScattering>("DebugScattering", debugSubsurfaceScatteringInputs);
|
||||||
|
|
||||||
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).hasVarying();
|
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).asVarying();
|
||||||
task.addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
task.addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
||||||
|
|
||||||
// Scene Octree Debugging job
|
// Scene Octree Debugging job
|
||||||
|
@ -229,7 +231,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<Antialiasing>("Antialiasing", primaryFramebuffer);
|
task.addJob<Antialiasing>("Antialiasing", primaryFramebuffer);
|
||||||
|
|
||||||
// Draw 2DWeb non AA
|
// Draw 2DWeb non AA
|
||||||
const auto nonAAOverlaysInputs = DrawOverlay3D::Inputs(nonAAOverlays, lightingModel).hasVarying();
|
const auto nonAAOverlaysInputs = DrawOverlay3D::Inputs(nonAAOverlays, lightingModel).asVarying();
|
||||||
task.addJob<DrawOverlay3D>("Draw2DWebSurfaces", nonAAOverlaysInputs, false);
|
task.addJob<DrawOverlay3D>("Draw2DWebSurfaces", nonAAOverlaysInputs, false);
|
||||||
|
|
||||||
task.addJob<EndGPURangeTimer>("ToneAndPostRangeTimer", toneAndPostRangeTimer);
|
task.addJob<EndGPURangeTimer>("ToneAndPostRangeTimer", toneAndPostRangeTimer);
|
||||||
|
|
|
@ -36,14 +36,14 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
||||||
initForwardPipelines(*shapePlumber);
|
initForwardPipelines(*shapePlumber);
|
||||||
|
|
||||||
// Extract opaques / transparents / lights / metas / overlays / background
|
// Extract opaques / transparents / lights / metas / overlays / background
|
||||||
const auto opaques = items[RenderFetchCullSortTask::OPAQUE_SHAPE];
|
const auto& opaques = items.get0()[RenderFetchCullSortTask::OPAQUE_SHAPE];
|
||||||
const auto transparents = items[RenderFetchCullSortTask::TRANSPARENT_SHAPE];
|
const auto& transparents = items.get0()[RenderFetchCullSortTask::TRANSPARENT_SHAPE];
|
||||||
const auto lights = items[RenderFetchCullSortTask::LIGHT];
|
const auto& lights = items.get0()[RenderFetchCullSortTask::LIGHT];
|
||||||
const auto metas = items[RenderFetchCullSortTask::META];
|
const auto& metas = items.get0()[RenderFetchCullSortTask::META];
|
||||||
const auto overlayOpaques = items[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE];
|
const auto& overlayOpaques = items.get0()[RenderFetchCullSortTask::OVERLAY_OPAQUE_SHAPE];
|
||||||
const auto overlayTransparents = items[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE];
|
const auto& overlayTransparents = items.get0()[RenderFetchCullSortTask::OVERLAY_TRANSPARENT_SHAPE];
|
||||||
const auto background = items[RenderFetchCullSortTask::BACKGROUND];
|
const auto& background = items.get0()[RenderFetchCullSortTask::BACKGROUND];
|
||||||
const auto spatialSelection = items[RenderFetchCullSortTask::SPATIAL_SELECTION];
|
const auto& spatialSelection = items[1];
|
||||||
|
|
||||||
const auto framebuffer = task.addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
const auto framebuffer = task.addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void FilterLayeredItems::run(const RenderContextPointer& renderContext, const It
|
||||||
outItems.clear();
|
outItems.clear();
|
||||||
|
|
||||||
// For each item, filter it into one bucket
|
// For each item, filter it into one bucket
|
||||||
for (auto itemBound : inItems) {
|
for (auto& itemBound : inItems) {
|
||||||
auto& item = scene->getItem(itemBound.id);
|
auto& item = scene->getItem(itemBound.id);
|
||||||
if (item.getLayer() == _keepLayer) {
|
if (item.getLayer() == _keepLayer) {
|
||||||
outItems.emplace_back(itemBound);
|
outItems.emplace_back(itemBound);
|
||||||
|
|
|
@ -65,5 +65,5 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
||||||
const auto overlayTransparents = task.addJob<DepthSortItems>("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
const auto overlayTransparents = task.addJob<DepthSortItems>("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
||||||
const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET];
|
const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET];
|
||||||
|
|
||||||
output = Output{opaques, transparents, lights, metas, overlayOpaques, overlayTransparents, background, spatialSelection};
|
output = Output(BucketList{ opaques, transparents, lights, metas, overlayOpaques, overlayTransparents, background }, spatialSelection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,12 @@ public:
|
||||||
OVERLAY_OPAQUE_SHAPE,
|
OVERLAY_OPAQUE_SHAPE,
|
||||||
OVERLAY_TRANSPARENT_SHAPE,
|
OVERLAY_TRANSPARENT_SHAPE,
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
SPATIAL_SELECTION,
|
|
||||||
|
|
||||||
NUM_BUCKETS
|
NUM_BUCKETS
|
||||||
};
|
};
|
||||||
|
|
||||||
using Output = render::VaryingArray<render::ItemBounds, Buckets::NUM_BUCKETS>;
|
using BucketList = render::VaryingArray<render::ItemBounds, Buckets::NUM_BUCKETS>;
|
||||||
|
using Output = render::VaryingSet2<BucketList, render::ItemSpatialTree::ItemSelection>;
|
||||||
using JobModel = render::Task::ModelO<RenderFetchCullSortTask, Output>;
|
using JobModel = render::Task::ModelO<RenderFetchCullSortTask, Output>;
|
||||||
|
|
||||||
RenderFetchCullSortTask() {}
|
RenderFetchCullSortTask() {}
|
||||||
|
|
|
@ -40,6 +40,8 @@ public:
|
||||||
template <class T> Varying getN (uint8_t index) const { return get<T>()[index]; }
|
template <class T> Varying getN (uint8_t index) const { return get<T>()[index]; }
|
||||||
template <class T> Varying editN (uint8_t index) { return edit<T>()[index]; }
|
template <class T> Varying editN (uint8_t index) { return edit<T>()[index]; }
|
||||||
|
|
||||||
|
bool isNull() const { return _concept == nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class Concept {
|
class Concept {
|
||||||
public:
|
public:
|
||||||
|
@ -93,7 +95,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual uint8_t length() const { return 2; }
|
virtual uint8_t length() const { return 2; }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual uint8_t length() const { return 3; }
|
virtual uint8_t length() const { return 3; }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T0, class T1, class T2, class T3>
|
template <class T0, class T1, class T2, class T3>
|
||||||
|
@ -163,7 +165,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual uint8_t length() const { return 4; }
|
virtual uint8_t length() const { return 4; }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,7 +208,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual uint8_t length() const { return 5; }
|
virtual uint8_t length() const { return 5; }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
||||||
|
@ -236,7 +238,7 @@ public:
|
||||||
const T5& get5() const { return std::get<5>((*this)).template get<T5>(); }
|
const T5& get5() const { return std::get<5>((*this)).template get<T5>(); }
|
||||||
T5& edit5() { return std::get<5>((*this)).template edit<T5>(); }
|
T5& edit5() { return std::get<5>((*this)).template edit<T5>(); }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
||||||
|
@ -269,7 +271,7 @@ public:
|
||||||
const T6& get6() const { return std::get<6>((*this)).template get<T6>(); }
|
const T6& get6() const { return std::get<6>((*this)).template get<T6>(); }
|
||||||
T6& edit6() { return std::get<6>((*this)).template edit<T6>(); }
|
T6& edit6() { return std::get<6>((*this)).template edit<T6>(); }
|
||||||
|
|
||||||
Varying hasVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue