Skip to content

Commit

Permalink
Add g2 Kong shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Jun 9, 2024
1 parent ac733f5 commit 883fef8
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions KongShaders/g2.kong
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const kinc_g2_constants: {
projection: float4x4;
};

struct kinc_g2_colored_vertex_in {
pos: float3;
col: float4;
}

struct kinc_g2_colored_vertex_out {
pos: float4;
col: float4;
}

fun kinc_g2_colored_vertex(input: kinc_g2_colored_vertex_in): kinc_g2_colored_vertex_out {
var output: kinc_g2_colored_vertex_out;

output.pos = kinc_g2_constants.projection * float4(input.pos, 1.0);
output.col = input.col;

return output;
}

fun kinc_g2_colored_fragment(input: kinc_g2_colored_vertex_out): float4 {
return input.col;
}

#[pipe]
struct kinc_g2_colored_pipeline {
vertex = kinc_g2_colored_vertex;
fragment = kinc_g2_colored_fragment;
}

struct kinc_g2_image_vertex_in {
pos: float3;
tex: float2;
col: float4;
}

struct kinc_g2_image_vertex_out {
pos: float4;
tex: float2;
col: float4;
}

fun kinc_g2_image_vertex(input: kinc_g2_image_vertex_in): kinc_g2_image_vertex_out {
var output: kinc_g2_image_vertex_out;

output.pos = kinc_g2_constants.projection * float4(input.pos, 1.0);
output.tex = input.tex;
output.col = input.col;

return output;
}

const kinc_g2_texture: tex2d;
const kinc_g2_sampler: sampler;

fun kinc_g2_image_fragment(input: kinc_g2_image_vertex_out): float4 {
var texcolor: float4 = sample(kinc_g2_texture, kinc_g2_sampler, input.tex) * input.col;
//texcolor.rgb *= color.a;
return texcolor;
}

#[pipe]
struct kinc_g2_image_pipeline {
vertex = kinc_g2_image_vertex;
fragment = kinc_g2_image_fragment;
}

/*
#version 450

in vec3 vertexPosition;
in vec2 vertexUV;
in vec4 vertexColor;
uniform mat4 projectionMatrix;
out vec2 texCoord;
out vec4 fragmentColor;

void text_vertex() {
gl_Position = projectionMatrix * vec4(vertexPosition, 1.0);
texCoord = vertexUV;
fragmentColor = vertexColor;
}

#version 450

uniform sampler2D tex;
in vec2 texCoord;
in vec4 fragmentColor;
out vec4 FragColor;

void text_fragment() {
FragColor = vec4(fragmentColor.rgb, texture(tex, texCoord).r * fragmentColor.a);
}
*/

0 comments on commit 883fef8

Please sign in to comment.