using clang-format-16

and a bit more comments
and a minor adjustment
This commit is contained in:
Justin Garza
2025-01-21 19:46:15 -05:00
parent 29978ea87f
commit e90353b0c5
6 changed files with 35 additions and 31 deletions
+3
View File
@@ -367,6 +367,7 @@ vec4 getStars(vec2 starUV, float aspect, float progress, float oColorAlpha)
//each star in each ring //each star in each ring
for (float s = 0.0; s < uStarCount; ++s) for (float s = 0.0; s < uStarCount; ++s)
{ {
//this returns a Star
float a5ps = getStar( float a5ps = getStar(
starUV, starUV,
vec2( sin(progress * uRingRotation * 6.28 + (s*(6.28/uStarCount))) * aspect * 0.33 , y), //position (x, y) vec2( sin(progress * uRingRotation * 6.28 + (s*(6.28/uStarCount))) * aspect * 0.33 , y), //position (x, y)
@@ -379,6 +380,8 @@ vec4 getStars(vec2 starUV, float aspect, float progress, float oColorAlpha)
// //put the star in back or the front of the window // //put the star in back or the front of the window
float depth = cos(progress * uRingRotation * 6.28 + (s*(6.28/uStarCount)) ); float depth = cos(progress * uRingRotation * 6.28 + (s*(6.28/uStarCount)) );
//if we want the star behind or infront of the window
if (depth < 0.0) if (depth < 0.0)
{ {
result = alphaOver(result,getStarColor(y,a5ps)); result = alphaOver(result,getStarColor(y,a5ps));
+11 -11
View File
@@ -45,8 +45,6 @@ float FadeInOut(float t, float power)
} }
void main() { void main() {
// Calculate the progression value based on the animation direction. // Calculate the progression value based on the animation direction.
@@ -64,27 +62,29 @@ void main() {
// w is the wave // w is the wave
float w = 0.0; float w = 0.0;
//w will be used to calculate the the size of the wave
float p = mix(0.0, 1.0 + uWavesize, progress); float p = mix(0.0, 1.0 + uWavesize, progress);
w = 1.0 - abs(p - f.y); w = 1.0 - abs(p - f.y);
w = clamp(w,0.0,1.0); w = clamp(w,0.0,1.0);
w = pow(w, mix(100.0,1.0,uWavesize) ); w = pow(w, mix(100.0,1.0,uWavesize) );
float mask = 1.0; //starting output color
if (p - f.y < 0.0)
{
mask = 0.0;
w = 0.0;
}
vec4 oColor = vec4(0.0); vec4 oColor = vec4(0.0);
// outputs for RGB is based on the color of the window, times uStreatch(RG and B), and another multipler for the brightness
oColor.r = getInputColor(uv + vec2(0.0,w * uStretchR ) ).r * mix(1.0, uBrightness, FadeInOut(progress,4)); oColor.r = getInputColor(uv + vec2(0.0,w * uStretchR ) ).r * mix(1.0, uBrightness, FadeInOut(progress,4));
oColor.g = getInputColor(uv + vec2(0.0,w * uStretchG ) ).g * mix(1.0, uBrightness, FadeInOut(progress,4)); oColor.g = getInputColor(uv + vec2(0.0,w * uStretchG ) ).g * mix(1.0, uBrightness, FadeInOut(progress,4));
oColor.b = getInputColor(uv + vec2(0.0,w * uStretchB ) ).b * mix(1.0, uBrightness, FadeInOut(progress,4)); oColor.b = getInputColor(uv + vec2(0.0,w * uStretchB ) ).b * mix(1.0, uBrightness, FadeInOut(progress,4));
//if you can think of a better way to handle the alpha ... try that //if you can think of a better way to handle the alpha ... try that
oColor.a = getInputColor(uv).a * easeInOutSine(progress) * mask; if (oColor.r + oColor.g + oColor.b > 0.0)
{
oColor.a = getInputColor(uv).a ;
}
else
{
oColor.a = 0.0;
}
setOutputColor(oColor); setOutputColor(oColor);
+8 -9
View File
@@ -31,15 +31,15 @@
// void setOutputColor(vec4 outColor) // void setOutputColor(vec4 outColor)
// The width of the fading effect is loaded from the settings. // The width of the fading effect is loaded from the settings.
// uniform float uFadeWidth;
uniform float uWT; //variables
uniform float uXpos; uniform float uWT; //window time ... how we split the time between the window and the sparkle/star
uniform float uYpos; uniform float uXpos; // the Xposition of the star
uniform float uSparkleRot; uniform float uYpos; // the Yposition of the star
uniform float uSparkleSize; uniform float uSparkleRot; //the rotation of the star
uniform bool uWinRot; uniform float uSparkleSize; // the size of the star
uniform vec2 uSeed; uniform bool uWinRot; //window rotation... but it's more of a warp
uniform vec2 uSeed; // and random numbers
//use to scale the window //use to scale the window
vec2 scaleUV(vec2 uv, vec2 scale, vec2 centerOffset) vec2 scaleUV(vec2 uv, vec2 scale, vec2 centerOffset)
@@ -54,7 +54,6 @@ vec2 scaleUV(vec2 uv, vec2 scale, vec2 centerOffset)
// scale from center // scale from center
uv = uv * 0.5 + 0.5; uv = uv * 0.5 + 0.5;
return uv; return uv;
} }
+11 -9
View File
@@ -32,15 +32,16 @@
// The width of the fading effect is loaded from the settings. // The width of the fading effect is loaded from the settings.
uniform float uSparkCount; //variables
uniform vec2 uSparkStartEnd; uniform float uSparkCount; //number of sparkles
uniform float uSparkOffset; uniform vec2 uSparkStartEnd; // the start and end of the sparkles
uniform float uStarCount; uniform float uSparkOffset; //how much the sparkles can be offset
uniform float uStarRot; uniform float uStarCount; //number of Stars
uniform float uStarSize; uniform float uStarRot; // how much the stars rotate
uniform vec2 uStarStartEnd; uniform float uStarSize; // the size of the stars
uniform float uBlurQuality; uniform vec2 uStarStartEnd; //start and end of the star's movement
uniform float uSeed; uniform float uBlurQuality; // blurquality for the window
uniform float uSeed; // a random number
//particle colors //particle colors
@@ -517,5 +518,6 @@ void main() {
oColor = alphaOver(oColor, getStars(mix(0.0001,0.999,ioSine))); oColor = alphaOver(oColor, getStars(mix(0.0001,0.999,ioSine)));
} }
//output
setOutputColor(oColor); setOutputColor(oColor);
} }
+1 -1
View File
@@ -59,7 +59,7 @@ export var Shader = GObject.registerClass({
'end-animation': {} 'end-animation': {}
} }
}, },
class Shader extends Shell.GLSLEffect{ class Shader extends Shell.GLSLEffect {
// -------------------------------------------- // --------------------------------------------
// The constructor automagically loads the shader's source code (in // The constructor automagically loads the shader's source code (in
// vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl // vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl
+1 -1
View File
@@ -61,7 +61,7 @@ export default class ShaderFactory {
// Only try to register the new type once. // Only try to register the new type once.
if (GObject.type_from_name(typeName) == null) { if (GObject.type_from_name(typeName) == null) {
const outerThis = this; const outerThis = this;
GObject.registerClass({GTypeName: typeName}, class ShaderImp extends Shader{ GObject.registerClass({GTypeName: typeName}, class ShaderImp extends Shader {
// This will actually load the GLSL source code from the resources. // This will actually load the GLSL source code from the resources.
_init() { _init() {
super._init(outerThis._nick); super._init(outerThis._nick);