You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
|
|
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <Atom/Features/SrgSemantics.azsli>
|
|
|
|
struct VertexInput
|
|
{
|
|
float2 Position : POSITION;
|
|
float2 UV : UV;
|
|
float4 Color : COLOR;
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 Position : SV_Position;
|
|
float4 Color : COLOR;
|
|
float2 UV : UV;
|
|
};
|
|
|
|
ShaderResourceGroup ObjectSrg : SRG_PerObject
|
|
{
|
|
Texture2D<float4> FontImage;
|
|
|
|
Sampler LinearSampler
|
|
{
|
|
MinFilter = Linear;
|
|
MagFilter = Linear;
|
|
MipFilter = Linear;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
AddressW = Clamp;
|
|
};
|
|
|
|
column_major float4x4 m_projectionMatrix;
|
|
}
|
|
|
|
VertexOutput MainVS(in VertexInput input)
|
|
{
|
|
VertexOutput output;
|
|
output.Position = mul(float4(input.Position, 0.0f, 1.0f), ObjectSrg::m_projectionMatrix);
|
|
output.Color = float4(input.Color.rgb, input.Color.a);
|
|
output.UV = input.UV;
|
|
return output;
|
|
}
|
|
|
|
struct PixelOutput
|
|
{
|
|
float4 m_color : SV_Target0;
|
|
};
|
|
|
|
PixelOutput MainPS(in VertexOutput input)
|
|
{
|
|
PixelOutput output;
|
|
float4 color = ObjectSrg::FontImage.Sample(ObjectSrg::LinearSampler, input.UV) * input.Color;
|
|
output.m_color = float4(color.rgb * color.a, color.a);
|
|
return output;
|
|
}
|