AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

This commit is contained in:
2025-02-01 00:46:41 +01:00
parent 118e967412
commit af01f223c1
12 changed files with 227 additions and 44 deletions

View File

@@ -9,7 +9,6 @@ cbuffer PixelBuffer
float4 pixelColor;
};
//////////////
// TYPEDEFS //
//////////////
@@ -25,23 +24,19 @@ struct PixelInputType
float4 FontPixelShader(PixelInputType input) : SV_TARGET
{
float4 color;
// Sample the texture pixel at this location.
color = shaderTexture.Sample(SampleType, input.tex);
// If the color is black on the texture then treat this pixel as transparent.
if(color.r == 0.0f)
if (color.r == 0.0f && color.g == 0.0f && color.b == 0.0f)
{
color.a = 0.0f;
}
// If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color.
else
{
color.a = 1.0f;
color = color * pixelColor;
return color;
}
// If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color.
color = color * pixelColor;
return color;
}
}

View File

@@ -8,7 +8,6 @@ cbuffer MatrixBuffer
matrix projectionMatrix;
};
//////////////
// TYPEDEFS //
//////////////
@@ -24,14 +23,12 @@ struct PixelInputType
float2 tex : TEXCOORD0;
};
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType FontVertexShader(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
@@ -40,9 +37,9 @@ PixelInputType FontVertexShader(VertexInputType input)
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
return output;
}
}