FroggyGreen
b0dd2cdf3a
Textures are stored in a global hashtable. Each mesh pipeline has access to a single texture. The texture may be used as an atlas by creating meshes with different texture coordinates. The current system should be fine for text glyphs. However, if you have an atlas where each subdivision is equal in its dimensions, the use of layers and the VK_IMAGE_VIEW_TYPE_2D_ARRAY view type would be best. Some preliminary code for this was completed, but for now inserting textures into the hashmap defaults to VK_IMAGE_VIEW_TYPE_2D.
30 lines
628 B
GLSL
30 lines
628 B
GLSL
#version 460
|
|
|
|
// vertex geometry data
|
|
layout(location = 0) in vec2 inPos;
|
|
layout(location = 1) in vec2 inTex;
|
|
|
|
// instance data
|
|
layout(location = 2) in vec3 inInstancePos;
|
|
layout(location = 3) in vec3 inInstanceScale;
|
|
layout(location = 4) in vec4 inInstanceColor;
|
|
|
|
layout(location = 0) out vec4 fragColor;
|
|
layout(location = 1) out vec2 fragTex;
|
|
|
|
layout(binding = 0) uniform Camera
|
|
{
|
|
mat4 view;
|
|
mat4 perspective;
|
|
mat4 orthographic;
|
|
|
|
} camera;
|
|
|
|
void main()
|
|
{
|
|
vec3 pos = vec3(inPos, 0.0) * inInstanceScale + inInstancePos;
|
|
gl_Position = camera.orthographic * vec4(pos, 1.0);
|
|
fragColor = inInstanceColor;
|
|
fragTex = inTex;
|
|
}
|