Increasing "tracer" brightness envelope. Renaming fade to brightnessThreshold

This commit is contained in:
Rezmason
2019-02-21 07:26:58 -08:00
parent 020c44c301
commit c154a2f30f
2 changed files with 12 additions and 12 deletions

View File

@@ -48,7 +48,7 @@
}, },
cycleSpeed: 0.05, cycleSpeed: 0.05,
cycleStyle: "cycleFasterWhenDimmed", cycleStyle: "cycleFasterWhenDimmed",
fade: true, brightnessThreshold: 0,
fallSpeed: 0.05, fallSpeed: 0.05,
font: fonts.coptic, font: fonts.coptic,
glyphEdgeCrop: 0.0, glyphEdgeCrop: 0.0,
@@ -75,7 +75,7 @@
}, },
cycleSpeed: 0.02, cycleSpeed: 0.02,
cycleStyle: "cycleFasterWhenDimmed", cycleStyle: "cycleFasterWhenDimmed",
fade: true, brightnessThreshold: 0,
fallSpeed: 2.0, fallSpeed: 2.0,
font: fonts.gothic, font: fonts.gothic,
glyphEdgeCrop: 0.0, glyphEdgeCrop: 0.0,
@@ -102,7 +102,7 @@
}, },
cycleSpeed: 1, cycleSpeed: 1,
cycleStyle: "cycleFasterWhenDimmed", cycleStyle: "cycleFasterWhenDimmed",
fade: true, brightnessThreshold: 0,
fallSpeed: 1, fallSpeed: 1,
font: fonts.matrixcode, font: fonts.matrixcode,
glyphEdgeCrop: 0.0, glyphEdgeCrop: 0.0,
@@ -141,7 +141,7 @@
}, },
cycleSpeed: 0.4, cycleSpeed: 0.4,
cycleStyle: "cycleRandomly", cycleStyle: "cycleRandomly",
fade: false, brightnessThreshold: 0.6375,
fallSpeed: 0.6, fallSpeed: 0.6,
font: fonts.matrixcode, font: fonts.matrixcode,
glyphEdgeCrop: 0.15, glyphEdgeCrop: 0.15,
@@ -185,7 +185,7 @@
const slant = parseFloat(getParam(["slant", "angle"], version.slant)) * Math.PI / 180; const slant = parseFloat(getParam(["slant", "angle"], version.slant)) * Math.PI / 180;
const glyphEdgeCrop = parseFloat(getParam("encroach", version.glyphEdgeCrop)); const glyphEdgeCrop = parseFloat(getParam("encroach", version.glyphEdgeCrop));
const glyphHeightToWidth = parseFloat(getParam("stretch", version.glyphHeightToWidth)); const glyphHeightToWidth = parseFloat(getParam("stretch", version.glyphHeightToWidth));
const fade = getParam("fade", version.fade).toString() == "true"; const brightnessThreshold = getParam("brightnessThreshold", version.brightnessThreshold);
const effect = getParam("effect", "plain"); const effect = getParam("effect", "plain");
@@ -204,7 +204,7 @@
const matrixRenderer = makeMatrixRenderer(renderer, { const matrixRenderer = makeMatrixRenderer(renderer, {
animationSpeed, fallSpeed, cycleSpeed, animationSpeed, fallSpeed, cycleSpeed,
cycleStyle: version.cycleStyle, cycleStyle: version.cycleStyle,
fade, brightnessThreshold,
fontTexture, fontTexture,
glyphSequenceLength: version.font.sequenceLength, glyphSequenceLength: version.font.sequenceLength,
glyphEdgeCrop, glyphEdgeCrop,

View File

@@ -11,7 +11,7 @@ const makeMatrixRenderer = (renderer, {
slant, slant,
glyphHeightToWidth, glyphHeightToWidth,
glyphEdgeCrop, glyphEdgeCrop,
fade, brightnessThreshold,
showComputationTexture, showComputationTexture,
raindropLength, raindropLength,
cycleStyle cycleStyle
@@ -131,7 +131,7 @@ const glyphVariable = gpuCompute.addVariable(
); );
gpuCompute.setVariableDependencies( glyphVariable, [ glyphVariable ] ); gpuCompute.setVariableDependencies( glyphVariable, [ glyphVariable ] );
const brightnessChangeBias = fade ? (animationSpeed * fallSpeed) == 0 ? 1 : Math.min(1, Math.abs(animationSpeed * fallSpeed)) : 1; const brightnessChangeBias = (brightnessThreshold <= 0) ? (animationSpeed * fallSpeed) == 0 ? 1 : Math.min(1, Math.abs(animationSpeed * fallSpeed)) : 1;
Object.assign(glyphVariable.material.uniforms, { Object.assign(glyphVariable.material.uniforms, {
time: { type: "f", value: 0 }, time: { type: "f", value: 0 },
deltaTime: { type: "f", value: 0.01 }, deltaTime: { type: "f", value: 0.01 },
@@ -244,9 +244,9 @@ const glyphVariable = gpuCompute.addVariable(
// Unpack the values from the font texture // Unpack the values from the font texture
float brightness = glyph.r; float brightness = glyph.r;
#ifndef fade #ifdef brightnessThreshold
if (brightness < -1.0) { discard; return; } if (brightness < -1.0) { discard; return; }
if (brightness > 0.65) { if (brightness > brightnessThreshold) {
brightness *= 2.0; brightness *= 2.0;
} else { } else {
brightness = 0.25; brightness = 0.25;
@@ -283,8 +283,8 @@ const glyphVariable = gpuCompute.addVariable(
mesh.material.defines.isPolar = 1.0; mesh.material.defines.isPolar = 1.0;
} }
if (fade) { if (brightnessThreshold > 0) {
mesh.material.defines.fade = 1.0; mesh.material.defines.brightnessThreshold = brightnessThreshold;
} }
if (showComputationTexture) { if (showComputationTexture) {