using clang-format-16
and a bit more comments and a minor adjustment
This commit is contained in:
@@ -367,6 +367,7 @@ vec4 getStars(vec2 starUV, float aspect, float progress, float oColorAlpha)
|
||||
//each star in each ring
|
||||
for (float s = 0.0; s < uStarCount; ++s)
|
||||
{
|
||||
//this returns a Star
|
||||
float a5ps = getStar(
|
||||
starUV,
|
||||
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
|
||||
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)
|
||||
{
|
||||
result = alphaOver(result,getStarColor(y,a5ps));
|
||||
|
||||
@@ -45,8 +45,6 @@ float FadeInOut(float t, float power)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// Calculate the progression value based on the animation direction.
|
||||
@@ -64,27 +62,29 @@ void main() {
|
||||
// w is the wave
|
||||
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);
|
||||
w = 1.0 - abs(p - f.y);
|
||||
w = clamp(w,0.0,1.0);
|
||||
|
||||
w = pow(w, mix(100.0,1.0,uWavesize) );
|
||||
|
||||
float mask = 1.0;
|
||||
if (p - f.y < 0.0)
|
||||
{
|
||||
mask = 0.0;
|
||||
w = 0.0;
|
||||
}
|
||||
|
||||
//starting output color
|
||||
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.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));
|
||||
|
||||
//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);
|
||||
|
||||
@@ -31,15 +31,15 @@
|
||||
// void setOutputColor(vec4 outColor)
|
||||
|
||||
// The width of the fading effect is loaded from the settings.
|
||||
// uniform float uFadeWidth;
|
||||
|
||||
uniform float uWT;
|
||||
uniform float uXpos;
|
||||
uniform float uYpos;
|
||||
uniform float uSparkleRot;
|
||||
uniform float uSparkleSize;
|
||||
uniform bool uWinRot;
|
||||
uniform vec2 uSeed;
|
||||
//variables
|
||||
uniform float uWT; //window time ... how we split the time between the window and the sparkle/star
|
||||
uniform float uXpos; // the Xposition of the star
|
||||
uniform float uYpos; // the Yposition of the star
|
||||
uniform float uSparkleRot; //the rotation of the star
|
||||
uniform float uSparkleSize; // the size of the star
|
||||
uniform bool uWinRot; //window rotation... but it's more of a warp
|
||||
uniform vec2 uSeed; // and random numbers
|
||||
|
||||
//use to scale the window
|
||||
vec2 scaleUV(vec2 uv, vec2 scale, vec2 centerOffset)
|
||||
@@ -54,7 +54,6 @@ vec2 scaleUV(vec2 uv, vec2 scale, vec2 centerOffset)
|
||||
// scale from center
|
||||
uv = uv * 0.5 + 0.5;
|
||||
|
||||
|
||||
return uv;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,15 +32,16 @@
|
||||
|
||||
// The width of the fading effect is loaded from the settings.
|
||||
|
||||
uniform float uSparkCount;
|
||||
uniform vec2 uSparkStartEnd;
|
||||
uniform float uSparkOffset;
|
||||
uniform float uStarCount;
|
||||
uniform float uStarRot;
|
||||
uniform float uStarSize;
|
||||
uniform vec2 uStarStartEnd;
|
||||
uniform float uBlurQuality;
|
||||
uniform float uSeed;
|
||||
//variables
|
||||
uniform float uSparkCount; //number of sparkles
|
||||
uniform vec2 uSparkStartEnd; // the start and end of the sparkles
|
||||
uniform float uSparkOffset; //how much the sparkles can be offset
|
||||
uniform float uStarCount; //number of Stars
|
||||
uniform float uStarRot; // how much the stars rotate
|
||||
uniform float uStarSize; // the size of the stars
|
||||
uniform vec2 uStarStartEnd; //start and end of the star's movement
|
||||
uniform float uBlurQuality; // blurquality for the window
|
||||
uniform float uSeed; // a random number
|
||||
|
||||
|
||||
//particle colors
|
||||
@@ -517,5 +518,6 @@ void main() {
|
||||
oColor = alphaOver(oColor, getStars(mix(0.0001,0.999,ioSine)));
|
||||
}
|
||||
|
||||
//output
|
||||
setOutputColor(oColor);
|
||||
}
|
||||
+1
-1
@@ -59,7 +59,7 @@ export var Shader = GObject.registerClass({
|
||||
'end-animation': {}
|
||||
}
|
||||
},
|
||||
class Shader extends Shell.GLSLEffect{
|
||||
class Shader extends Shell.GLSLEffect {
|
||||
// --------------------------------------------
|
||||
// The constructor automagically loads the shader's source code (in
|
||||
// vfunc_build_pipeline()) from the resource file resources/shaders/<nick>.glsl
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class ShaderFactory {
|
||||
// Only try to register the new type once.
|
||||
if (GObject.type_from_name(typeName) == null) {
|
||||
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.
|
||||
_init() {
|
||||
super._init(outerThis._nick);
|
||||
|
||||
Reference in New Issue
Block a user