Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created July 17, 2015 04:49
Show Gist options
  • Save LordNed/bb078e927ff57cf8735d to your computer and use it in GitHub Desktop.
Save LordNed/bb078e927ff57cf8735d to your computer and use it in GitHub Desktop.
#version 330 core
in vec3 Position;
in vec4 Color0;
in vec3 Tex0;
// Final Output
out vec4 PixelColor;
uniform sampler2D Texture0;
void main()
{
// Initial TEV Register Values
vec4 result = vec4(0, 0, 0, 1);
vec4 color0 = vec4(1, 1, 1, 1);
vec4 color1 = vec4(1, 1, 1, 1);
vec4 color2 = vec4(0, 0, 0, 0);
// Konst TEV Colors
vec4 konst0 = vec4(1, 1, 1, 1);
vec4 konst1 = vec4(1, 1, 1, 1);
vec4 konst2 = vec4(1, 1, 1, 1);
vec4 konst3 = vec4(1, 1, 1, 1);
vec4 texCol0 = texture(Texture0, Tex0.xy);
// TEV Stages
// TEV Stage 0
// Rasterization Swap Table: [0, 1, 2, 3]
// Texture Swap Table: [0, 1, 2, 3]
// Color and Alpha Operations
result.rgb = (0.0f.rrr + mix(color0.rgb, konst0.rgba.rgb, Color0.rgba.rgb));
result.rgb = clamp(result.rgb,0.0,1.0);
result.a = (0.0f + mix(0.0f, 0.0f, 0.0f));
result.a = clamp(result.a,0.0,1.0);
// TEV Stage 1
// Rasterization Swap Table: [0, 1, 2, 3]
// Texture Swap Table: [0, 1, 2, 3]
// Color and Alpha Operations
result.rgb = (0.0f.rrr + mix(0.0f.rrr, result.rgb, texCol0.rgb));
result.rgb = clamp(result.rgb,0.0,1.0);
result.a = (0.0f + mix(0.0f, 0.0f, 0.0f));
result.a = clamp(result.a,0.0,1.0);
// Alpha Compare Test
// Alpha Compare (Clip)
if(!(true || true))
discard;
PixelColor = result;
}
#version 330 core
// Input
in vec3 RawPosition;
in vec4 RawColor0;
in vec2 RawTex0;
in vec2 RawTex1;
in vec2 RawTex2;
in vec2 RawTex3;
in vec2 RawTex4;
in vec2 RawTex5;
in vec2 RawTex6;
in vec2 RawTex7;
// Output
out vec4 Color0;
out vec3 Tex0;
// Uniforms
uniform mat4 ModelMtx;
uniform mat4 ViewMtx;
uniform mat4 ProjMtx;
uniform mat4 TexMtx[10];
uniform mat4 PostMtx[20];
uniform vec4 COLOR0_Amb;
uniform vec4 COLOR0_Mat;
uniform vec4 COLOR1_Amb;
uniform vec4 COLOR1_Mat;
struct GXLight
{
vec4 Position;
vec4 Direction;
vec4 Color;
vec4 DistAtten;
vec4 AngleAtten;
};
GXLight Lights[8];
uniform int NumLights;
uniform vec4 ambLightColor;
// Main
void main()
{
mat4 MVP = ProjMtx * ViewMtx * ModelMtx;
mat4 MV = ViewMtx * ModelMtx;
gl_Position = MVP * vec4(RawPosition, 1);
// Ambient Colors & Material Colors
vec4 ambColor0 = vec4(0.1960784, 0.1960784, 0.1960784, 0.1960784);
vec4 ambColor1 = vec4(0, 0, 0, 0);
vec4 matColor0 = vec4(0.8, 0.8, 0.8, 1);
vec4 matColor1 = vec4(0.8, 0.8, 0.8, 1);
// ChanCtrl's - 1 count
Color0 = vec4(1, 1, 1, 1);
Color0.rgb = RawColor0.rgb;
// TexGen - 1 count
Tex0 = vec3(RawTex0.xy, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment