Patch Update - Skysphere
This commit is contained in:
parent
96b0d0e72d
commit
c15cb2956d
13
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
13
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@ -6,14 +6,10 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" 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/enginecustom.vcxproj.filters" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj.filters" 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/inc/shader/SkyboxShaderClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/shader/SkyboxShaderClass.h" 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/inc/shader/shadermanagerclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/shader/shadermanagerclass.h" 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/shader/SkyboxShaderClass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/SkyboxShaderClass.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/shader/shadermanagerclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/shadermanagerclass.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/textureclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/textureclass.cpp" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -170,6 +166,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" />
|
||||||
</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/Model/OBJ/skysphere.obj
(Stored with Git LFS)
Normal file
BIN
enginecustom/assets/Model/OBJ/skysphere.obj
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
enginecustom/assets/Model/OBJ/vaisseautri.mtl
(Stored with Git LFS)
Normal file
BIN
enginecustom/assets/Model/OBJ/vaisseautri.mtl
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
@ -1,20 +1,16 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Filename: multitexture.ps
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// GLOBALS //
|
// GLOBALS //
|
||||||
/////////////
|
/////////////
|
||||||
Texture2D shaderTexture : register(t0);
|
|
||||||
SamplerState SampleType : register(s0);
|
|
||||||
cbuffer SunLightBuffer
|
|
||||||
{
|
|
||||||
float4 ambientColor;
|
|
||||||
float4 diffuseColor;
|
|
||||||
float3 lightDirection;
|
|
||||||
float intensity;
|
|
||||||
};
|
|
||||||
|
|
||||||
cbuffer SunLightColorBuffer
|
Texture2D shaderTexture1 : register(t0);
|
||||||
{
|
Texture2D shaderTexture2 : register(t1);
|
||||||
float4 sunColor;
|
SamplerState SampleType : register(s0);
|
||||||
};
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// TYPEDEFS //
|
// TYPEDEFS //
|
||||||
@ -23,39 +19,27 @@ struct PixelInputType
|
|||||||
{
|
{
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
float2 tex : TEXCOORD0;
|
||||||
float3 normal : NORMAL;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Pixel Shader
|
// Pixel Shader
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
float4 SunLightPixelShader(PixelInputType input) : SV_TARGET
|
float4 SkyboxShaderPixelShader(PixelInputType input) : SV_TARGET
|
||||||
{
|
{
|
||||||
float4 textureColor;
|
float4 color1;
|
||||||
float4 color;
|
float4 color2;
|
||||||
float lightIntensity;
|
float4 blendColor;
|
||||||
float4 colorArray;
|
|
||||||
float4 colorSum;
|
|
||||||
|
|
||||||
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
|
// Sample the pixel color from the textures using the sampler at this texture coordinate location.
|
||||||
textureColor = shaderTexture.Sample(SampleType, input.tex);
|
color1 = shaderTexture1.Sample(SampleType, input.tex);
|
||||||
|
color2 = shaderTexture2.Sample(SampleType, input.tex);
|
||||||
|
|
||||||
// Calculate the different amounts of light on this pixel based on the direction of the light.
|
// Combine the two textures together.
|
||||||
lightIntensity = saturate(dot(input.normal, -lightDirection));
|
blendColor = color1 * color2 * 2.0;
|
||||||
|
|
||||||
// Determine the diffuse color amount of the light.
|
// Saturate the final color.
|
||||||
colorArray = (diffuseColor * lightIntensity) * intensity;
|
blendColor = saturate(blendColor);
|
||||||
|
|
||||||
// Initialize the sum of colors.
|
return blendColor;
|
||||||
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,3 +1,8 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Filename: multitexture.vs
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// GLOBALS //
|
// GLOBALS //
|
||||||
/////////////
|
/////////////
|
||||||
@ -8,19 +13,6 @@ cbuffer MatrixBuffer
|
|||||||
matrix projectionMatrix;
|
matrix projectionMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
cbuffer CameraBuffer
|
|
||||||
{
|
|
||||||
float3 cameraPosition;
|
|
||||||
float padding;
|
|
||||||
};
|
|
||||||
|
|
||||||
cbuffer SunLightBuffer
|
|
||||||
{
|
|
||||||
float4 ambientColor;
|
|
||||||
float4 diffuseColor;
|
|
||||||
float3 lightDirection;
|
|
||||||
float intensity;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// TYPEDEFS //
|
// TYPEDEFS //
|
||||||
@ -36,16 +28,17 @@ struct PixelInputType
|
|||||||
{
|
{
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
float2 tex : TEXCOORD0;
|
||||||
float3 normal : NORMAL;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Vertex Shader
|
// Vertex Shader
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
PixelInputType SunLightVertexShader(VertexInputType input)
|
PixelInputType SkyboxShaderVertexShader(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;
|
||||||
|
|
||||||
@ -57,11 +50,5 @@ PixelInputType SunLightVertexShader(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;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ Object* Skybox::ConstructSkybox()
|
|||||||
Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
char modelFilename[128];
|
char modelFilename[128];
|
||||||
strcpy_s(modelFilename, "assets/Model/OBJ/invertcube.obj");
|
strcpy_s(modelFilename, "assets/Model/OBJ/skysphere.obj");
|
||||||
|
|
||||||
textures.clear();
|
textures.clear();
|
||||||
std::vector<std::wstring> skyboxTextures = {
|
std::vector<std::wstring> skyboxTextures = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user