Patch Update - SkySphere - V9.3.5
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: multitexture.ps
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
|
||||
Texture2D shaderTexture1 : register(t0);
|
||||
Texture2D shaderTexture2 : register(t1);
|
||||
Texture2D shaderTexture : register(t0);
|
||||
SamplerState SampleType : register(s0);
|
||||
cbuffer SunLightBuffer
|
||||
{
|
||||
float4 ambientColor;
|
||||
float4 diffuseColor;
|
||||
float3 lightDirection;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
cbuffer SunLightColorBuffer
|
||||
{
|
||||
float4 sunColor;
|
||||
};
|
||||
|
||||
//////////////
|
||||
// TYPEDEFS //
|
||||
@@ -19,27 +23,35 @@ struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel Shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
float4 SkyboxShaderPixelShader(PixelInputType input) : SV_TARGET
|
||||
float4 SkyboxPixelShader(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
float4 color1;
|
||||
float4 color2;
|
||||
float4 blendColor;
|
||||
float4 textureColor;
|
||||
float4 color;
|
||||
float4 colorArray;
|
||||
float4 colorSum;
|
||||
|
||||
// Sample the pixel color from the textures using the sampler at this texture coordinate location.
|
||||
color1 = shaderTexture1.Sample(SampleType, input.tex);
|
||||
color2 = shaderTexture2.Sample(SampleType, input.tex);
|
||||
|
||||
// Combine the two textures together.
|
||||
blendColor = color1 * color2 * 2.0;
|
||||
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
|
||||
textureColor = shaderTexture.Sample(SampleType, input.tex);
|
||||
|
||||
// Saturate the final color.
|
||||
blendColor = saturate(blendColor);
|
||||
// Determine the diffuse color amount of the light.
|
||||
colorArray = diffuseColor * intensity;
|
||||
|
||||
return blendColor;
|
||||
// Initialize the sum of colors.
|
||||
colorSum = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// Add the light color.
|
||||
colorSum.r += colorArray.r;
|
||||
colorSum.g += colorArray.g;
|
||||
colorSum.b += colorArray.b;
|
||||
|
||||
// Multiply the texture pixel by the light color to get the final result.
|
||||
color = saturate(colorSum) * textureColor;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
@@ -1,8 +1,3 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Filename: multitexture.vs
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
@@ -13,6 +8,19 @@ cbuffer MatrixBuffer
|
||||
matrix projectionMatrix;
|
||||
};
|
||||
|
||||
cbuffer CameraBuffer
|
||||
{
|
||||
float3 cameraPosition;
|
||||
float padding;
|
||||
};
|
||||
|
||||
cbuffer SunLightBuffer
|
||||
{
|
||||
float4 ambientColor;
|
||||
float4 diffuseColor;
|
||||
float3 lightDirection;
|
||||
float intensity;
|
||||
};
|
||||
|
||||
//////////////
|
||||
// TYPEDEFS //
|
||||
@@ -28,16 +36,15 @@ struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Vertex Shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
PixelInputType SkyboxShaderVertexShader(VertexInputType input)
|
||||
PixelInputType SkyboxVertexShader(VertexInputType input)
|
||||
{
|
||||
PixelInputType output;
|
||||
|
||||
|
||||
// Change the position vector to be 4 units for proper matrix calculations.
|
||||
input.position.w = 1.0f;
|
||||
@@ -50,5 +57,11 @@ PixelInputType SkyboxShaderVertexShader(VertexInputType input)
|
||||
// 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user