Patch - Fix release and debug config - V11.2.1

This commit is contained in:
2025-06-03 19:58:01 +02:00
parent 315d259acd
commit ae3fc21ffc
6 changed files with 474 additions and 108 deletions

53
src/hlsl/skybox.ps Normal file
View File

@@ -0,0 +1,53 @@
/////////////
// GLOBALS //
/////////////
Texture2D shaderTexture : register(t0);
SamplerState SampleType : register(s0);
cbuffer SkyboxBuffer
{
float4 ambientColor;
float4 diffuseColor;
float3 lightDirection;
float intensity;
};
cbuffer SkyboxColorBuffer
{
float4 sunColor;
};
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 SkyboxPixelShader(PixelInputType input) : SV_TARGET
{
// Inverser les coordonn<EFBFBD>es de texture pour compenser les normales invers<EFBFBD>es
float2 invertedTexCoord = float2(1.0 - input.tex.x, 1.0 - input.tex.y);
// <EFBFBD>chantillonner la texture avec les coordonn<EFBFBD>es invers<EFBFBD>es
float4 textureColor = shaderTexture.Sample(SampleType, invertedTexCoord);
// Pour une skybox, l'<27>clairage devrait <EFBFBD>tre plus simple - on ignore l'orientation des normales
// et on applique une luminosit<EFBFBD> uniforme ou un gradient bas<EFBFBD> sur la position (hauteur)
// Calculer un facteur de luminosit<EFBFBD> uniforme <EFBFBD> appliquer
float lightFactor = saturate(intensity);
// Combiner la couleur ambiante et diffuse pour l'<27>clairage de la skybox
float4 lightColor = ambientColor + (diffuseColor * lightFactor);
// Appliquer la couleur de l'<27>clairage <EFBFBD> la texture
float4 finalColor = saturate(lightColor) * textureColor;
return finalColor;
}

67
src/hlsl/skybox.vs Normal file
View File

@@ -0,0 +1,67 @@
/////////////
// GLOBALS //
/////////////
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
cbuffer CameraBuffer
{
float3 cameraPosition;
float padding;
};
cbuffer SkyboxBuffer
{
float4 ambientColor;
float4 diffuseColor;
float3 lightDirection;
float intensity;
};
//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
float4 position : POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType SkyboxVertexShader(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
// Calculate the position of the vertex against the world, view, and projection matrices.
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;
// Calculate the normal vector against the world matrix only.
output.normal = mul(input.normal, (float3x3) worldMatrix);
// Normalize the normal vector.
output.normal = normalize(output.normal);
return output;
}