mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
Smoother ease in / out functions
This commit is contained in:
parent
7d851c1cbd
commit
98d915cf0f
2 changed files with 11 additions and 8 deletions
|
@ -45,7 +45,8 @@ vec2 hash2D(vec3 position) {
|
|||
}
|
||||
|
||||
float noise3D(vec3 position) {
|
||||
return textureLod(fadeMaskMap, hash2D(position), 0).r;
|
||||
float n = textureLod(fadeMaskMap, hash2D(position), 0).r;
|
||||
return pow(n, 1.0/2.2); // Need to fix this later directly in the texture
|
||||
}
|
||||
|
||||
float evalFadeNoiseGradient(vec3 position) {
|
||||
|
@ -87,8 +88,6 @@ float evalFadeGradient(vec3 position) {
|
|||
}
|
||||
|
||||
float evalFadeAlpha(vec3 position) {
|
||||
//float edgeWidth = fadeParameters[fadeCategory]._edgeWidthInvWidth.x;
|
||||
//float cutoff = mix(-edgeWidth, 1.0+edgeWidth, fadeThreshold);
|
||||
float cutoff = fadeThreshold;
|
||||
|
||||
return evalFadeGradient(position)-cutoff;
|
||||
|
|
|
@ -385,7 +385,7 @@ void FadeConfigureJob::configure(const Config& config) {
|
|||
configuration._edgeWidthInvWidth.y = 1.f / configuration._edgeWidthInvWidth.x;
|
||||
configuration._innerEdgeColor = config.edgeInnerColor[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 + (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];
|
||||
}
|
||||
|
@ -495,14 +495,14 @@ float FadeRenderJob::computeElementEnterThreshold(double time, const double peri
|
|||
fadeAlpha = fraction;
|
||||
break;
|
||||
case FadeJobConfig::EASE_IN:
|
||||
fadeAlpha = fraction*fraction;
|
||||
fadeAlpha = fraction*fraction*fraction;
|
||||
break;
|
||||
case FadeJobConfig::EASE_OUT:
|
||||
fadeAlpha = 1.f - fraction;
|
||||
fadeAlpha = 1.f- fadeAlpha*fadeAlpha;
|
||||
fadeAlpha = 1.f- fadeAlpha*fadeAlpha*fadeAlpha;
|
||||
break;
|
||||
case FadeJobConfig::EASE_IN_OUT:
|
||||
fadeAlpha = fraction*fraction*(3 - 2 * fraction);
|
||||
fadeAlpha = fraction*fraction*fraction*(fraction*(fraction * 6 - 15) + 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +552,11 @@ void FadeRenderJob::updateFadeEdit(const render::RenderContextPointer& renderCon
|
|||
}
|
||||
}
|
||||
|
||||
renderContext->jobConfig->setProperty("threshold", _editThreshold);
|
||||
float threshold = _editThreshold;
|
||||
if (editedCategory != FadeJobConfig::BUBBLE_ISECT_OWNER) {
|
||||
threshold = (threshold - 0.5f)*_parameters->_thresholdScale[editedCategory] + 0.5f;
|
||||
}
|
||||
renderContext->jobConfig->setProperty("threshold", threshold);
|
||||
|
||||
_editNoiseOffset = _parameters->_noiseSpeed[editedCategory] * (float)_editTime;
|
||||
|
||||
|
|
Loading…
Reference in a new issue