2D rendering (big feature)
This commit is contained in:
parent
6d7ea4ebc5
commit
5a05b9d65e
21 changed files with 1075 additions and 22 deletions
25
resources/EngineResources/SpriteShaders/sprite_fragment.glsl
Normal file
25
resources/EngineResources/SpriteShaders/sprite_fragment.glsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 128;
|
||||
const float GAMMA_CONST = 0.4545;
|
||||
layout(location = 0) in vec2 inUV;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(push_constant) uniform pc {
|
||||
layout(offset = 24) uint textureIndex;
|
||||
} push_constants;
|
||||
|
||||
layout(set = 1, binding = 0) uniform sampler2D spriteTextures[MAX_TEXTURES];
|
||||
|
||||
vec4 gamma(vec4 color){
|
||||
return color = vec4(pow(color.rgb,vec3(GAMMA_CONST)),color.a);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 tex = texture(spriteTextures[push_constants.textureIndex], inUV);
|
||||
outColor = gamma(tex);
|
||||
|
||||
if (outColor.a <= 0.09) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue