Patch Update - SkySphere - V9.3.5
This commit is contained in:
parent
c15cb2956d
commit
f8503e5a2a
@ -9,6 +9,7 @@
|
|||||||
<change beforePath="$PROJECT_DIR$/enginecustom/shader-error.txt" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/shader-error.txt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/shader-error.txt" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/shader-error.txt" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.ps" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.ps" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.ps" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.ps" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.vs" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.vs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.vs" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/skybox.vs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/shader/SkyboxShaderClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/SkyboxShaderClass.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Skybox.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -166,7 +167,7 @@
|
|||||||
<workItem from="1746106963725" duration="5888000" />
|
<workItem from="1746106963725" duration="5888000" />
|
||||||
<workItem from="1746112904421" duration="75000" />
|
<workItem from="1746112904421" duration="75000" />
|
||||||
<workItem from="1746113092234" duration="1477000" />
|
<workItem from="1746113092234" duration="1477000" />
|
||||||
<workItem from="1746117455914" duration="2790000" />
|
<workItem from="1746117455914" duration="4400000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
BIN
enginecustom/assets/Skybox/skybox.png
Normal file
BIN
enginecustom/assets/Skybox/skybox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 MiB |
Binary file not shown.
@ -1,16 +1,20 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Filename: multitexture.ps
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// GLOBALS //
|
// GLOBALS //
|
||||||
/////////////
|
/////////////
|
||||||
|
Texture2D shaderTexture : register(t0);
|
||||||
Texture2D shaderTexture1 : register(t0);
|
|
||||||
Texture2D shaderTexture2 : register(t1);
|
|
||||||
SamplerState SampleType : register(s0);
|
SamplerState SampleType : register(s0);
|
||||||
|
cbuffer SunLightBuffer
|
||||||
|
{
|
||||||
|
float4 ambientColor;
|
||||||
|
float4 diffuseColor;
|
||||||
|
float3 lightDirection;
|
||||||
|
float intensity;
|
||||||
|
};
|
||||||
|
|
||||||
|
cbuffer SunLightColorBuffer
|
||||||
|
{
|
||||||
|
float4 sunColor;
|
||||||
|
};
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// TYPEDEFS //
|
// TYPEDEFS //
|
||||||
@ -19,27 +23,35 @@ struct PixelInputType
|
|||||||
{
|
{
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
float2 tex : TEXCOORD0;
|
||||||
|
float3 normal : NORMAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Pixel Shader
|
// Pixel Shader
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
float4 SkyboxShaderPixelShader(PixelInputType input) : SV_TARGET
|
float4 SkyboxPixelShader(PixelInputType input) : SV_TARGET
|
||||||
{
|
{
|
||||||
float4 color1;
|
float4 textureColor;
|
||||||
float4 color2;
|
float4 color;
|
||||||
float4 blendColor;
|
float4 colorArray;
|
||||||
|
float4 colorSum;
|
||||||
|
|
||||||
// Sample the pixel color from the textures using the sampler at this texture coordinate location.
|
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
|
||||||
color1 = shaderTexture1.Sample(SampleType, input.tex);
|
textureColor = shaderTexture.Sample(SampleType, input.tex);
|
||||||
color2 = shaderTexture2.Sample(SampleType, input.tex);
|
|
||||||
|
|
||||||
// Combine the two textures together.
|
|
||||||
blendColor = color1 * color2 * 2.0;
|
|
||||||
|
|
||||||
// Saturate the final color.
|
// Determine the diffuse color amount of the light.
|
||||||
blendColor = saturate(blendColor);
|
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 //
|
// GLOBALS //
|
||||||
/////////////
|
/////////////
|
||||||
@ -13,6 +8,19 @@ cbuffer MatrixBuffer
|
|||||||
matrix projectionMatrix;
|
matrix projectionMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cbuffer CameraBuffer
|
||||||
|
{
|
||||||
|
float3 cameraPosition;
|
||||||
|
float padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
cbuffer SunLightBuffer
|
||||||
|
{
|
||||||
|
float4 ambientColor;
|
||||||
|
float4 diffuseColor;
|
||||||
|
float3 lightDirection;
|
||||||
|
float intensity;
|
||||||
|
};
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// TYPEDEFS //
|
// TYPEDEFS //
|
||||||
@ -28,16 +36,15 @@ struct PixelInputType
|
|||||||
{
|
{
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
float2 tex : TEXCOORD0;
|
||||||
|
float3 normal : NORMAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Vertex Shader
|
// Vertex Shader
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
PixelInputType SkyboxShaderVertexShader(VertexInputType input)
|
PixelInputType SkyboxVertexShader(VertexInputType input)
|
||||||
{
|
{
|
||||||
PixelInputType output;
|
PixelInputType output;
|
||||||
|
|
||||||
|
|
||||||
// Change the position vector to be 4 units for proper matrix calculations.
|
// Change the position vector to be 4 units for proper matrix calculations.
|
||||||
input.position.w = 1.0f;
|
input.position.w = 1.0f;
|
||||||
@ -50,5 +57,11 @@ PixelInputType SkyboxShaderVertexShader(VertexInputType input)
|
|||||||
// Store the texture coordinates for the pixel shader.
|
// Store the texture coordinates for the pixel shader.
|
||||||
output.tex = input.tex;
|
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;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ bool SkyboxShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
|||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
// Set the filename of the vertex shader.
|
// Set the filename of the vertex shader.
|
||||||
error = wcscpy_s(vsFilename, 128, L"src/hlsl/sunlight.vs");
|
error = wcscpy_s(vsFilename, 128, L"src/hlsl/skybox.vs");
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
@ -46,7 +46,7 @@ bool SkyboxShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the filename of the pixel shader.
|
// Set the filename of the pixel shader.
|
||||||
error = wcscpy_s(psFilename, 128, L"src/hlsl/sunlight.ps");
|
error = wcscpy_s(psFilename, 128, L"src/hlsl/skybox.ps");
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
@ -60,7 +60,7 @@ bool SkyboxShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::Get().Log("SunLightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("SkyboxShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ bool SkyboxShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
|
|||||||
pixelShaderBuffer = 0;
|
pixelShaderBuffer = 0;
|
||||||
|
|
||||||
// Compile the vertex shader code.
|
// Compile the vertex shader code.
|
||||||
result = D3DCompileFromFile(vsFilename, NULL, NULL, "SunLightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
|
result = D3DCompileFromFile(vsFilename, NULL, NULL, "SkyboxVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
|
||||||
if (FAILED(result))
|
if (FAILED(result))
|
||||||
{
|
{
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
@ -130,7 +130,7 @@ bool SkyboxShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compile the pixel shader code.
|
// Compile the pixel shader code.
|
||||||
result = D3DCompileFromFile(psFilename, NULL, NULL, "SunLightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
|
result = D3DCompileFromFile(psFilename, NULL, NULL, "SkyboxPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
|
||||||
if (FAILED(result))
|
if (FAILED(result))
|
||||||
{
|
{
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
|
@ -32,12 +32,7 @@ Object* Skybox::ConstructSkybox()
|
|||||||
|
|
||||||
textures.clear();
|
textures.clear();
|
||||||
std::vector<std::wstring> skyboxTextures = {
|
std::vector<std::wstring> skyboxTextures = {
|
||||||
L"assets/Skybox/skybox_front.png",
|
L"assets/Skybox/skybox.png",
|
||||||
L"assets/Skybox/skybox_back.png",
|
|
||||||
L"assets/Skybox/skybox_left.png",
|
|
||||||
L"assets/Skybox/skybox_right.png",
|
|
||||||
L"assets/Skybox/skybox_top.png",
|
|
||||||
L"assets/Skybox/skybox_bottom.png"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load the textures
|
// Load the textures
|
||||||
|
Loading…
x
Reference in New Issue
Block a user