Skip to content

Commit

Permalink
Merge pull request #24 from LionZXY/patch-1
Browse files Browse the repository at this point in the history
Change shader version from 130 to 120 to be compatible with MacOS
  • Loading branch information
Dream-Master authored Oct 22, 2022
2 parents cc2cccf + 4a58155 commit a1464ad
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/resources/assets/avaritia/shader/cosmic.frag
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 130
#version 120

#define M_PI 3.1415926535897932384626433832795

Expand All @@ -21,6 +21,10 @@ uniform mat2 cosmicuvs[cosmiccount];

varying vec3 position;

float rand2d(vec2 x) {
return fract(sin(mod(dot(x, vec2(12.9898, 78.233)), 3.14)) * 43758.5453);
}

mat4 rotationMatrix(vec3 axis, float angle)
{

Expand Down Expand Up @@ -73,9 +77,9 @@ void main (void)

// get semi-random stuff
int j = i + 7;
float rand1 = (j * j * 4321 + j * 8) * 2.0F;
float rand1 = (j * j * 4321 + j * 8) * 2.0;
int k = j + 1;
float rand2 = (k * k * k * 239 + k * 37) * 3.6F;
float rand2 = (k * k * k * 239 + k * 37) * 3.6;
float rand3 = rand1 * 347.4 + rand2 * 63.4;

// random rotation matrix by random rotation around random axis
Expand All @@ -101,8 +105,7 @@ void main (void)
int tv = int(mod(floor(v*uvtiles),uvtiles));

// get pseudorandom variants
int position = ((1777541 * tu) + (7649689 * tv) + (3612703 * (i+31)) + 1723609 ) ^ 50943779;
int symbol = int(mod(position, cosmicoutof));
int symbol = int(rand2d(vec2(tu, tv + i * 10.0)) * cosmicoutof);
int rotation = int(mod(pow(tu,float(tv)) + tu + 3 + tv*i, 8));
bool flip = false;
if (rotation >= 4) {
Expand Down Expand Up @@ -175,4 +178,4 @@ void main (void)
col = clamp(col,0.0,1.0);

gl_FragColor = col;
}
}

0 comments on commit a1464ad

Please sign in to comment.