change some pngs and remove unused shaders

This commit is contained in:
RCXcrafter committed 2016-11-03 15:14:47 +01:00
1 parent 599d2e47c8
commit 7ec5a34f5f
6 files changed
-402

No files matched your search

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 46 KiB

@@ -1,178 +0,0 @@
#version 130
#define M_PI 3.1415926535897932384626433832795
const int cosmiccount = 10;
const int cosmicoutof = 101;
uniform sampler2D texture0;
uniform vec3 lightlevel;
uniform int time;
uniform float yaw;
uniform float pitch;
uniform float externalScale;
uniform float lightmix;
uniform float opacity;
uniform mat2 cosmicuvs[cosmiccount];
varying vec3 position;
mat4 rotationMatrix(vec3 axis, float angle)
{
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
}
void main (void)
{
vec4 light = gl_Color;
vec4 mask = texture2D(texture0, gl_TexCoord[0].xy);
light.rgb *= lightlevel;
float oneOverExternalScale = 1.0/externalScale;
int uvtiles = 16;
// background colour
vec4 col = vec4(0.1,0.0,0.0,1.0);
float pulse = mod(time,400)/400.0;
col.g = sin(pulse*M_PI*2) * 0.075 + 0.225;
col.b = cos(pulse*M_PI*2) * 0.05 + 0.3;
// get ray from camera to fragment
vec4 dir = normalize(vec4( -position, 0));
// rotate the ray to show the right bit of the sphere for the angle
float sb = sin(pitch);
float cb = cos(pitch);
dir = normalize(vec4(dir.x, dir.y * cb - dir.z * sb, dir.y * sb + dir.z * cb, 0));
float sa = sin(-yaw);
float ca = cos(-yaw);
dir = normalize(vec4(dir.z * sa + dir.x * ca, dir.y, dir.z * ca - dir.x * sa, 0));
vec4 ray;
// draw the layers
for (int i=0; i<16; i++) {
int mult = 16-i;
// get semi-random stuff
int j = i + 7;
float rand1 = (j * j * 4321 + j * 8) * 2.0F;
int k = j + 1;
float rand2 = (k * k * k * 239 + k * 37) * 3.6F;
float rand3 = rand1 * 347.4 + rand2 * 63.4;
// random rotation matrix by random rotation around random axis
vec3 axis = normalize(vec3(sin(rand1), sin(rand2) , cos(rand3)));
// apply
ray = dir * rotationMatrix(axis, mod(rand3, 2*M_PI));
// calcuate the UVs from the final ray
float rawu = 0.5 + (atan(ray.z,ray.x)/(2*M_PI));
float rawv = 0.5 + (asin(ray.y)/M_PI);
// get UV scaled for layers and offset by time;
float scale = mult*0.5 + 2.75;
float u = rawu * scale * externalScale;
//float v = (rawv + time * 0.00006) * scale * 0.6;
float v = (rawv + time * 0.0002 * oneOverExternalScale) * scale * 0.6 * externalScale;
vec2 tex = vec2( u, v );
// tile position of the current uv
int tu = int(mod(floor(u*uvtiles),uvtiles));
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 rotation = int(mod(pow(tu,float(tv)) + tu + 3 + tv*i, 8));
bool flip = false;
if (rotation >= 4) {
rotation -= 4;
flip = true;
}
// if it's an icon, then add the colour!
if (symbol >= 0 && symbol < cosmiccount) {
vec2 cosmictex = vec2(1.0,1.0);
vec4 tcol = vec4(1.0,0.0,0.0,1.0);
// get uv within the tile
float ru = clamp(mod(u,1.0)*uvtiles - tu, 0.0, 1.0);
float rv = clamp(mod(v,1.0)*uvtiles - tv, 0.0, 1.0);
if (flip) {
ru = 1.0 - ru;
}
float oru = ru;
float orv = rv;
// rotate uvs if necessary
if (rotation == 1) {
oru = 1.0-rv;
orv = ru;
} else if (rotation == 2) {
oru = 1.0-ru;
orv = 1.0-rv;
} else if (rotation == 3) {
oru = rv;
orv = 1.0-ru;
}
// get the iicon uvs for the tile
float umin = cosmicuvs[symbol][0][0];
float umax = cosmicuvs[symbol][1][0];
float vmin = cosmicuvs[symbol][0][1];
float vmax = cosmicuvs[symbol][1][1];
// interpolate based on tile uvs
cosmictex.x = umin * (1.0-oru) + umax * oru;
cosmictex.y = vmin * (1.0-orv) + vmax * orv;
tcol = texture2D(texture0, cosmictex);
// set the alpha, blending out at the bunched ends
float a = tcol.r * (0.5 + (1.0/mult) * 1.0) * (1.0-smoothstep(0.15, 0.48, abs(rawv-0.5)));
// get fancy colours
float r = (mod(rand1, 29.0)/29.0) * 0.3 + 0.4;
float g = (mod(rand2, 35.0)/35.0) * 0.4 + 0.6;
float b = (mod(rand1, 17.0)/17.0) * 0.3 + 0.7;
// mix the colours
//col = col*(1-a) + vec4(r,g,b,1)*a;
col = col + vec4(r,g,b,1)*a;
}
}
// apply lighting
vec3 shade = light.rgb * (lightmix) + vec3(1.0-lightmix,1.0-lightmix,1.0-lightmix);
col.rgb *= shade;
// apply mask
col.a *= mask.r * opacity;
col = clamp(col,0.0,1.0);
gl_FragColor = col;
}
@@ -1,224 +0,0 @@
#version 120
vec4 Ambient;
vec4 Diffuse;
vec4 Specular;
attribute float activelights;
varying vec3 position;
void pointLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
float attenuation; // computed attenuation factor
float d; // distance from surface to light source
vec3 VP; // direction from surface to light position
vec3 halfVector; // direction of maximum highlights
// Compute vector from surface to light position
VP = vec3 (gl_LightSource[i].position) - ecPosition3;
// Compute distance between surface and light position
d = length(VP);
// Normalize the vector from surface to light position
VP = normalize(VP);
// Compute attenuation
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation +
gl_LightSource[i].linearAttenuation * d +
gl_LightSource[i].quadraticAttenuation * d * d);
halfVector = normalize(VP + eye);
nDotVP = max(0.0, dot(normal, VP));
//nDotHV = max(0.0, dot(normal, halfVector));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//}
Ambient += gl_LightSource[i].ambient * attenuation;
Diffuse += gl_LightSource[i].diffuse * nDotVP * attenuation;
//Specular += gl_LightSource[i].specular * pf * attenuation;
}
void spotLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
float spotDot; // cosine of angle between spotlight
float spotAttenuation; // spotlight attenuation factor
float attenuation; // computed attenuation factor
float d; // distance from surface to light source
vec3 VP; // direction from surface to light position
vec3 halfVector; // direction of maximum highlights
// Compute vector from surface to light position
VP = vec3 (gl_LightSource[i].position) - ecPosition3;
// Compute distance between surface and light position
d = length(VP);
// Normalize the vector from surface to light position
VP = normalize(VP);
// Compute attenuation
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation +
gl_LightSource[i].linearAttenuation * d +
gl_LightSource[i].quadraticAttenuation * d * d);
// See if point on surface is inside cone of illumination
spotDot = dot(-VP, normalize(gl_LightSource[i].spotDirection));
if (spotDot < gl_LightSource[i].spotCosCutoff)
{
spotAttenuation = 0.0; // light adds no contribution
}
else
{
spotAttenuation = pow(spotDot, gl_LightSource[i].spotExponent);
}
// Combine the spotlight and distance attenuation.
attenuation *= spotAttenuation;
halfVector = normalize(VP + eye);
nDotVP = max(0.0, dot(normal, VP));
//nDotHV = max(0.0, dot(normal, halfVector));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//
// }
Ambient += gl_LightSource[i].ambient * attenuation;
Diffuse += gl_LightSource[i].diffuse * nDotVP * attenuation;
//Specular += gl_LightSource[i].specular * pf * attenuation;
}
void directionalLight(in int i, in vec3 normal)
{
float nDotVP; // normal . light direction
float nDotHV; // normal . light half vector
float pf; // power factor
nDotVP = max(0.0, dot(normal, normalize(vec3 (gl_LightSource[i].position))));
//nDotHV = max(0.0, dot(normal, vec3 (gl_LightSource[i].halfVector)));
//if (nDotVP == 0.0)
//{
pf = 0.0;
//}
//else
//{
// pf = pow(nDotHV, gl_FrontMaterial.shininess);
//}
Ambient += gl_LightSource[i].ambient;
Diffuse += gl_LightSource[i].diffuse * nDotVP;
//Specular += gl_LightSource[i].specular * pf;
}
vec3 fnormal(void)
{
//Compute the normal
vec3 normal = gl_NormalMatrix * gl_Normal;
normal = normalize(normal);
return normal;
}
void ProcessLight(in int i, in vec3 normal, in vec3 eye, in vec3 ecPosition3)
{
if (gl_LightSource[i].spotCutoff==180.0)
{
if (gl_LightSource[i].position.w==0.0)
{
directionalLight(i, normal);
}
else
{
pointLight(i, normal, eye, ecPosition3);
}
}
else
{
spotLight(i,normal,eye,ecPosition3);
}
}
void flight(in vec3 normal, in vec4 ecPosition, float alphaFade)
{
vec4 color;
vec3 ecPosition3;
vec3 eye;
int i;
ecPosition3 = (vec3 (ecPosition)) / ecPosition.w;
eye = vec3 (0.0, 0.0, 1.0);
// Clear the light intensity accumulators
Ambient = vec4 (0.0);
Diffuse = vec4 (0.0);
Specular = vec4 (0.0);
if (activelights>0)
{
ProcessLight(0,normal,eye,ecPosition3);
}
if (activelights>1)
{
ProcessLight(1,normal,eye,ecPosition3);
}
//if (activelights>2)
//{
// ProcessLight(2,normal,eye,ecPosition3);
//}
//if (activelights>3)
//{
// ProcessLight(3,normal,eye,ecPosition3);
//}
color = gl_FrontLightModelProduct.sceneColor +
Ambient * gl_FrontMaterial.ambient +
Diffuse * gl_FrontMaterial.diffuse;
color += Specular * gl_FrontMaterial.specular;
color = clamp( color, 0.0, 1.0 );
gl_FrontColor = color;
gl_FrontColor.a *= alphaFade;
}
void main (void)
{
vec3 transformedNormal;
float alphaFade = 1.0;
// Eye-coordinate position of vertex, needed in various calculations
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
// Do fixed functionality vertex transform
gl_Position = ftransform();
transformedNormal = fnormal();
flight(transformedNormal, ecPosition, alphaFade);
//Enable texture coordinates
gl_TexCoord[0] = gl_MultiTexCoord0;
//gl_TexCoord[1] = gl_MultiTexCoord1;
//gl_TexCoord[2] = gl_MultiTexCoord2;
//gl_TexCoord[3] = gl_MultiTexCoord3;
position = (gl_ModelViewMatrix * gl_Vertex).xyz;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB