Open source Star Ruler 2 source code!
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
attribute vec4 in_position;
|
||||
attribute vec3 in_normal;
|
||||
attribute vec2 in_uv;
|
||||
|
||||
varying vec3 npos;
|
||||
varying vec3 normal, binormal, tangent;
|
||||
varying vec2 uv;
|
||||
|
||||
uniform float flipState;
|
||||
|
||||
void main()
|
||||
{
|
||||
normal = normalize(gl_NormalMatrix * in_normal);
|
||||
binormal = normalize(cross(normal, gl_NormalMatrix * vec3(0.0,0.999,0.04471017781)));
|
||||
tangent = normalize(cross(normal, binormal));
|
||||
|
||||
vec4 pos = gl_ModelViewMatrix * in_position;
|
||||
npos = -pos.xyz;
|
||||
|
||||
vec2 baseUV = in_uv;
|
||||
if(flipState < 0.5) {
|
||||
if(flipState < 0.25) {
|
||||
baseUV.x = 1.0 - baseUV.x;
|
||||
binormal = -binormal;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(flipState < 0.75) {
|
||||
baseUV.y = 1.0 - baseUV.y;
|
||||
tangent = -tangent;
|
||||
}
|
||||
else {
|
||||
baseUV = vec2(1.0) - baseUV;
|
||||
binormal = -binormal;
|
||||
tangent = -tangent;
|
||||
}
|
||||
}
|
||||
uv = baseUV;
|
||||
gl_Position = gl_ProjectionMatrix * pos;
|
||||
}
|
||||
Reference in New Issue
Block a user