-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac733f5
commit 883fef8
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
*/ |