2021-06-29 11:01:11 +04:30
|
|
|
#define LT_ENGINE_RESOURCES_TEXTURE_SHADER_VS \
|
|
|
|
R"(
|
|
|
|
+GLSL
|
|
|
|
#version 440 core
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 a_Position;
|
2021-07-01 19:25:46 +04:30
|
|
|
layout(location = 1) in vec2 a_TexCoord;
|
2021-06-29 11:01:11 +04:30
|
|
|
|
2021-07-05 14:36:36 +04:30
|
|
|
layout(std140, binding = 0) uniform ub_ViewProjection
|
|
|
|
{
|
|
|
|
mat4 u_ViewProjection;
|
|
|
|
};
|
2021-07-05 01:59:18 +04:30
|
|
|
|
2021-07-01 19:25:46 +04:30
|
|
|
out vec2 vso_TexCoord;
|
2021-06-29 11:01:11 +04:30
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-07-05 01:59:18 +04:30
|
|
|
gl_Position = u_ViewProjection * vec4(a_Position, 1.0);
|
2021-07-01 19:25:46 +04:30
|
|
|
vso_TexCoord = a_TexCoord;
|
2021-06-29 11:01:11 +04:30
|
|
|
}
|
|
|
|
-GLSL
|
2021-07-01 19:25:46 +04:30
|
|
|
|
|
|
|
|
2021-06-29 14:21:05 +04:30
|
|
|
+HLSL
|
|
|
|
struct VertexOut
|
|
|
|
{
|
2021-07-01 19:25:46 +04:30
|
|
|
float2 TexChoord : TEXCHOORD;
|
|
|
|
float4 Position : SV_Position;
|
2021-06-29 14:21:05 +04:30
|
|
|
};
|
|
|
|
|
2021-07-05 14:36:36 +04:30
|
|
|
cbuffer cb_ViewProjection : register(b0)
|
|
|
|
{
|
|
|
|
row_major matrix viewProjection;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VertexOut main(float3 InPosition : POSITION, float2 InTexChoord : TEXCOORD)
|
2021-06-29 14:21:05 +04:30
|
|
|
{
|
|
|
|
VertexOut vso;
|
2021-07-05 14:36:36 +04:30
|
|
|
vso.Position = mul(float4(InPosition, 1.0), viewProjection);
|
2021-07-01 19:25:46 +04:30
|
|
|
vso.TexChoord = InTexChoord;
|
2021-06-29 14:21:05 +04:30
|
|
|
|
|
|
|
return vso;
|
|
|
|
}
|
|
|
|
-HLSL
|
2021-06-29 11:01:11 +04:30
|
|
|
)"
|
|
|
|
|
|
|
|
#define LT_ENGINE_RESOURCES_TEXTURE_SHADER_PS \
|
|
|
|
R"(
|
|
|
|
+GLSL
|
|
|
|
#version 440 core
|
|
|
|
|
2021-07-01 19:25:46 +04:30
|
|
|
in vec2 vso_TexCoord;
|
2021-06-29 11:01:11 +04:30
|
|
|
|
|
|
|
uniform sampler2D u_Texture;
|
|
|
|
|
2021-07-01 19:25:46 +04:30
|
|
|
out vec4 fso_FragmentColor;
|
2021-06-29 11:01:11 +04:30
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-07-01 19:25:46 +04:30
|
|
|
fso_FragmentColor = texture(u_Texture, vso_TexCoord);
|
2021-06-29 11:01:11 +04:30
|
|
|
}
|
|
|
|
-GLSL
|
2021-07-01 19:25:46 +04:30
|
|
|
|
|
|
|
|
2021-06-29 14:21:05 +04:30
|
|
|
+HLSL
|
|
|
|
sampler samplerState : register(s0);
|
|
|
|
Texture2D<float4> myTexture : register(t0);
|
|
|
|
|
2021-07-01 19:25:46 +04:30
|
|
|
float4 main(float2 InTexChoord : TEXCHOORD) : SV_Target
|
2021-06-29 14:21:05 +04:30
|
|
|
{
|
2021-07-01 19:25:46 +04:30
|
|
|
return myTexture.Sample(samplerState, InTexChoord);
|
2021-06-29 14:21:05 +04:30
|
|
|
}
|
|
|
|
|
|
|
|
-HLSL
|
2021-06-29 11:01:11 +04:30
|
|
|
)"
|