Minor - Depth shader - V10.6.0
This commit is contained in:
parent
f20adee22f
commit
1af71960c3
11
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
11
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@ -5,16 +5,8 @@
|
|||||||
</component>
|
</component>
|
||||||
<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 afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/depth.ps" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/depth.vs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/enginecustom/src/inc/shader/depth_shader_class.h" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/depth_shader_class.cpp" 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$/.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/src/hlsl/depth.ps" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/depth.ps" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" 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/inc/shader/shader_manager_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/shader/shader_manager_class.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/shader/shader_manager_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/shader_manager_class.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -205,6 +197,7 @@
|
|||||||
<workItem from="1747830379222" duration="7954000" />
|
<workItem from="1747830379222" duration="7954000" />
|
||||||
<workItem from="1748254142068" duration="10499000" />
|
<workItem from="1748254142068" duration="10499000" />
|
||||||
<workItem from="1748267553700" duration="654000" />
|
<workItem from="1748267553700" duration="654000" />
|
||||||
|
<workItem from="1748429087202" duration="2377000" />
|
||||||
</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" />
|
||||||
|
@ -18,11 +18,7 @@ struct PixelInputType
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
float4 DepthPixelShader(PixelInputType input) : SV_TARGET
|
float4 DepthPixelShader(PixelInputType input) : SV_TARGET
|
||||||
{
|
{
|
||||||
float4 textureColor;
|
float depth = input.position.z / input.position.w;
|
||||||
|
depth = 1.0f - depth;
|
||||||
|
return float4(depth, depth, depth, 1.0f);
|
||||||
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
|
|
||||||
textureColor = shaderTexture.Sample(SampleType, input.tex);
|
|
||||||
|
|
||||||
return textureColor;
|
|
||||||
}
|
}
|
@ -839,8 +839,11 @@ bool application_class::frame(input_class* Input)
|
|||||||
camera_->set_rotation(rotationX, rotationY, 0.0f);
|
camera_->set_rotation(rotationX, rotationY, 0.0f);
|
||||||
} else {
|
} else {
|
||||||
// Update the sun camera position and rotation based on the light position.
|
// Update the sun camera position and rotation based on the light position.
|
||||||
sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
|
// sun_camera_->set_position(sun_light_->GetPosition().x, sun_light_->GetPosition().y, sun_light_->GetPosition().z);
|
||||||
sun_camera_->set_rotation(pitch, yaw, roll);
|
// sun_camera_->set_rotation(pitch, yaw, roll);
|
||||||
|
|
||||||
|
sun_camera_->set_position(positionX, positionY, positionZ);
|
||||||
|
sun_camera_->set_rotation(rotationX, rotationY, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
active_camera_->render();
|
active_camera_->render();
|
||||||
@ -1110,46 +1113,12 @@ bool application_class::render(float rotation, float x, float y, float z, float
|
|||||||
// ------------ render the object in the queue ------------ //
|
// ------------ render the object in the queue ------------ //
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
if (active_camera_ == sun_camera_)
|
|
||||||
|
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||||
|
if (!result)
|
||||||
{
|
{
|
||||||
for (auto& render : render_queues_)
|
Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
{
|
return false;
|
||||||
|
|
||||||
bool isSkybox = (&render.get() == &skybox_);
|
|
||||||
if (isSkybox)
|
|
||||||
{
|
|
||||||
direct_3d_->turn_z_buffer_off();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& item : render.get())
|
|
||||||
{
|
|
||||||
|
|
||||||
item->Render(direct_3d_->get_device_context());
|
|
||||||
// render the item using depth shader
|
|
||||||
result = shader_manager_->render_depth_shader(
|
|
||||||
direct_3d_->get_device_context(),
|
|
||||||
item->GetIndexCount(),
|
|
||||||
worldMatrix,
|
|
||||||
viewMatrix,
|
|
||||||
projectionMatrix,
|
|
||||||
item->GetTexture(TextureType::Diffuse,0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSkybox)
|
|
||||||
{
|
|
||||||
direct_3d_->turn_z_buffer_on();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1761,7 +1730,7 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
|
|
||||||
int renderCount = 0;
|
int renderCount = 0;
|
||||||
|
|
||||||
//construct_frustum();
|
//construct_frustum();
|
||||||
|
|
||||||
for (const auto& RenderQueue : RenderQueues)
|
for (const auto& RenderQueue : RenderQueues)
|
||||||
{
|
{
|
||||||
@ -1804,6 +1773,18 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
|
|
||||||
object->Render(direct_3d_->get_device_context());
|
object->Render(direct_3d_->get_device_context());
|
||||||
|
|
||||||
|
if (active_camera_ == sun_camera_)
|
||||||
|
{
|
||||||
|
result = shader_manager_->render_depth_shader(
|
||||||
|
direct_3d_->get_device_context(),
|
||||||
|
object->GetIndexCount(),
|
||||||
|
worldMatrix,
|
||||||
|
view,
|
||||||
|
projection,
|
||||||
|
object->GetTexture(TextureType::Diffuse,0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Utiliser l'enum ShaderType pour déterminer quel shader utiliser
|
// Utiliser l'enum ShaderType pour déterminer quel shader utiliser
|
||||||
switch (object->GetActiveShader())
|
switch (object->GetActiveShader())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user