mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-13 05:57:05 +03:00
Z Write Alpha Blended textures
This commit is contained in:
parent
5589db7794
commit
ecc506ee7c
3 changed files with 14 additions and 12 deletions
|
@ -2147,8 +2147,8 @@ namespace T5M::Renderer
|
||||||
UINT stride = sizeof(RendererVertex);
|
UINT stride = sizeof(RendererVertex);
|
||||||
UINT offset = 0;
|
UINT offset = 0;
|
||||||
|
|
||||||
int firstBucket = (transparent ? 2 : 0);
|
int firstBucket = (transparent ? 1 : 0);
|
||||||
int lastBucket = (transparent ? 4 : 2);
|
int lastBucket = (transparent ? 2 : 1);
|
||||||
|
|
||||||
m_context->IASetVertexBuffers(0, 1, m_moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
m_context->IASetVertexBuffers(0, 1, m_moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
||||||
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
@ -2345,8 +2345,8 @@ namespace T5M::Renderer
|
||||||
UINT stride = sizeof(RendererVertex);
|
UINT stride = sizeof(RendererVertex);
|
||||||
UINT offset = 0;
|
UINT offset = 0;
|
||||||
|
|
||||||
int firstBucket = (transparent ? 2 : 0);
|
int firstBucket = (transparent ? 1 : 0);
|
||||||
int lastBucket = (transparent ? 4 : 2);
|
int lastBucket = (transparent ? 2 : 1);
|
||||||
|
|
||||||
m_context->IASetVertexBuffers(0, 1, m_staticsVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
m_context->IASetVertexBuffers(0, 1, m_staticsVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
||||||
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
@ -2403,8 +2403,8 @@ namespace T5M::Renderer
|
||||||
UINT stride = sizeof(RendererVertex);
|
UINT stride = sizeof(RendererVertex);
|
||||||
UINT offset = 0;
|
UINT offset = 0;
|
||||||
|
|
||||||
int firstBucket = (transparent ? 2 : 0);
|
int firstBucket = (transparent ? 1 : 0);
|
||||||
int lastBucket = (transparent ? 4 : 2);
|
int lastBucket = (transparent ? 2 : 1);
|
||||||
|
|
||||||
if (!animated)
|
if (!animated)
|
||||||
{
|
{
|
||||||
|
@ -2458,7 +2458,7 @@ namespace T5M::Renderer
|
||||||
m_context->PSSetConstantBuffers(1, 1, m_cbLights.get());
|
m_context->PSSetConstantBuffers(1, 1, m_cbLights.get());
|
||||||
|
|
||||||
m_stMisc.Caustics = (room->Room->flags & ENV_FLAG_WATER);
|
m_stMisc.Caustics = (room->Room->flags & ENV_FLAG_WATER);
|
||||||
m_stMisc.AlphaTest = !transparent;
|
m_stMisc.AlphaTest = transparent;
|
||||||
m_cbMisc.updateData(m_stMisc, m_context.Get());
|
m_cbMisc.updateData(m_stMisc, m_context.Get());
|
||||||
m_context->PSSetConstantBuffers(3, 1, m_cbMisc.get());
|
m_context->PSSetConstantBuffers(3, 1, m_cbMisc.get());
|
||||||
m_stRoom.AmbientColor = room->AmbientLight;
|
m_stRoom.AmbientColor = room->AmbientLight;
|
||||||
|
|
|
@ -200,8 +200,8 @@ void T5M::Renderer::Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
UINT stride = sizeof(RendererVertex);
|
UINT stride = sizeof(RendererVertex);
|
||||||
UINT offset = 0;
|
UINT offset = 0;
|
||||||
|
|
||||||
int firstBucket = (transparent ? 2 : 0);
|
int firstBucket = (transparent ? 1 : 0);
|
||||||
int lastBucket = (transparent ? 4 : 2);
|
int lastBucket = (transparent ? 2 : 1);
|
||||||
|
|
||||||
m_context->IASetVertexBuffers(0, 1, m_moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
m_context->IASetVertexBuffers(0, 1, m_moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
||||||
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct PixelShaderInput
|
||||||
float2 UV: TEXCOORD;
|
float2 UV: TEXCOORD;
|
||||||
float4 Color: COLOR;
|
float4 Color: COLOR;
|
||||||
float4 LightPosition: POSITION1;
|
float4 LightPosition: POSITION1;
|
||||||
linear float3x3 TBN : TBN;
|
float3x3 TBN : TBN;
|
||||||
};
|
};
|
||||||
Texture2D NormalTexture : register(t3);
|
Texture2D NormalTexture : register(t3);
|
||||||
Texture2D Texture : register(t0);
|
Texture2D Texture : register(t0);
|
||||||
|
@ -85,6 +85,10 @@ float2 texOffset(int u, int v) {
|
||||||
|
|
||||||
float4 PS(PixelShaderInput input) : SV_TARGET
|
float4 PS(PixelShaderInput input) : SV_TARGET
|
||||||
{
|
{
|
||||||
|
float4 output = Texture.Sample(Sampler, input.UV);
|
||||||
|
if (AlphaTest && output.w < 0.01f) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
float3 Normal = NormalTexture.Sample(Sampler,input.UV).rgb;
|
float3 Normal = NormalTexture.Sample(Sampler,input.UV).rgb;
|
||||||
//Normal = float3(0.5, 0.5, 1);
|
//Normal = float3(0.5, 0.5, 1);
|
||||||
Normal.g = 1 - Normal.g;
|
Normal.g = 1 - Normal.g;
|
||||||
|
@ -110,7 +114,6 @@ float4 PS(PixelShaderInput input) : SV_TARGET
|
||||||
//PCF sampling for shadow map
|
//PCF sampling for shadow map
|
||||||
float sum = 0;
|
float sum = 0;
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
//perform PCF filtering on a 4 x 4 texel neighborhood
|
//perform PCF filtering on a 4 x 4 texel neighborhood
|
||||||
for (y = -1.5; y <= 1.5; y += 1.0) {
|
for (y = -1.5; y <= 1.5; y += 1.0) {
|
||||||
for (x = -1.5; x <= 1.5; x += 1.0) {
|
for (x = -1.5; x <= 1.5; x += 1.0) {
|
||||||
|
@ -173,7 +176,6 @@ float4 PS(PixelShaderInput input) : SV_TARGET
|
||||||
}
|
}
|
||||||
|
|
||||||
output.xyz = output.xyz * lighting;
|
output.xyz = output.xyz * lighting;
|
||||||
//output.w = 1.0f;
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue