mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-05 19:58:15 +02:00
Added timing parameters and visual debug of threshold
This commit is contained in:
parent
0244dd6325
commit
7d851c1cbd
6 changed files with 418 additions and 236 deletions
|
@ -25,7 +25,7 @@ struct FadeParameters
|
||||||
vec4 _innerEdgeColor;
|
vec4 _innerEdgeColor;
|
||||||
vec4 _outerEdgeColor;
|
vec4 _outerEdgeColor;
|
||||||
vec2 _edgeWidthInvWidth;
|
vec2 _edgeWidthInvWidth;
|
||||||
int _invertBase;
|
int _isInverted;
|
||||||
float _padding;
|
float _padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void applyFadeClip(vec3 position) {
|
||||||
|
|
||||||
void applyFade(vec3 position, out vec3 emissive) {
|
void applyFade(vec3 position, out vec3 emissive) {
|
||||||
float alpha = evalFadeAlpha(position);
|
float alpha = evalFadeAlpha(position);
|
||||||
if (fadeParameters[fadeCategory]._invertBase!=0) {
|
if (fadeParameters[fadeCategory]._isInverted!=0) {
|
||||||
alpha = -alpha;
|
alpha = -alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define FADE_MIN_SCALE 0.001
|
#define FADE_MIN_SCALE 0.001
|
||||||
#define FADE_MAX_SCALE 10000.0
|
#define FADE_MAX_SCALE 10000.0
|
||||||
|
#define FADE_MAX_SPEED 50.f
|
||||||
|
|
||||||
inline float parameterToValuePow(float parameter, const double minValue, const double maxOverMinValue) {
|
inline float parameterToValuePow(float parameter, const double minValue, const double maxOverMinValue) {
|
||||||
return (float)(minValue * pow(maxOverMinValue, double(parameter)));
|
return (float)(minValue * pow(maxOverMinValue, double(parameter)));
|
||||||
|
@ -128,6 +129,18 @@ FadeJobConfig::FadeJobConfig()
|
||||||
noiseLevel[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = 0.7f;
|
noiseLevel[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = 0.7f;
|
||||||
noiseLevel[FadeJobConfig::AVATAR_CHANGE] = 1.f;
|
noiseLevel[FadeJobConfig::AVATAR_CHANGE] = 1.f;
|
||||||
|
|
||||||
|
noiseSpeed[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = glm::vec3{ 0.0f, 0.0f, 0.0f };
|
||||||
|
noiseSpeed[FadeJobConfig::BUBBLE_ISECT_OWNER] = glm::vec3{ 1.0f, 0.2f, 1.0f };
|
||||||
|
noiseSpeed[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = glm::vec3{ 1.0f, 0.2f, 1.0f };
|
||||||
|
noiseSpeed[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = glm::vec3{ 0.0f, -0.5f, 0.0f };
|
||||||
|
noiseSpeed[FadeJobConfig::AVATAR_CHANGE] = glm::vec3{ 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
timing[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = FadeJobConfig::LINEAR;
|
||||||
|
timing[FadeJobConfig::BUBBLE_ISECT_OWNER] = FadeJobConfig::LINEAR;
|
||||||
|
timing[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = FadeJobConfig::LINEAR;
|
||||||
|
timing[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = FadeJobConfig::LINEAR;
|
||||||
|
timing[FadeJobConfig::AVATAR_CHANGE] = FadeJobConfig::LINEAR;
|
||||||
|
|
||||||
baseSize[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = glm::vec3{ 1.0f, 1.0f, 1.0f };
|
baseSize[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = glm::vec3{ 1.0f, 1.0f, 1.0f };
|
||||||
baseSize[FadeJobConfig::BUBBLE_ISECT_OWNER] = glm::vec3{ 2.0f, 2.0f, 2.0f };
|
baseSize[FadeJobConfig::BUBBLE_ISECT_OWNER] = glm::vec3{ 2.0f, 2.0f, 2.0f };
|
||||||
baseSize[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = glm::vec3{ 2.0f, 2.0f, 2.0f };
|
baseSize[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = glm::vec3{ 2.0f, 2.0f, 2.0f };
|
||||||
|
@ -140,11 +153,11 @@ FadeJobConfig::FadeJobConfig()
|
||||||
baseLevel[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = 1.f;
|
baseLevel[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = 1.f;
|
||||||
baseLevel[FadeJobConfig::AVATAR_CHANGE] = 1.f;
|
baseLevel[FadeJobConfig::AVATAR_CHANGE] = 1.f;
|
||||||
|
|
||||||
baseInverted[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = false;
|
_isInverted[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = false;
|
||||||
baseInverted[FadeJobConfig::BUBBLE_ISECT_OWNER] = false;
|
_isInverted[FadeJobConfig::BUBBLE_ISECT_OWNER] = false;
|
||||||
baseInverted[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = false;
|
_isInverted[FadeJobConfig::BUBBLE_ISECT_TRESPASSER] = false;
|
||||||
baseInverted[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = true;
|
_isInverted[FadeJobConfig::USER_ENTER_LEAVE_DOMAIN] = true;
|
||||||
baseInverted[FadeJobConfig::AVATAR_CHANGE] = false;
|
_isInverted[FadeJobConfig::AVATAR_CHANGE] = false;
|
||||||
|
|
||||||
_duration[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = 4.f;
|
_duration[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN] = 4.f;
|
||||||
_duration[FadeJobConfig::BUBBLE_ISECT_OWNER] = 4.f;
|
_duration[FadeJobConfig::BUBBLE_ISECT_OWNER] = 4.f;
|
||||||
|
@ -219,13 +232,13 @@ void FadeJobConfig::setBaseLevel(float value) {
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setBaseInverted(bool value) {
|
void FadeJobConfig::setInverted(bool value) {
|
||||||
baseInverted[editedCategory] = value;
|
_isInverted[editedCategory] = value;
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FadeJobConfig::isBaseInverted() const {
|
bool FadeJobConfig::isInverted() const {
|
||||||
return baseInverted[editedCategory];
|
return _isInverted[editedCategory];
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setNoiseSizeX(float value) {
|
void FadeJobConfig::setNoiseSizeX(float value) {
|
||||||
|
@ -260,6 +273,33 @@ void FadeJobConfig::setNoiseLevel(float value) {
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FadeJobConfig::setNoiseSpeedX(float value) {
|
||||||
|
noiseSpeed[editedCategory].x = powf(value, 3.f)*FADE_MAX_SPEED;
|
||||||
|
emit dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
float FadeJobConfig::getNoiseSpeedX() const {
|
||||||
|
return powf(noiseSpeed[editedCategory].x / FADE_MAX_SPEED, 1.f/3.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FadeJobConfig::setNoiseSpeedY(float value) {
|
||||||
|
noiseSpeed[editedCategory].y = powf(value, 3.f)*FADE_MAX_SPEED;
|
||||||
|
emit dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
float FadeJobConfig::getNoiseSpeedY() const {
|
||||||
|
return powf(noiseSpeed[editedCategory].y / FADE_MAX_SPEED, 1.f / 3.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FadeJobConfig::setNoiseSpeedZ(float value) {
|
||||||
|
noiseSpeed[editedCategory].z = powf(value, 3.f)*FADE_MAX_SPEED;
|
||||||
|
emit dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
float FadeJobConfig::getNoiseSpeedZ() const {
|
||||||
|
return powf(noiseSpeed[editedCategory].z / FADE_MAX_SPEED, 1.f / 3.f);
|
||||||
|
}
|
||||||
|
|
||||||
void FadeJobConfig::setEdgeWidth(float value) {
|
void FadeJobConfig::setEdgeWidth(float value) {
|
||||||
edgeWidth[editedCategory] = value * value;
|
edgeWidth[editedCategory] = value * value;
|
||||||
emit dirty();
|
emit dirty();
|
||||||
|
@ -309,6 +349,12 @@ void FadeJobConfig::setEdgeOuterIntensity(float value) {
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FadeJobConfig::setTiming(int value) {
|
||||||
|
assert(value < TIMING_COUNT);
|
||||||
|
timing[editedCategory] = value;
|
||||||
|
emit dirty();
|
||||||
|
}
|
||||||
|
|
||||||
FadeConfigureJob::FadeConfigureJob(FadeCommonParameters::Pointer commonParams) :
|
FadeConfigureJob::FadeConfigureJob(FadeCommonParameters::Pointer commonParams) :
|
||||||
_parameters{ commonParams }
|
_parameters{ commonParams }
|
||||||
{
|
{
|
||||||
|
@ -334,12 +380,14 @@ 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] & 1;
|
configuration._isInverted = config._isInverted[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];
|
||||||
configuration._outerEdgeColor = config.edgeOuterColor[i];
|
configuration._outerEdgeColor = config.edgeOuterColor[i];
|
||||||
_parameters->_thresholdScale[i] = 1.f + 2.f*(configuration._edgeWidthInvWidth.x + std::max(0.f, (config.noiseLevel[i] + config.baseLevel[i])*0.5f-0.5f));
|
_parameters->_thresholdScale[i] = 1.f + 2.f*(configuration._edgeWidthInvWidth.x + std::max(0.f, (config.noiseLevel[i] + config.baseLevel[i])*0.5f-0.5f));
|
||||||
|
_parameters->_noiseSpeed[i] = config.noiseSpeed[i];
|
||||||
|
_parameters->_timing[i] = (FadeJobConfig::Timing) config.timing[i];
|
||||||
}
|
}
|
||||||
_isBufferDirty = true;
|
_isBufferDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -435,14 +483,28 @@ void FadeRenderJob::run(const render::RenderContextPointer& renderContext, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float FadeRenderJob::computeElementEnterThreshold(double time, const double period) const {
|
float FadeRenderJob::computeElementEnterThreshold(double time, const double period, FadeJobConfig::Timing timing) const {
|
||||||
assert(period > 0.0);
|
assert(period > 0.0);
|
||||||
float fadeAlpha = 1.0f;
|
float fadeAlpha = 1.0f;
|
||||||
const double INV_FADE_PERIOD = 1.0 / period;
|
const double INV_FADE_PERIOD = 1.0 / period;
|
||||||
double fraction = time * INV_FADE_PERIOD;
|
double fraction = time * INV_FADE_PERIOD;
|
||||||
fraction = std::max(fraction, 0.0);
|
fraction = std::max(fraction, 0.0);
|
||||||
if (fraction < 1.0) {
|
if (fraction < 1.0) {
|
||||||
fadeAlpha = Interpolate::easeInOutQuad(fraction);
|
switch (timing) {
|
||||||
|
default:
|
||||||
|
fadeAlpha = fraction;
|
||||||
|
break;
|
||||||
|
case FadeJobConfig::EASE_IN:
|
||||||
|
fadeAlpha = fraction*fraction;
|
||||||
|
break;
|
||||||
|
case FadeJobConfig::EASE_OUT:
|
||||||
|
fadeAlpha = 1.f - fraction;
|
||||||
|
fadeAlpha = 1.f- fadeAlpha*fadeAlpha;
|
||||||
|
break;
|
||||||
|
case FadeJobConfig::EASE_IN_OUT:
|
||||||
|
fadeAlpha = fraction*fraction*(3 - 2 * fraction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fadeAlpha;
|
return fadeAlpha;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +512,9 @@ float FadeRenderJob::computeElementEnterThreshold(double time, const double peri
|
||||||
float FadeRenderJob::computeFadePercent(quint64 startTime) {
|
float FadeRenderJob::computeFadePercent(quint64 startTime) {
|
||||||
const double time = (double)(int64_t(usecTimestampNow()) - int64_t(startTime)) / (double)(USECS_PER_SECOND);
|
const double time = (double)(int64_t(usecTimestampNow()) - int64_t(startTime)) / (double)(USECS_PER_SECOND);
|
||||||
assert(_currentInstance);
|
assert(_currentInstance);
|
||||||
return _currentInstance->computeElementEnterThreshold(time, _currentInstance->_parameters->_durations[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN]);
|
return _currentInstance->computeElementEnterThreshold(time,
|
||||||
|
_currentInstance->_parameters->_durations[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN],
|
||||||
|
_currentInstance->_parameters->_timing[FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderContext, const render::ItemBound& itemBounds) {
|
void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderContext, const render::ItemBound& itemBounds) {
|
||||||
|
@ -461,7 +525,9 @@ void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderCon
|
||||||
|
|
||||||
uint64_t now = usecTimestampNow();
|
uint64_t now = usecTimestampNow();
|
||||||
const double deltaTime = (int64_t(now) - int64_t(_editPreviousTime)) / double(USECS_PER_SECOND);
|
const double deltaTime = (int64_t(now) - int64_t(_editPreviousTime)) / double(USECS_PER_SECOND);
|
||||||
const double eventDuration = (double)_parameters->_durations[_parameters->_editedCategory];
|
const int editedCategory = _parameters->_editedCategory;
|
||||||
|
const double eventDuration = (double)_parameters->_durations[editedCategory];
|
||||||
|
const FadeJobConfig::Timing timing = _parameters->_timing[editedCategory];
|
||||||
const double waitTime = 0.5; // Wait between fade in and out
|
const double waitTime = 0.5; // Wait between fade in and out
|
||||||
double cycleTime = fmod(_editTime, (eventDuration + waitTime) * 2.0);
|
double cycleTime = fmod(_editTime, (eventDuration + waitTime) * 2.0);
|
||||||
|
|
||||||
|
@ -473,20 +539,24 @@ void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderCon
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (cycleTime < eventDuration) {
|
if (cycleTime < eventDuration) {
|
||||||
_editThreshold = 1.f - computeElementEnterThreshold(cycleTime, eventDuration);
|
_editThreshold = 1.f - computeElementEnterThreshold(cycleTime, eventDuration, timing);
|
||||||
}
|
}
|
||||||
else if (cycleTime < (eventDuration + waitTime)) {
|
else if (cycleTime < (eventDuration + waitTime)) {
|
||||||
_editThreshold = 0.f;
|
_editThreshold = 0.f;
|
||||||
}
|
}
|
||||||
else if (cycleTime < (2 * eventDuration + waitTime)) {
|
else if (cycleTime < (2 * eventDuration + waitTime)) {
|
||||||
_editThreshold = computeElementEnterThreshold(cycleTime - (eventDuration + waitTime), eventDuration);
|
_editThreshold = computeElementEnterThreshold(cycleTime - (eventDuration + waitTime), eventDuration, timing);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_editThreshold = 1.f;
|
_editThreshold = 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_parameters->_editedCategory) {
|
renderContext->jobConfig->setProperty("threshold", _editThreshold);
|
||||||
|
|
||||||
|
_editNoiseOffset = _parameters->_noiseSpeed[editedCategory] * (float)_editTime;
|
||||||
|
|
||||||
|
switch (editedCategory) {
|
||||||
case FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN:
|
case FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -497,9 +567,6 @@ void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderCon
|
||||||
float distance = glm::length(delta);
|
float distance = glm::length(delta);
|
||||||
|
|
||||||
delta = glm::normalize(delta) * std::max(0.f, distance - 0.5f);
|
delta = glm::normalize(delta) * std::max(0.f, distance - 0.5f);
|
||||||
_editNoiseOffset.x = _editTime*2.1f;
|
|
||||||
_editNoiseOffset.y = _editTime*1.0f;
|
|
||||||
_editNoiseOffset.z = _editTime*2.1f;
|
|
||||||
|
|
||||||
_editBaseOffset = cameraPos + delta*_editThreshold;
|
_editBaseOffset = cameraPos + delta*_editThreshold;
|
||||||
_editThreshold = 0.33f;
|
_editThreshold = 0.33f;
|
||||||
|
@ -508,20 +575,12 @@ void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderCon
|
||||||
|
|
||||||
case FadeJobConfig::BUBBLE_ISECT_TRESPASSER:
|
case FadeJobConfig::BUBBLE_ISECT_TRESPASSER:
|
||||||
{
|
{
|
||||||
_editNoiseOffset.x = _editTime*2.1f;
|
|
||||||
_editNoiseOffset.y = _editTime*1.0f;
|
|
||||||
_editNoiseOffset.z = _editTime*2.1f;
|
|
||||||
|
|
||||||
_editBaseOffset = glm::vec3{ 0.f, 0.f, 0.f };
|
_editBaseOffset = glm::vec3{ 0.f, 0.f, 0.f };
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FadeJobConfig::USER_ENTER_LEAVE_DOMAIN:
|
case FadeJobConfig::USER_ENTER_LEAVE_DOMAIN:
|
||||||
{
|
{
|
||||||
_editNoiseOffset.x = _editTime*0.5f;
|
|
||||||
_editNoiseOffset.y = 0.f;
|
|
||||||
_editNoiseOffset.z = _editTime*0.75f;
|
|
||||||
|
|
||||||
_editBaseOffset = itemBounds.bound.calcCenter();
|
_editBaseOffset = itemBounds.bound.calcCenter();
|
||||||
_editBaseOffset.y -= itemBounds.bound.getDimensions().y / 2.f;
|
_editBaseOffset.y -= itemBounds.bound.getDimensions().y / 2.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class FadeJobConfig : public render::Job::Config {
|
||||||
Q_PROPERTY(float baseSizeY READ getBaseSizeY WRITE setBaseSizeY NOTIFY dirty)
|
Q_PROPERTY(float baseSizeY READ getBaseSizeY WRITE setBaseSizeY NOTIFY dirty)
|
||||||
Q_PROPERTY(float baseSizeZ READ getBaseSizeZ WRITE setBaseSizeZ NOTIFY dirty)
|
Q_PROPERTY(float baseSizeZ READ getBaseSizeZ WRITE setBaseSizeZ NOTIFY dirty)
|
||||||
Q_PROPERTY(float baseLevel READ getBaseLevel WRITE setBaseLevel NOTIFY dirty)
|
Q_PROPERTY(float baseLevel READ getBaseLevel WRITE setBaseLevel NOTIFY dirty)
|
||||||
Q_PROPERTY(bool baseInverted READ isBaseInverted WRITE setBaseInverted NOTIFY dirty)
|
Q_PROPERTY(bool _isInverted READ isInverted WRITE setInverted NOTIFY dirty)
|
||||||
Q_PROPERTY(float noiseSizeX READ getNoiseSizeX WRITE setNoiseSizeX NOTIFY dirty)
|
Q_PROPERTY(float noiseSizeX READ getNoiseSizeX WRITE setNoiseSizeX NOTIFY dirty)
|
||||||
Q_PROPERTY(float noiseSizeY READ getNoiseSizeY WRITE setNoiseSizeY NOTIFY dirty)
|
Q_PROPERTY(float noiseSizeY READ getNoiseSizeY WRITE setNoiseSizeY NOTIFY dirty)
|
||||||
Q_PROPERTY(float noiseSizeZ READ getNoiseSizeZ WRITE setNoiseSizeZ NOTIFY dirty)
|
Q_PROPERTY(float noiseSizeZ READ getNoiseSizeZ WRITE setNoiseSizeZ NOTIFY dirty)
|
||||||
|
@ -54,6 +54,10 @@ class FadeJobConfig : public render::Job::Config {
|
||||||
Q_PROPERTY(float edgeOuterIntensity READ getEdgeOuterIntensity WRITE setEdgeOuterIntensity NOTIFY dirty)
|
Q_PROPERTY(float edgeOuterIntensity READ getEdgeOuterIntensity WRITE setEdgeOuterIntensity NOTIFY dirty)
|
||||||
Q_PROPERTY(bool manualFade MEMBER manualFade NOTIFY dirty)
|
Q_PROPERTY(bool manualFade MEMBER manualFade NOTIFY dirty)
|
||||||
Q_PROPERTY(float manualThreshold MEMBER manualThreshold NOTIFY dirty)
|
Q_PROPERTY(float manualThreshold MEMBER manualThreshold NOTIFY dirty)
|
||||||
|
Q_PROPERTY(int timing READ getTiming WRITE setTiming NOTIFY dirty)
|
||||||
|
Q_PROPERTY(float noiseSpeedX READ getNoiseSpeedX WRITE setNoiseSpeedX NOTIFY dirty)
|
||||||
|
Q_PROPERTY(float noiseSpeedY READ getNoiseSpeedY WRITE setNoiseSpeedY NOTIFY dirty)
|
||||||
|
Q_PROPERTY(float noiseSpeedZ READ getNoiseSpeedZ WRITE setNoiseSpeedZ NOTIFY dirty)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -68,6 +72,15 @@ public:
|
||||||
EVENT_CATEGORY_COUNT
|
EVENT_CATEGORY_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Timing {
|
||||||
|
LINEAR,
|
||||||
|
EASE_IN,
|
||||||
|
EASE_OUT,
|
||||||
|
EASE_IN_OUT,
|
||||||
|
|
||||||
|
TIMING_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
FadeJobConfig();
|
FadeJobConfig();
|
||||||
|
|
||||||
void setEditedCategory(int value);
|
void setEditedCategory(int value);
|
||||||
|
@ -87,8 +100,8 @@ public:
|
||||||
void setBaseLevel(float value);
|
void setBaseLevel(float value);
|
||||||
float getBaseLevel() const { return baseLevel[editedCategory]; }
|
float getBaseLevel() const { return baseLevel[editedCategory]; }
|
||||||
|
|
||||||
void setBaseInverted(bool value);
|
void setInverted(bool value);
|
||||||
bool isBaseInverted() const;
|
bool isInverted() const;
|
||||||
|
|
||||||
void setNoiseSizeX(float value);
|
void setNoiseSizeX(float value);
|
||||||
float getNoiseSizeX() const;
|
float getNoiseSizeX() const;
|
||||||
|
@ -102,6 +115,15 @@ public:
|
||||||
void setNoiseLevel(float value);
|
void setNoiseLevel(float value);
|
||||||
float getNoiseLevel() const { return noiseLevel[editedCategory]; }
|
float getNoiseLevel() const { return noiseLevel[editedCategory]; }
|
||||||
|
|
||||||
|
void setNoiseSpeedX(float value);
|
||||||
|
float getNoiseSpeedX() const;
|
||||||
|
|
||||||
|
void setNoiseSpeedY(float value);
|
||||||
|
float getNoiseSpeedY() const;
|
||||||
|
|
||||||
|
void setNoiseSpeedZ(float value);
|
||||||
|
float getNoiseSpeedZ() const;
|
||||||
|
|
||||||
void setEdgeWidth(float value);
|
void setEdgeWidth(float value);
|
||||||
float getEdgeWidth() const;
|
float getEdgeWidth() const;
|
||||||
|
|
||||||
|
@ -129,18 +151,23 @@ public:
|
||||||
void setEdgeOuterIntensity(float value);
|
void setEdgeOuterIntensity(float value);
|
||||||
float getEdgeOuterIntensity() const { return edgeOuterColor[editedCategory].a; }
|
float getEdgeOuterIntensity() const { return edgeOuterColor[editedCategory].a; }
|
||||||
|
|
||||||
|
void setTiming(int value);
|
||||||
|
int getTiming() const { return timing[editedCategory]; }
|
||||||
|
|
||||||
bool manualFade{ false };
|
bool manualFade{ false };
|
||||||
float manualThreshold{ 0.f };
|
float manualThreshold{ 0.f };
|
||||||
int editedCategory{ ELEMENT_ENTER_LEAVE_DOMAIN };
|
int editedCategory{ ELEMENT_ENTER_LEAVE_DOMAIN };
|
||||||
glm::vec3 noiseSize[EVENT_CATEGORY_COUNT];
|
glm::vec3 noiseSize[EVENT_CATEGORY_COUNT];
|
||||||
|
glm::vec3 noiseSpeed[EVENT_CATEGORY_COUNT];
|
||||||
float noiseLevel[EVENT_CATEGORY_COUNT];
|
float noiseLevel[EVENT_CATEGORY_COUNT];
|
||||||
glm::vec3 baseSize[EVENT_CATEGORY_COUNT];
|
glm::vec3 baseSize[EVENT_CATEGORY_COUNT];
|
||||||
float baseLevel[EVENT_CATEGORY_COUNT];
|
float baseLevel[EVENT_CATEGORY_COUNT];
|
||||||
bool baseInverted[EVENT_CATEGORY_COUNT];
|
bool _isInverted[EVENT_CATEGORY_COUNT];
|
||||||
float _duration[EVENT_CATEGORY_COUNT];
|
float _duration[EVENT_CATEGORY_COUNT];
|
||||||
float edgeWidth[EVENT_CATEGORY_COUNT];
|
float edgeWidth[EVENT_CATEGORY_COUNT];
|
||||||
glm::vec4 edgeInnerColor[EVENT_CATEGORY_COUNT];
|
glm::vec4 edgeInnerColor[EVENT_CATEGORY_COUNT];
|
||||||
glm::vec4 edgeOuterColor[EVENT_CATEGORY_COUNT];
|
glm::vec4 edgeOuterColor[EVENT_CATEGORY_COUNT];
|
||||||
|
int timing[EVENT_CATEGORY_COUNT];
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
|
@ -160,6 +187,8 @@ struct FadeCommonParameters
|
||||||
float _thresholdScale[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
float _thresholdScale[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
||||||
int _editedCategory{ FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN };
|
int _editedCategory{ FadeJobConfig::ELEMENT_ENTER_LEAVE_DOMAIN };
|
||||||
float _durations[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
float _durations[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
||||||
|
glm::vec3 _noiseSpeed[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
||||||
|
FadeJobConfig::Timing _timing[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
class FadeSwitchJob {
|
class FadeSwitchJob {
|
||||||
|
@ -200,7 +229,7 @@ struct FadeParameters
|
||||||
glm::vec4 _innerEdgeColor;
|
glm::vec4 _innerEdgeColor;
|
||||||
glm::vec4 _outerEdgeColor;
|
glm::vec4 _outerEdgeColor;
|
||||||
glm::vec2 _edgeWidthInvWidth;
|
glm::vec2 _edgeWidthInvWidth;
|
||||||
glm::int32 _invertBase;
|
glm::int32 _isInverted;
|
||||||
glm::float32 _padding;
|
glm::float32 _padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,15 +263,31 @@ private:
|
||||||
FadeParameters _configurations[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
FadeParameters _configurations[FadeJobConfig::EVENT_CATEGORY_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class FadeRenderJobConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float threshold MEMBER threshold NOTIFY dirty)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
float threshold{ 0.f };
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class FadeRenderJob {
|
class FadeRenderJob {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
using Config = FadeRenderJobConfig;
|
||||||
using Input = render::VaryingSet3<render::ItemBounds, LightingModelPointer, FadeConfigureJob::Output>;
|
using Input = render::VaryingSet3<render::ItemBounds, LightingModelPointer, FadeConfigureJob::Output>;
|
||||||
using JobModel = render::Job::ModelI<FadeRenderJob, Input>;
|
using JobModel = render::Job::ModelI<FadeRenderJob, Input, Config>;
|
||||||
|
|
||||||
FadeRenderJob(FadeCommonParameters::Pointer commonParams, render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber }, _parameters{ commonParams } {}
|
FadeRenderJob(FadeCommonParameters::Pointer commonParams, render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber }, _parameters{ commonParams } {}
|
||||||
|
|
||||||
|
void configure(const Config& config) {}
|
||||||
void run(const render::RenderContextPointer& renderContext, const Input& inputs);
|
void run(const render::RenderContextPointer& renderContext, const Input& inputs);
|
||||||
|
|
||||||
static void bindPerBatch(gpu::Batch& batch, int fadeMaskMapLocation, int fadeBufferLocation);
|
static void bindPerBatch(gpu::Batch& batch, int fadeMaskMapLocation, int fadeBufferLocation);
|
||||||
|
@ -263,7 +308,7 @@ private:
|
||||||
render::ShapePlumberPointer _shapePlumber;
|
render::ShapePlumberPointer _shapePlumber;
|
||||||
FadeCommonParameters::Pointer _parameters;
|
FadeCommonParameters::Pointer _parameters;
|
||||||
|
|
||||||
float computeElementEnterThreshold(double time, const double period) const;
|
float computeElementEnterThreshold(double time, const double period, FadeJobConfig::Timing timing) const;
|
||||||
|
|
||||||
// Everything needed for interactive edition
|
// Everything needed for interactive edition
|
||||||
uint64_t _editPreviousTime{ 0 };
|
uint64_t _editPreviousTime{ 0 };
|
||||||
|
|
|
@ -43,7 +43,7 @@ Item {
|
||||||
anchors.left: root.left
|
anchors.left: root.left
|
||||||
anchors.leftMargin: 200
|
anchors.leftMargin: 200
|
||||||
anchors.top: root.top
|
anchors.top: root.top
|
||||||
anchors.topMargin: 7
|
anchors.topMargin: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding {
|
Binding {
|
||||||
|
@ -57,7 +57,7 @@ Item {
|
||||||
Slider {
|
Slider {
|
||||||
id: sliderControl
|
id: sliderControl
|
||||||
stepSize: root.integral ? 1.0 : 0.0
|
stepSize: root.integral ? 1.0 : 0.0
|
||||||
width: 150
|
width: root.width-130
|
||||||
height: 20
|
height: 20
|
||||||
anchors.right: root.right
|
anchors.right: root.right
|
||||||
anchors.rightMargin: 8
|
anchors.rightMargin: 8
|
||||||
|
|
|
@ -14,8 +14,8 @@ var qml = Script.resolvePath('fade.qml');
|
||||||
var window = new OverlayWindow({
|
var window = new OverlayWindow({
|
||||||
title: 'Fade',
|
title: 'Fade',
|
||||||
source: qml,
|
source: qml,
|
||||||
width: 500,
|
width: 910,
|
||||||
height: 900,
|
height: 610,
|
||||||
});
|
});
|
||||||
window.setPosition(50, 50);
|
window.setPosition(50, 50);
|
||||||
window.closed.connect(function() { Script.stop(); });
|
window.closed.connect(function() { Script.stop(); });
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import "configSlider"
|
import "configSlider"
|
||||||
|
import "../lib/plotperf"
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
|
@ -47,6 +48,8 @@ Column {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: "Manual"
|
text: "Manual"
|
||||||
checked: root.config["manualFade"]
|
checked: root.config["manualFade"]
|
||||||
|
@ -72,18 +75,17 @@ Column {
|
||||||
Column {
|
Column {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
ConfigSlider {
|
CheckBox {
|
||||||
label: "Duration"
|
text: "Invert"
|
||||||
integral: false
|
checked: root.config["isInverted"]
|
||||||
config: root.config
|
onCheckedChanged: { root.config["isInverted"] = checked }
|
||||||
property: "duration"
|
|
||||||
max: 10.0
|
|
||||||
min: 0.1
|
|
||||||
width: 400
|
|
||||||
}
|
}
|
||||||
|
Row {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
GroupBox {
|
GroupBox {
|
||||||
title: "Base Gradient"
|
title: "Base Gradient"
|
||||||
width: 500
|
width: 450
|
||||||
Column {
|
Column {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
|
@ -123,16 +125,11 @@ Column {
|
||||||
min: 0.0
|
min: 0.0
|
||||||
width: 400
|
width: 400
|
||||||
}
|
}
|
||||||
CheckBox {
|
|
||||||
text: "Invert"
|
|
||||||
checked: root.config["baseInverted"]
|
|
||||||
onCheckedChanged: { root.config["baseInverted"] = checked }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupBox {
|
GroupBox {
|
||||||
title: "Noise Gradient"
|
title: "Noise Gradient"
|
||||||
width: 500
|
width: 450
|
||||||
Column {
|
Column {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
|
@ -174,9 +171,13 @@ Column {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Row {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
GroupBox {
|
GroupBox {
|
||||||
title: "Edge"
|
title: "Edge"
|
||||||
width: 500
|
width: 450
|
||||||
Column {
|
Column {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
|
@ -275,6 +276,83 @@ Column {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
title: "Timing"
|
||||||
|
width: 450
|
||||||
|
Column {
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
ConfigSlider {
|
||||||
|
label: "Duration"
|
||||||
|
integral: false
|
||||||
|
config: root.config
|
||||||
|
property: "duration"
|
||||||
|
max: 10.0
|
||||||
|
min: 0.1
|
||||||
|
width: 400
|
||||||
|
}
|
||||||
|
ComboBox {
|
||||||
|
width: 400
|
||||||
|
model: ["Linear", "Ease In", "Ease Out", "Ease In / Out"]
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
root.config["timing"] = currentIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GroupBox {
|
||||||
|
title: "Noise Animation"
|
||||||
|
Column {
|
||||||
|
spacing: 8
|
||||||
|
ConfigSlider {
|
||||||
|
label: "Speed X"
|
||||||
|
integral: false
|
||||||
|
config: root.config
|
||||||
|
property: "noiseSpeedX"
|
||||||
|
max: 1.0
|
||||||
|
min: -1.0
|
||||||
|
width: 400
|
||||||
|
}
|
||||||
|
ConfigSlider {
|
||||||
|
label: "Speed Y"
|
||||||
|
integral: false
|
||||||
|
config: root.config
|
||||||
|
property: "noiseSpeedY"
|
||||||
|
max: 1.0
|
||||||
|
min: -1.0
|
||||||
|
width: 400
|
||||||
|
}
|
||||||
|
ConfigSlider {
|
||||||
|
label: "Speed Z"
|
||||||
|
integral: false
|
||||||
|
config: root.config
|
||||||
|
property: "noiseSpeedZ"
|
||||||
|
max: 1.0
|
||||||
|
min: -1.0
|
||||||
|
width: 400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotPerf {
|
||||||
|
title: "Threshold"
|
||||||
|
height: parent.evalEvenHeight()
|
||||||
|
object: Render.getConfig("RenderMainView.DrawFadeOpaque")
|
||||||
|
valueUnit: "%"
|
||||||
|
valueScale: 0.01
|
||||||
|
valueNumDigits: "1"
|
||||||
|
plots: [
|
||||||
|
{
|
||||||
|
prop: "threshold",
|
||||||
|
label: "Threshold",
|
||||||
|
color: "#FFBB77"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue