From a0e1689f6789ba0858b7c972754c60c583f04b14 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Tue, 30 Dec 2025 19:25:43 +0900 Subject: [PATCH] [fix] ShaderBugs [add] Model Access --- .gitattributes | 2 +- .../ShaderFiles/Shader_UIEditor.hlsl | 2 +- .../Client/Private/BroomRacerAI.cpp | 6 +- .../Client/Private/Level_GamePlay.cpp | 8 +- Jusin154_Team3D/Client/Private/Loader.cpp | 8 +- Jusin154_Team3D/Client/Private/Player.cpp | 102 ++--- Jusin154_Team3D/Client/Private/PlayerRobe.cpp | 40 +- Jusin154_Team3D/Client/Public/PlayerRobe.h | 7 +- .../ShaderFiles/Engine_Shader_Functions.hlsli | 21 +- .../Resources/ShaderFiles/Shader_Blur.hlsl | 2 +- .../Resources/ShaderFiles/Shader_Cell.hlsl | 2 +- .../ShaderFiles/Shader_Deferred.hlsl | 23 +- .../ShaderFiles/Shader_Distortion.hlsl | 2 +- .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 89 ++++- .../ShaderFiles/Shader_UIEditor.hlsl | 2 +- .../ShaderFiles/Shader_UI_Instance.hlsl | 2 +- .../ShaderFiles/Shader_VtxAnimMesh.hlsl | 2 +- .../Resources/ShaderFiles/Shader_VtxMesh.hlsl | 2 +- .../ShaderFiles/Shader_VtxNorTex.hlsl | 2 +- .../ShaderFiles/Shader_VtxPointParticle.hlsl | 2 +- .../Resources/ShaderFiles/Shader_VtxPos.hlsl | 2 +- .../ShaderFiles/Shader_VtxPosTex.hlsl | 8 +- .../ShaderFiles/Shader_WeightBlend.hlsl | 4 +- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 1 + .../Editor/Default/Editor.vcxproj.filters | 3 + .../Editor/Private/DummyObject.cpp | 6 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 328 ---------------- .../Editor/Private/Loader_ObjectViewer.cpp | 358 ++++++++++++++++++ .../ShaderFiles/Engine_Shader_Functions.hlsli | 21 +- .../Resources/ShaderFiles/Shader_Blur.hlsl | 2 +- .../Resources/ShaderFiles/Shader_Cell.hlsl | 2 +- .../ShaderFiles/Shader_Deferred.hlsl | 23 +- .../ShaderFiles/Shader_Distortion.hlsl | 2 +- .../ShaderFiles/Shader_WeightBlend.hlsl | 4 +- Jusin154_Team3D/Engine/Private/Mesh.cpp | 83 +++- Jusin154_Team3D/Engine/Private/Model.cpp | 38 +- Jusin154_Team3D/Engine/Public/Mesh.h | 1 + Jusin154_Team3D/Engine/Public/Model.h | 29 +- 38 files changed, 734 insertions(+), 507 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp diff --git a/.gitattributes b/.gitattributes index b5955b0c0..b11f098c1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -48,6 +48,6 @@ # lfs *.fbx filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs *.png binary \ No newline at end of file diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index e140c5400..a15e12766 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -93,7 +93,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp index 68bcb4d7e..8bc737ef4 100644 --- a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp @@ -174,15 +174,15 @@ HRESULT CBroomRacerAI::Render() } if (m_pModelCom->Get_Type() == MODEL::PBR_ANIM) { + if (FAILED(Bind_ShaderParameters(i))) { + return E_FAIL; + } if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); - if (FAILED(Bind_ShaderParameters(i))) { - return E_FAIL; - } } else { diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index e8a72f18e..4853e5a6e 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -332,8 +332,8 @@ HRESULT CLevel_GamePlay::Ready_Background() #endif // #ifdef 기무리 isReady_Background = true; - isReady_Hogsmeade = true; - isReady_Hogwart = true; + isReady_Hogsmeade = false; + isReady_Hogwart = false; #endif // #ifdef 인혁 isReady_Background = false; @@ -659,7 +659,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) #endif // #ifdef 기무리 - isLoad_NPC = true; + isLoad_NPC = false; #endif // #ifdef 인혁 @@ -743,7 +743,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster() #endif // #ifdef 기무리 - isLoad_Monster = true; + isLoad_Monster = false; #endif // #ifdef 인혁 diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 2c3853ebd..a47f72ada 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -372,10 +372,10 @@ HRESULT CLoader::Loading_For_GamePlay() #endif // #ifdef 기무리 isLoad_Background = true; - isLoad_Hogwart = true; - isLoad_UI_SEQUANTIAL = true; - isLoad_NPC = true; - isLoad_Monster = true; + isLoad_Hogwart = false; + isLoad_UI_SEQUANTIAL = false; + isLoad_NPC = false; + isLoad_Monster = false; #endif // #ifdef 인혁 isLoad_Background = false; diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 45981e1c8..93d421471 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -1,37 +1,22 @@ #include "pch.h" #include "Player.h" -#include "GameInstance.h" -#include "InfoInstance.h" -#include "CamPosition_Socket.h" -#include "Camera_Gaze.h" -#include "CamPosition_Arm.h" -#include "Wand.h" -#include "Item_Potion.h" -#include "Character_Controller.h" -#include "CamPosition_Shoulder.h" +#include "Broom.h" +#include "BroomRaceManager.h" #include "CallBack_Playable_Behavior.h" #include "CallBack_Playable_HitReport.h" -#include "Monster.h" -#include "Broom.h" -#include "MapElement_Interactable.h" -#include "BroomRaceManager.h" -#include "RaceRing.h" -#include "PlayerRobe.h" - -#pragma region STATE -#include "State_Idle.h" -#include "State_Dodge.h" -#include "State_Jump.h" -#include "State_Land.h" -#include "State_Move.h" -#include "State_Combat.h" -#include "State_Hit.h" -#include "State_Broom_Ride.h" -#pragma endregion - -#include "Layer.h" +#include "CamPosition_Shoulder.h" +#include "Character_Controller.h" #include "EffectPool.h" +#include "GameInstance.h" +#include "InfoInstance.h" +#include "Item_Potion.h" +#include "Layer.h" +#include "MapElement_Interactable.h" +#include "Monster.h" +#include "PlayerRobe.h" +#include "RaceRing.h" +#include "Wand.h" CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CUnit(pDevice, pContext) @@ -231,19 +216,19 @@ void CPlayer::Late_Update(_float fTimeDelta) m_pTransformCom->Set_State(STATE::LOOK, look); //////////////////////////////////////////////////////////////////////////// -//#ifdef 기무리 -// if (nullptr == m_pRobePart) { -// { -// CPlayerRobe::PlayerRobe_DESC Desc{}; -// Desc.pModel = m_pModelCom; -// Desc.pParentTransform = m_pTransformCom; -// Desc.pSocketMatrix = m_pModelCom->Get_BoneMatrixPtr("Hips_Cloth"); -// if (FAILED(Add_PartObject("RobePart", g_iStaticLevel, &m_pRobePart, &Desc))) { -// assert(false); -// } -// } -// } -//#endif // 기무리 +#ifdef 기무리 + if (nullptr == m_pRobePart) { + { + CPlayerRobe::PlayerRobe_DESC Desc{}; + Desc.pModel = m_pModelCom; + Desc.pParentTransform = m_pTransformCom; + Desc.pSocketMatrix = m_pModelCom->Get_BoneMatrixPtr("Hips_Cloth"); + if (FAILED(Add_PartObject("RobePart", g_iStaticLevel, &m_pRobePart, &Desc))) { + assert(false); + } + } + } +#endif // 기무리 } @@ -255,6 +240,8 @@ HRESULT CPlayer::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } + _float fIntensity = 0.f; + m_pShaderCom->Bind_RawValue("g_fMBIntensity", &fIntensity, sizeof(_float)); RENDER eType = m_pGameInstance->Get_CurrentRenderPass(); if (RENDER::NONBLEND == eType) { _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); @@ -264,7 +251,14 @@ HRESULT CPlayer::Render() if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - +#ifdef _DEBUG +#ifdef 기무리 + if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } +#endif // 기무리 +#endif // _DEBUG + if (FAILED(m_pShaderCom->Bind_Matrices( "g_OffsetMatrix", m_pModelCom->Get_OffsetMatrix(i).data(), @@ -273,6 +267,9 @@ HRESULT CPlayer::Render() { return E_FAIL; } + if (FAILED(Bind_ShaderParameters(i))) { + return E_FAIL; + } if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } @@ -280,9 +277,6 @@ HRESULT CPlayer::Render() m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); - if (FAILED(Bind_ShaderParameters(i))) { - return E_FAIL; - } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; @@ -591,6 +585,21 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) fMixerFactor = 0.658333f; iColorMixerMethod = 1; break; +#ifdef _DEBUG +#ifdef 기무리 + case PLAYER_MESH_ORDER::ROBE_CLOTH: + if (FAILED(m_pModelCom->Bind_BoneMatrices(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH), m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } + if (nullptr != m_pRobePart) { + if (FAILED(m_pRobePart->Bind_PrevBoneMatrices(m_pShaderCom, "g_PrevBoneMatrices"))) { + return E_FAIL; + } + } + break; +#endif +#endif // _DEBUG + default: break; } @@ -777,6 +786,9 @@ void CPlayer::Describe_Entity() GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("PLAYER_DESC")) { + if (true == GUI::Button("ShaderRefresh")) { + m_pShaderCom->Shader_Refresh(); + } m_pCharacter_Controller->Describe_Entity(); _float4 vMomentum = {}; XMStoreFloat4(&vMomentum, m_pTransformCom->Get_CurrentMomentum()); diff --git a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp index 02362dfb0..ad96d6c04 100644 --- a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp +++ b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp @@ -19,14 +19,16 @@ void CPlayerRobe::Update(_float fTimeDelta) { _matrix SocketMatrixFixed = (XMMatrixRotationZ(XM_PI) * XMLoadFloat4x4(m_pSocketMatrix)) * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()); + m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false); m_pRobeMainAnchor->Get_Actor()->wakeUp(); + Update_LegsPosition(); + Update_RobeSocketPosition(); } void CPlayerRobe::Late_Update(_float fTimeDelta) { - Update_RobeSocketPosition(); #ifdef _DEBUG for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) { PSX::PxConstraintFlags pxConstraintFlags = m_pDynamicJoints[i]->getConstraintFlags(); @@ -56,21 +58,31 @@ HRESULT CPlayerRobe::Update_RobeSocketPosition() for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) { pxTransform = m_pRobeJointAnchor[i]->Get_GlobalPosition(); WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTransform.p), 1.f)); - XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], WorldMatrix * OwnerInvWorldMatrix); + _fmatrix LocalMatrix = WorldMatrix* OwnerInvWorldMatrix; + XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], LocalMatrix); + m_pModelCom->Set_BoneCombinedTransformation(PLAYER_JOINT_BONE_NAMES[i], LocalMatrix); } } - { - D3D11_MAPPED_SUBRESOURCE SubResource{}; - if (FAILED(m_pContext->Map(m_pBoneCombinedMatrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource))) { - return E_FAIL; - } - memcpy_s(SubResource.pData, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END), m_ReconstructedJointAnchorMatirces, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)); - m_pContext->Unmap(m_pBoneCombinedMatrixBuffer, 0); - } - m_pModelCom->ComputeInsertionBoneBuffer(m_BoneInsertionDesc, m_pBoneCombinedMatrixSRV); + //{ + // D3D11_MAPPED_SUBRESOURCE SubResource{}; + // if (FAILED(m_pContext->Map(m_pBoneCombinedMatrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource))) { + // return E_FAIL; + // } + // memcpy_s(SubResource.pData, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END), m_ReconstructedJointAnchorMatirces, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)); + // m_pContext->Unmap(m_pBoneCombinedMatrixBuffer, 0); + //} + //m_pModelCom->ComputeInsertionBoneBuffer(m_BoneInsertionDesc, m_pBoneCombinedMatrixSRV); return S_OK; } +HRESULT CPlayerRobe::Bind_PrevBoneMatrices(CShader* pShader, const _char* pConstant) +{ + HRESULT hr = E_FAIL; + hr = pShader->Bind_Matrices(pConstant, m_PrevRobeBoneMatrices.data(), m_iBoneNum); + m_pModelCom->Capture_BoneMatrices(ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END), m_PrevRobeBoneMatrices); + return hr; +} + HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld) { @@ -492,6 +504,12 @@ HRESULT CPlayerRobe::Initialize(void* pArg) m_pSocketMatrix = pDesc->pSocketMatrix; m_pModelCom = pDesc->pModel; + m_iBoneNum = m_pModelCom->Get_MeshInfluencedBoneNum(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)); + m_PrevRobeBoneMatrices.resize(m_iBoneNum); + if (FAILED(m_pModelCom->Capture_BoneMatrices(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH), m_PrevRobeBoneMatrices))) { + return E_FAIL; + } + m_pLeftFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("LeftFoot"); m_pLeftLegLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("LeftLeg"); m_pRightFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightFoot"); diff --git a/Jusin154_Team3D/Client/Public/PlayerRobe.h b/Jusin154_Team3D/Client/Public/PlayerRobe.h index b5ab2c13a..a69db83a4 100644 --- a/Jusin154_Team3D/Client/Public/PlayerRobe.h +++ b/Jusin154_Team3D/Client/Public/PlayerRobe.h @@ -32,6 +32,8 @@ class CPlayerRobe final : public CPartObject virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + HRESULT Update_RobeSocketPosition(); + HRESULT Bind_PrevBoneMatrices(CShader* pShader, const _char* pConstant); private: _float4x4 m_PreTransformMatrix = { }; const _float4x4* m_pSocketMatrix = { nullptr }; @@ -42,7 +44,8 @@ class CPlayerRobe final : public CPartObject const _float4x4* m_RobeJointAnchorMatrices[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr }; _float4x4 m_ReconstructedJointAnchorMatirces[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { }; - CModel* m_pModelCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + _int m_iBoneNum = -1; CRigidBody_Dynamic* m_pRightLeg = { nullptr }; CRigidBody_Dynamic* m_pLeftLeg = { nullptr }; CRigidBody_Dynamic* m_pRobeMainAnchor = { nullptr }; @@ -54,6 +57,7 @@ class CPlayerRobe final : public CPartObject ID3D11ShaderResourceView* m_pBoneCombinedMatrixSRV = { nullptr }; CModel::BONEINSERTION_DESC m_BoneInsertionDesc = {}; + vector<_float4x4> m_PrevRobeBoneMatrices = { }; #ifdef _DEBUG unique_ptr m_pMainShape = { nullptr }; unique_ptr m_pSubShape = { nullptr }; @@ -68,7 +72,6 @@ class CPlayerRobe final : public CPartObject HRESULT Bind_ShaderResources() { return S_OK; } HRESULT Update_LegsPosition(); - HRESULT Update_RobeSocketPosition(); HRESULT Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld); HRESULT Create_BoneCombinedMatrixSRV(); #ifdef _DEBUG diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index dfc581080..795020d19 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -185,7 +185,7 @@ PBR_LIGHT_OUT PBR_Lighting( float3 vAlbedo, float fMetallic, float fRoughness, float3 vLightColor, float fLightIntensity, float fAttenuation, float3 vFO ) { - PBR_LIGHT_OUT Out; + PBR_LIGHT_OUT Out = (PBR_LIGHT_OUT)0; Out.vShade = 0; Out.vSpecular = 0; float3 vLighting = vLightColor * fLightIntensity; @@ -195,8 +195,8 @@ PBR_LIGHT_OUT PBR_Lighting( float NdotV = saturate(dot(vNormal, vToView)); if (NdotL <= 0 || NdotV <= 0) { - Out.vShade = 0; - Out.vSpecular = 0; + Out.vShade = float3(0.f, 0.f, 0.f); + Out.vSpecular = float3(0.f, 0.f, 0.f); return Out; } @@ -507,12 +507,12 @@ float4 ApplyDissolve(Texture2D DisolveTexture, float fDisolveRatio, float fDisol bool IsValidUV(float2 uv) { - if (uv.x < 0 || uv.x >= 1 - || uv.y < 0 || uv.y >= 1) + bool bReturn = true; + if (uv.x < 0 || uv.x >= 1 || uv.y < 0 || uv.y >= 1) { - return false; + bReturn = false; } - return true; + return bReturn; } float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 vCenterTexCoord, sampler samplerLinear) @@ -567,9 +567,10 @@ float4 BlendDiffuse(float4 vDiffuseA, Texture2D DiffuseBlendTexture, float2 vTex } float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIntensity = 1.f) { + float2 vReturnVelocity = float2(0.5f, 0.5f); if (vCurrentProjPos.w <= FLT_EPSILON5 || vPreviousProjPos.w <= FLT_EPSILON5) { - return float2(0.5f, 0.5f); + return vReturnVelocity; } float2 currentNDC = vCurrentProjPos.xy / vCurrentProjPos.w; @@ -585,6 +586,10 @@ float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIn return velocityUV * 0.5f + 0.5f; // 0 속도 -> 0.5 } +float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos) +{ + return CalcVelocityUV(vCurrentProjPos, vPreviousProjPos, 1.0f); +} float3 DownSampleFast(Texture2D SrcTexture2D, float2 vCenterTexcoord, float2 vSrcTexelSize, float2 vResolution) { diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Blur.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Blur.hlsl index d160873e0..cf3b016a3 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Blur.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Blur.hlsl @@ -51,7 +51,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Cell.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Cell.hlsl index 2f1206ebc..22d06480f 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Cell.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Cell.hlsl @@ -17,7 +17,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index d1a19270a..390b85533 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -166,7 +166,7 @@ struct PS_OUT_VELOCITYTILE }; VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -180,7 +180,7 @@ VS_OUT VS_MAIN(VS_IN In) } VS_OUT VS_CAPTURE(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; float2 vClipPos = In.vPosition.xy * 2.0f; // → -1.0 ~ +1.0 @@ -191,7 +191,7 @@ VS_OUT VS_CAPTURE(VS_IN In) } VS_OUT VS_TONE_MAPPING(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -295,7 +295,7 @@ PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) vReferenceVelocityPixel = vBlurVeloPixel; } float fCenterSpreadLengthPixel = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, g_fMBBlurRadius); - + [loop] for (int iInterval = -iMaxRadius; iInterval <= iMaxRadius; ++iInterval) { float fOffset = (float) abs(iInterval); @@ -412,7 +412,7 @@ PS_OUT_VELOCITYTILE PS_MOTIONBLUR_TENTSAMPLE(PS_IN In) { vSampleUV.x = uv.x + vSrcTexelSize.x * i; vSampleUV.y = uv.y + vSrcTexelSize.y * j; - vSampleVel = g_VelocityTexture.Sample(ClampSampler, vSampleUV); + vSampleVel = g_VelocityTexture.Sample(ClampSampler, vSampleUV).xy; vSampleDiff = vSampleVel *2.f - 1.f; fSampleSpeed = length(vSampleDiff * g_vResolution * g_iMBTileSize); if (fSampleSpeed > vMaxSpeed) { @@ -804,7 +804,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) for (int iCol = -1; iCol < 2; ++iCol) { uv = In.vTexcoord + vTexcelSize * float2(iRow, iCol); if (true == IsValidUV(uv)) { - vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0); + vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0).xyz; fWeight += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol]; } } @@ -820,6 +820,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) float4 vSample = float4(0.f, 0.f, 0.f, 1.f); float fWeight = 0.f; float2 uv = float2(0.f, 0.f); + + [loop] for (int i = -15; i < 16; ++i) { uv.x = In.vTexcoord.x + ((float) i / g_vResolution.x); @@ -847,6 +849,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_COMBINE(PS_IN In) float4 vSample = float4(0.f, 0.f, 0.f, 1.f); float fWeight = 0.f; float2 uv = float2(0.f, 0.f); + + [loop] for (int i = -15; i < 16; ++i) { uv.x = In.vTexcoord.x; @@ -876,7 +880,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) float2 uv = In.vTexcoord; float fSrcAlpha = g_DiffuseTexture.Sample(PointSampler, uv).a; float2 vSrcTexelSize = float2(1.f / g_vSrcResolution.x, 1.f / g_vSrcResolution.y); - float3 vColor = (0.f, 0.f, 0.f); + float3 vColor = float3(0.f, 0.f, 0.f); vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vSrcResolution); @@ -897,7 +901,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_DOWNSAMPLE(PS_IN In) float2 uv = In.vTexcoord; float fSrcAlpha = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a; float2 vSrcTexelSize = float2(1.f / g_vSrcResolution.x, 1.f / g_vSrcResolution.y); - float3 vColor = (0.f, 0.f, 0.f); + float3 vColor = float3(0.f, 0.f, 0.f); vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vSrcResolution); @@ -987,6 +991,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) } float fAcc = 0.f; + [loop] for (int i = -16; i < 16; ++i) { vTexcoord.x = In.vTexcoord.x + ((float) i / g_vResolution.x) * fBlurAmount * g_fDOFBlurMultiplier; @@ -1078,6 +1083,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In) } float fAcc = 0.f; + [loop] for (int i = -16; i < 16; ++i) { vTexcoord.x = In.vTexcoord.x; @@ -1265,6 +1271,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In) float3x3 toViewTBNMatrix = float3x3(vTangent, vBiNormal, vCenterViewNormal); float fOcclusion = 0.f; + [loop] for (uint i = 0; i < g_iKernelSize; ++i) { float3 vViewSamplePosVec = mul(g_SamplePos[i].xyz, toViewTBNMatrix); // TANSPACE -> VIEW diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl index 0e7785bc6..4a649c8ad 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl @@ -20,7 +20,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 4012669d4..a444c00e5 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -72,7 +72,8 @@ Texture2D g_DeadDisolveTexture; Texture2D g_DeadDisolveBurnTexture; int g_iBinded_Texture[27]; -matrix g_BoneMatrices[512]; +matrix g_BoneMatrices[256]; +matrix g_PrevBoneMatrices[256]; struct VS_IN_MESH { @@ -107,7 +108,7 @@ struct VS_OUT }; VS_OUT VS_MAIN_MESH(VS_IN_MESH In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; matWV = mul(g_WorldMatrix, g_ViewMatrix); @@ -130,7 +131,7 @@ VS_OUT VS_MAIN_MESH(VS_IN_MESH In) VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; float4 w = In.vBlendWeight; float sumW = max(dot(w, 1.0f), 1e-6f); @@ -182,9 +183,63 @@ VS_OUT VS_MAIN(VS_IN In) return Out; } +VS_OUT VS_MAIN_LEGACY(VS_IN In) +{ + VS_OUT Out = (VS_OUT)0; + + float4 w = In.vBlendWeight; + float sumW = max(dot(w, 1.0f), 1e-6f); + w /= sumW; + + matrix BoneMatrix = + mul(g_OffsetMatrix[In.vBlendIndex.x], + mul(g_BoneMatrices[In.vBlendIndex.x], w.x)) + + mul(g_OffsetMatrix[In.vBlendIndex.y], + mul(g_BoneMatrices[In.vBlendIndex.y], w.y)) + + mul(g_OffsetMatrix[In.vBlendIndex.z], + mul(g_BoneMatrices[In.vBlendIndex.z], w.z)) + + mul(g_OffsetMatrix[In.vBlendIndex.w], + mul(g_BoneMatrices[In.vBlendIndex.w], w.w)); + + matrix PrevBoneMatrix = + mul(g_OffsetMatrix[In.vBlendIndex.x], + mul(g_PrevBoneMatrices[In.vBlendIndex.x], w.x)) + + mul(g_OffsetMatrix[In.vBlendIndex.y], + mul(g_PrevBoneMatrices[In.vBlendIndex.y], w.y)) + + mul(g_OffsetMatrix[In.vBlendIndex.z], + mul(g_PrevBoneMatrices[In.vBlendIndex.z], w.z)) + + mul(g_OffsetMatrix[In.vBlendIndex.w], + mul(g_PrevBoneMatrices[In.vBlendIndex.w], w.w)); + + vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix); + vector vPrevPosition = mul(vector(In.vPosition, 1.f), PrevBoneMatrix); + vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix); + vector vBinormal = mul(vector(In.vBinormal, 0.f), BoneMatrix); + vector vTangent = mul(vector(In.vTangent, 0.f), BoneMatrix); + + + matrix matWV, matWVP; + matWV = mul(g_WorldMatrix, g_ViewMatrix); + matWVP = mul(matWV, g_ProjMatrix); + + matrix matPrevWV, matPrevWVP; + matPrevWV = mul(g_PrevWorldMatrix, g_PrevViewMatrix); + matPrevWVP = mul(matPrevWV, g_PrevProjMatrix); + + Out.vPosition = mul(vPosition, matWVP); + Out.vNormal = normalize(mul(vNormal, g_WorldMatrix)).xyz; + Out.vBinormal = normalize(mul(vBinormal, g_WorldMatrix)).xyz; + Out.vTangent = normalize(mul(vTangent, g_WorldMatrix)).xyz; + Out.vTexcoord = In.vTexcoord; + Out.vWorldPos = mul(vPosition, g_WorldMatrix); + Out.vProjPos = Out.vPosition; + Out.vPrevProjPos = mul(vPrevPosition, matPrevWVP); + return Out; +} + VS_OUT VS_MAIN_OUTLINE_READ(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; float4 w = In.vBlendWeight; float sumW = max(dot(w, 1.0f), 1e-6f); @@ -331,9 +386,9 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE_READ(PS_IN In) Out.vAlbedo = float4(g_vOutLineColor.rgb, fRim); Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); - Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 源딆씠 ( 0~ 1) - (In.vProjPos.w / g_fFar), // 酉??ㅽ럹?댁뒪 Z - (float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, // ?쒗럹?댁뒪 ?뚮씪誘명꽣 + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), + (In.vProjPos.w / g_fFar), + (float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 0.f); Out.vSurface = float4(0.5f, 1.f, 1.f, 0.f); @@ -367,7 +422,7 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) float SpecMask = vTHV_Mask.g; float AoMask_Thv = vTHV_Mask.b; - float3 vColorRoot = vDAO_Mask.rgb * 0.6f; + float3 vColorRoot = vDAO_Mask.rgb.rgb * 0.6f; float3 vColorTip = vDAO_Mask.rgb; float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); @@ -481,8 +536,8 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) float SpecMask = vTHV_Mask.g; float AoMask_Thv = vTHV_Mask.b; - float3 vColorRoot = vDAO_Mask * 0.6f; - float3 vColorTip = vDAO_Mask; + float3 vColorRoot = vDAO_Mask.rgb * 0.6f; + float3 vColorTip = vDAO_Mask.rgb; float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); @@ -525,16 +580,16 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) float SpecMask = vTHV_Mask.g; float AoMask_Thv = vTHV_Mask.b; - float3 vColorRoot = vDAO_Mask * 0.6f; - float3 vColorTip = vDAO_Mask; + float3 vColorRoot = vDAO_Mask.rgb * 0.6f; + float3 vColorTip = vDAO_Mask.rgb; float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); Out.vAlbedo = float4(vBaseColor, AlphaMask); Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); - Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 源딆씠 ( 0~ 1) - (In.vProjPos.w / g_fFar), // 酉??ㅽ럹?댁뒪 Z - (float) AI_TEXTURE_TYPE_SPECULAR / (float) AI_TEXTURE_TYPE_MAX, // ?쒗럹?댁뒪 ?뚮씪誘명꽣 + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), + (In.vProjPos.w / g_fFar), + (float) AI_TEXTURE_TYPE_SPECULAR / (float) AI_TEXTURE_TYPE_MAX, 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); @@ -1423,7 +1478,7 @@ technique11 DefaultTechnique SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); + VertexShader = compile vs_5_0 VS_MAIN_LEGACY(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_Suit_DSRON_ToSRO(); } @@ -1450,7 +1505,7 @@ technique11 DefaultTechnique SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); + VertexShader = compile vs_5_0 VS_MAIN_LEGACY(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_Robe_ToMRO(); } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index e140c5400..a15e12766 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -93,7 +93,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl index 9787c2689..c2831f238 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl @@ -46,7 +46,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matVP = mul(g_ViewMatrix, g_ProjMatrix); float3 vLocalPos = In.vPosition; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index e874b3846..4878c28f7 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl @@ -114,7 +114,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; float4 w = In.vBlendWeight; float sumW = max(dot(w, 1.0f), 1e-6f); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index 2f7db8a65..204be5929 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -198,7 +198,7 @@ VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In) } VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; matWV = mul(g_WorldMatrix, g_ViewMatrix); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl index 09922aeb0..078ca29b8 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl @@ -38,7 +38,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPointParticle.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPointParticle.hlsl index cb9394530..3c6706c19 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPointParticle.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPointParticle.hlsl @@ -32,7 +32,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; vector vPosition = mul(vector(In.vPosition, 1.f), In.TransformMatrix); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl index a9edbee3d..4a9228523 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl @@ -24,7 +24,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl index 3ddfd3a5e..82fa5d8df 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl @@ -84,7 +84,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; @@ -104,7 +104,7 @@ VS_OUT VS_MAIN(VS_IN In) VS_OUT VS_TRAIL(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWVP; @@ -297,7 +297,7 @@ float4 EmissiveDraw(PS_IN In) PS_TRAILOUT PS_Trail(PS_IN In) { - PS_TRAILOUT Out; + PS_TRAILOUT Out = (PS_TRAILOUT)0; int2 iTexel = int2(In.vPosition.xy); @@ -367,7 +367,7 @@ struct PS_BLOOM_OUT PS_BLUR_OUT PS_TRAIL_BLOOM(PS_IN In) { - PS_BLUR_OUT Out; + PS_BLUR_OUT Out = (PS_BLUR_OUT)0; vector vMtrlDiffuse; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl index fafedfbf1..88e7510c3 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl @@ -20,7 +20,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -51,7 +51,7 @@ PS_OUT PS_MAIN(PS_IN In) vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord); - float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord); + float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord).r; Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage); diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 6df53479c..99dacd8e8 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -437,6 +437,7 @@ call Update_Shaders.bat + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 8b16cb5f8..f6fcb7a17 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -2089,6 +2089,9 @@ 02.GameObjects\Layer_Effect\Effect\Monster_Effect\Ranrok\Breath + + 01.Level\00.Loading\Loader + diff --git a/Jusin154_Team3D/Editor/Private/DummyObject.cpp b/Jusin154_Team3D/Editor/Private/DummyObject.cpp index 5924e3c82..8269d9de7 100644 --- a/Jusin154_Team3D/Editor/Private/DummyObject.cpp +++ b/Jusin154_Team3D/Editor/Private/DummyObject.cpp @@ -87,13 +87,13 @@ if (m_pModelCom->Get_Type() == MODEL::PBR_ANIM) if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } - - m_pModelCom->Bind_OutPut_SRV_VS(26, 0); - m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); if (FAILED(Bind_ShaderParameters(i))) { return E_FAIL; } + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + } else { diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 9a829c69d..412983bd9 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2338,334 +2338,6 @@ future*> CLoader::Deferred_ModelLoad(MODEL eType, const return m_pGameInstance->EnqueueJob(&Deferred_ModelLoad_Main, m_pDevice, m_pContext, eType, pDirectoryPath, pPrototypeTag, PreTransform); } -HRESULT CLoader::Loading_For_ObjectViewer() -{ - m_strMessage = TEXT("Texture Loading.."); - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_NPC_PBR_ANIM, - CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl"), - VTXANIMMESH::Elements, VTXANIMMESH::iNumElements)))) { - return E_FAIL; - } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"), - CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) { - return E_FAIL; - } - - m_strMessage = TEXT("Model Loading.."); - - // Heavy Wall - CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; - { - Desc.eType = ACTOR::BOX; - Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; - Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; - Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; - Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; - Desc.fContactOffset = { 0.05f }; - Desc.vhalfGeometryInfo = { 2.5f, 4.5f, 3.5f }; - Desc.fDensity = 10.f; - Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); - Desc.eLockFlag = {}; - Desc.vAutoDamping = { 100.f, 100.f }; - Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; - Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; - } - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { - return E_FAIL; - } - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { - return E_FAIL; - } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { - return E_FAIL; - } - vector*>> futures = {}; - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Anim_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM_LOCAL, "C:/MeshTable\\Game\\RiggedObjects\\Props\\Weapons\\Goblins\\SK_WPN_GOB_SmallSword.fbx", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) - return E_FAIL; - - -#pragma region MONSTER - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Goblin_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin_Mage/GoblinMage.bin", XMMatrixRotationY(XMConvertToRadians(180.f))* XMMatrixIdentity(), - TEXT("Prototype_Component_GoblinMage_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/Goblin_Assassin/SK_GOB_M_Assassin_Master.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_SK_GOB_M_Assassin_Master_Model") - )); - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) - return E_FAIL; - - //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Playable_Model"), - // CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) - // return E_FAIL; - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/TombProtector/TombProtector.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), - TEXT("Prototype_Component_TombProtector_Model") - )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_troll_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/Dragon/Dragon.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), - TEXT("Prototype_Component_Dragon_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_ConjuredDragon_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Professor_EleazarFig_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Ghost_Peeves_Model") - )); - - -#pragma endregion - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Object/Troll_Weapon/Troll_Weapon.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), - TEXT("Prototype_Component_Troll_Weapon_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/Object/Troll_Rock/Troll_Rock.bin",XMMatrixIdentity(), - TEXT("Prototype_Component_Troll_Rock_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/Object/Troll_Rock/Troll_Rock_Big.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f)* XMMatrixIdentity(), - TEXT("Prototype_Component_Troll_Rock_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/Object/Goblin_Dagger/Goblin_Dagger.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f)* XMMatrixIdentity(), - TEXT("Prototype_Component_Dagger_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/Npc.bin", XMMatrixRotationY(XMConvertToRadians(180.f))* XMMatrixIdentity(), - TEXT("Prototype_Component_Npc_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin",XMMatrixIdentity(), - TEXT("Prototype_Component_Wand_Model") - )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Broom_Model") - )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_SkyboxModel") - )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity(), - TEXT("Desc_Box") - )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_GerboldOlivander_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_VictorRookWood_Model") - )); - - futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable.bin",XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Playable_Model") - )); - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_CCL_CameraRig.001_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) - return E_FAIL; - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Sneak.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Bm.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Broom.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Lightning.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Protego.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Spell_Learning.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Spawn.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_AvadaKedavra.fbx", XMMatrixIdentity(), - // TEXT("Prototype_Component_Student_Cmbt_Model") - //)); - - for (auto& job : futures) { - pair<_wstring, CModel*>* pResult = job.get(); - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, pResult->first, pResult->second))) { - assert(false); - return E_FAIL; - } - Safe_Delete(pResult); - } - - - m_strMessage = TEXT("Shader Loading.."); - - m_strMessage = TEXT("Prototype Loading.."); - - ///* For.Prototype_Component_VIBuffer_Terrain */ - //if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), - // CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) - // return E_FAIL; - - /* For.Prototype_GameObject_RootModelPart */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CRootModelPart::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Body */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBody::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Head */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CHead::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Hair */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CHair::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_DummyObject */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummyObject::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_DummySkyBox */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummySkyBox::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - ///* For.Prototype_GameObject_Terrain */ - //if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext)))) - // return E_FAIL; - - /* For.Prototype_Component_FSM */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CFSM::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Player */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPlayer::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Goblin */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Broom */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Camera_Gaze */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Gaze::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_CamPosition_Player */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Socket::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_CamPosition_Shoulder */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Shoulder::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_CamPosition_Target */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Target::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_CamPosition_Arm */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Arm::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - /* For.Prototype_GameObject_Wand */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrail::Create(m_pDevice, m_pContext)))) { - return E_FAIL; - } - - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrailObject::Create(m_pDevice, m_pContext)))) { - return E_FAIL; - } - - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBombard::Create(m_pDevice, m_pContext)))) { - return E_FAIL; - } - - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CEffectPool::Create(m_pDevice, m_pContext)))) - return E_FAIL; - - m_strMessage = TEXT("Loading Success!"); - - m_isFinished = true; - - return S_OK; -} - - HRESULT CLoader::Loading_For_MapViewer() { #pragma region PLAYER_AND_RANROK diff --git a/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp new file mode 100644 index 000000000..affe73a84 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp @@ -0,0 +1,358 @@ +#include "pch.h" +#include "GameInstance.h" +#include "Loader.h" + +#pragma region EFFECT_HEADER + +#include "TrailObject.h" +#include "Bombard.h" +#include "EffectPool.h" +#pragma endregion + +#pragma region OBJECT_HEADER +#include "RootModelPart.h" +#include "Head.h" +#include "Body.h" +#include "Hair.h" +#include "DummySkyBox.h" +#include "DummyObject.h" +#include "Player.h" +#include "Goblin.h" +#include "Broom.h" +#include "Camera_Gaze.h" +#include "CamPosition_Socket.h" +#include "CamPosition_Target.h" +#include "CamPosition_Shoulder.h" +#include "CamPosition_Arm.h" +#include "Wand.h" + +#pragma endregion + +HRESULT CLoader::Loading_For_ObjectViewer() +{ + m_strMessage = TEXT("Texture Loading.."); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_NPC_PBR_ANIM, + CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl"), + VTXANIMMESH::Elements, VTXANIMMESH::iNumElements)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) { + return E_FAIL; + } + + m_strMessage = TEXT("Model Loading.."); + + // Heavy Wall + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + { + Desc.eType = ACTOR::BOX; + Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; + Desc.fContactOffset = { 0.05f }; + Desc.vhalfGeometryInfo = { 2.5f, 4.5f, 3.5f }; + Desc.fDensity = 10.f; + Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); + Desc.eLockFlag = {}; + Desc.vAutoDamping = { 100.f, 100.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + vector*>> futures = {}; + + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Anim_Model"), + // CModel::Create(m_pDevice, m_pContext, MODEL::ANIM_LOCAL, "C:/MeshTable\\Game\\RiggedObjects\\Props\\Weapons\\Goblins\\SK_WPN_GOB_SmallSword.fbx", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + // return E_FAIL; + + +#pragma region MONSTER + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Goblin_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin_Mage/GoblinMage.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_GoblinMage_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/Goblin_Assassin/SK_GOB_M_Assassin_Master.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_SK_GOB_M_Assassin_Master_Model") + )); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinSpector_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + return E_FAIL; + + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Playable_Model"), + // CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + // return E_FAIL; + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/TombProtector/TombProtector.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_TombProtector_Model") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_troll_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/Dragon/Dragon.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_Dragon_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_ConjuredDragon_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Professor_EleazarFig_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Ghost_Peeves_Model") + )); + + +#pragma endregion + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Object/Troll_Weapon/Troll_Weapon.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_Troll_Weapon_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::NONANIM, "../Bin/Resources/Models/Object/Troll_Rock/Troll_Rock.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_Troll_Rock_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::NONANIM, "../Bin/Resources/Models/Object/Troll_Rock/Troll_Rock_Big.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_Troll_Rock_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::NONANIM, "../Bin/Resources/Models/Object/Goblin_Dagger/Goblin_Dagger.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_Dagger_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/Npc.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Npc_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_Wand_Model") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Broom_Model") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_SkyboxModel") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity(), + TEXT("Desc_Box") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_GerboldOlivander_Model") + )); + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_VictorRookWood_Model") + )); + + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_CCL_CameraRig.001_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/CCL_CameraRig.001.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) + return E_FAIL; + + futures.emplace_back(Deferred_ModelLoad( + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Playable_Model") + )); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Rct.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Sneak.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Bm.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Broom.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Lightning.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Protego.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Spell_Learning.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_Spawn.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Human/PlayableCharacter/Playable_AvadaKedavra.fbx", XMMatrixIdentity(), + // TEXT("Prototype_Component_Student_Cmbt_Model") + //)); + + for (auto& job : futures) { + pair<_wstring, CModel*>* pResult = job.get(); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, pResult->first, pResult->second))) { + assert(false); + return E_FAIL; + } + Safe_Delete(pResult); + } + + + m_strMessage = TEXT("Shader Loading.."); + + m_strMessage = TEXT("Prototype Loading.."); + + ///* For.Prototype_Component_VIBuffer_Terrain */ + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), + // CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) + // return E_FAIL; + + /* For.Prototype_GameObject_RootModelPart */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CRootModelPart::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Body */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBody::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Head */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CHead::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Hair */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CHair::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_DummyObject */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummyObject::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_DummySkyBox */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummySkyBox::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + ///* For.Prototype_GameObject_Terrain */ + //if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext)))) + // return E_FAIL; + + /* For.Prototype_Component_FSM */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CFSM::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Player */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPlayer::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Goblin */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Broom */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Camera_Gaze */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Gaze::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_CamPosition_Player */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Socket::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_CamPosition_Shoulder */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Shoulder::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_CamPosition_Target */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Target::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_CamPosition_Arm */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Arm::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_Wand */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrail::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrailObject::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBombard::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CEffectPool::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + m_strMessage = TEXT("Loading Success!"); + + m_isFinished = true; + + return S_OK; +} + diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index dfc581080..795020d19 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -185,7 +185,7 @@ PBR_LIGHT_OUT PBR_Lighting( float3 vAlbedo, float fMetallic, float fRoughness, float3 vLightColor, float fLightIntensity, float fAttenuation, float3 vFO ) { - PBR_LIGHT_OUT Out; + PBR_LIGHT_OUT Out = (PBR_LIGHT_OUT)0; Out.vShade = 0; Out.vSpecular = 0; float3 vLighting = vLightColor * fLightIntensity; @@ -195,8 +195,8 @@ PBR_LIGHT_OUT PBR_Lighting( float NdotV = saturate(dot(vNormal, vToView)); if (NdotL <= 0 || NdotV <= 0) { - Out.vShade = 0; - Out.vSpecular = 0; + Out.vShade = float3(0.f, 0.f, 0.f); + Out.vSpecular = float3(0.f, 0.f, 0.f); return Out; } @@ -507,12 +507,12 @@ float4 ApplyDissolve(Texture2D DisolveTexture, float fDisolveRatio, float fDisol bool IsValidUV(float2 uv) { - if (uv.x < 0 || uv.x >= 1 - || uv.y < 0 || uv.y >= 1) + bool bReturn = true; + if (uv.x < 0 || uv.x >= 1 || uv.y < 0 || uv.y >= 1) { - return false; + bReturn = false; } - return true; + return bReturn; } float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 vCenterTexCoord, sampler samplerLinear) @@ -567,9 +567,10 @@ float4 BlendDiffuse(float4 vDiffuseA, Texture2D DiffuseBlendTexture, float2 vTex } float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIntensity = 1.f) { + float2 vReturnVelocity = float2(0.5f, 0.5f); if (vCurrentProjPos.w <= FLT_EPSILON5 || vPreviousProjPos.w <= FLT_EPSILON5) { - return float2(0.5f, 0.5f); + return vReturnVelocity; } float2 currentNDC = vCurrentProjPos.xy / vCurrentProjPos.w; @@ -585,6 +586,10 @@ float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIn return velocityUV * 0.5f + 0.5f; // 0 속도 -> 0.5 } +float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos) +{ + return CalcVelocityUV(vCurrentProjPos, vPreviousProjPos, 1.0f); +} float3 DownSampleFast(Texture2D SrcTexture2D, float2 vCenterTexcoord, float2 vSrcTexelSize, float2 vResolution) { diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Blur.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Blur.hlsl index d160873e0..cf3b016a3 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Blur.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Blur.hlsl @@ -51,7 +51,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Cell.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Cell.hlsl index 2f1206ebc..22d06480f 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Cell.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Cell.hlsl @@ -17,7 +17,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index d1a19270a..390b85533 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -166,7 +166,7 @@ struct PS_OUT_VELOCITYTILE }; VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -180,7 +180,7 @@ VS_OUT VS_MAIN(VS_IN In) } VS_OUT VS_CAPTURE(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; float2 vClipPos = In.vPosition.xy * 2.0f; // → -1.0 ~ +1.0 @@ -191,7 +191,7 @@ VS_OUT VS_CAPTURE(VS_IN In) } VS_OUT VS_TONE_MAPPING(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -295,7 +295,7 @@ PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) vReferenceVelocityPixel = vBlurVeloPixel; } float fCenterSpreadLengthPixel = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, g_fMBBlurRadius); - + [loop] for (int iInterval = -iMaxRadius; iInterval <= iMaxRadius; ++iInterval) { float fOffset = (float) abs(iInterval); @@ -412,7 +412,7 @@ PS_OUT_VELOCITYTILE PS_MOTIONBLUR_TENTSAMPLE(PS_IN In) { vSampleUV.x = uv.x + vSrcTexelSize.x * i; vSampleUV.y = uv.y + vSrcTexelSize.y * j; - vSampleVel = g_VelocityTexture.Sample(ClampSampler, vSampleUV); + vSampleVel = g_VelocityTexture.Sample(ClampSampler, vSampleUV).xy; vSampleDiff = vSampleVel *2.f - 1.f; fSampleSpeed = length(vSampleDiff * g_vResolution * g_iMBTileSize); if (fSampleSpeed > vMaxSpeed) { @@ -804,7 +804,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) for (int iCol = -1; iCol < 2; ++iCol) { uv = In.vTexcoord + vTexcelSize * float2(iRow, iCol); if (true == IsValidUV(uv)) { - vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0); + vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0).xyz; fWeight += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol]; } } @@ -820,6 +820,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) float4 vSample = float4(0.f, 0.f, 0.f, 1.f); float fWeight = 0.f; float2 uv = float2(0.f, 0.f); + + [loop] for (int i = -15; i < 16; ++i) { uv.x = In.vTexcoord.x + ((float) i / g_vResolution.x); @@ -847,6 +849,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_COMBINE(PS_IN In) float4 vSample = float4(0.f, 0.f, 0.f, 1.f); float fWeight = 0.f; float2 uv = float2(0.f, 0.f); + + [loop] for (int i = -15; i < 16; ++i) { uv.x = In.vTexcoord.x; @@ -876,7 +880,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) float2 uv = In.vTexcoord; float fSrcAlpha = g_DiffuseTexture.Sample(PointSampler, uv).a; float2 vSrcTexelSize = float2(1.f / g_vSrcResolution.x, 1.f / g_vSrcResolution.y); - float3 vColor = (0.f, 0.f, 0.f); + float3 vColor = float3(0.f, 0.f, 0.f); vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vSrcResolution); @@ -897,7 +901,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_DOWNSAMPLE(PS_IN In) float2 uv = In.vTexcoord; float fSrcAlpha = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a; float2 vSrcTexelSize = float2(1.f / g_vSrcResolution.x, 1.f / g_vSrcResolution.y); - float3 vColor = (0.f, 0.f, 0.f); + float3 vColor = float3(0.f, 0.f, 0.f); vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vSrcResolution); @@ -987,6 +991,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) } float fAcc = 0.f; + [loop] for (int i = -16; i < 16; ++i) { vTexcoord.x = In.vTexcoord.x + ((float) i / g_vResolution.x) * fBlurAmount * g_fDOFBlurMultiplier; @@ -1078,6 +1083,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In) } float fAcc = 0.f; + [loop] for (int i = -16; i < 16; ++i) { vTexcoord.x = In.vTexcoord.x; @@ -1265,6 +1271,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In) float3x3 toViewTBNMatrix = float3x3(vTangent, vBiNormal, vCenterViewNormal); float fOcclusion = 0.f; + [loop] for (uint i = 0; i < g_iKernelSize; ++i) { float3 vViewSamplePosVec = mul(g_SamplePos[i].xyz, toViewTBNMatrix); // TANSPACE -> VIEW diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl index 0e7785bc6..4a649c8ad 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Distortion.hlsl @@ -20,7 +20,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl index fafedfbf1..88e7510c3 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl @@ -20,7 +20,7 @@ struct VS_OUT VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out; + VS_OUT Out = (VS_OUT)0; matrix matWV, matWVP; @@ -51,7 +51,7 @@ PS_OUT PS_MAIN(PS_IN In) vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord); - float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord); + float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord).r; Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage); diff --git a/Jusin154_Team3D/Engine/Private/Mesh.cpp b/Jusin154_Team3D/Engine/Private/Mesh.cpp index 8b5a1b518..dcd9330ad 100644 --- a/Jusin154_Team3D/Engine/Private/Mesh.cpp +++ b/Jusin154_Team3D/Engine/Private/Mesh.cpp @@ -1,9 +1,8 @@ #include "pch.h" +#include "Bone.h" #include "Mesh.h" #include "Model.h" -#include "Bone.h" #include "Shader.h" -#include "ComputeShader.h" CMesh::CMesh(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CVIBuffer{ pDevice, pContext } { @@ -55,6 +54,16 @@ HRESULT CMesh::Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint m_pContext->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation); return S_OK; } + +HRESULT CMesh::Copy_BoneMatrices(vector<_float4x4>& pDestination) +{ + if (pDestination.size() != m_iNumBones) { + return E_FAIL; + } + memcpy_s(pDestination.data(), sizeof(_float4x4) * m_iNumBones, m_pBoneMatrices, sizeof(_float4x4) * m_iNumBones); + return S_OK; +} + #ifdef EDITOR_PROJECT HRESULT CMesh::Initialize_Prototype(MODEL eType, vector& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix) { @@ -591,6 +600,11 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(vector& Bones, const ai m_pBoneMatrices = new _float4x4[0 == m_iNumBones ? 1 : m_iNumBones]; ZeroMemory(m_pBoneMatrices, sizeof(_float4x4) * m_iNumBones); + _float fMinimumEffectiveWeight = 0.0001f; + + vector> influencesPerVertex; + influencesPerVertex.resize(m_iNumVertices); + _float4x4 OffSetMatrix; XMStoreFloat4x4(&OffSetMatrix, XMMatrixIdentity()); @@ -612,22 +626,59 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(vector& Bones, const ai for (_uint j = 0; j < iNumWeight; ++j) { aiVertexWeight AIWeight = pAIBone->mWeights[j]; - if (0.f == pVertices[AIWeight.mVertexId].vBlendWeight.x) { - pVertices[AIWeight.mVertexId].vBlendIndex.x = i; - pVertices[AIWeight.mVertexId].vBlendWeight.x = AIWeight.mWeight; + const aiVertexWeight& aiWeight = pAIBone->mWeights[j]; + + if (aiWeight.mVertexId >= m_iNumVertices) { + continue; } - else if (0.f == pVertices[AIWeight.mVertexId].vBlendWeight.y) { - pVertices[AIWeight.mVertexId].vBlendIndex.y = i; - pVertices[AIWeight.mVertexId].vBlendWeight.y = AIWeight.mWeight; - } - else if (0.f == pVertices[AIWeight.mVertexId].vBlendWeight.z) { - pVertices[AIWeight.mVertexId].vBlendIndex.z = i; - pVertices[AIWeight.mVertexId].vBlendWeight.z = AIWeight.mWeight; - } - else { - pVertices[AIWeight.mVertexId].vBlendIndex.w = i; - pVertices[AIWeight.mVertexId].vBlendWeight.w = AIWeight.mWeight; + + if (aiWeight.mWeight < fMinimumEffectiveWeight) { + continue; } + + influencesPerVertex[aiWeight.mVertexId].push_back( + SaveBoneWeight{ i, aiWeight.mWeight } + ); + } + } + for (_uint iVertexIndex = 0; iVertexIndex < m_iNumVertices; ++iVertexIndex) + { + vector& influences = influencesPerVertex[iVertexIndex]; + + if (influences.empty()) { + continue; + } + + sort( influences.begin(), influences.end(), [] + (const SaveBoneWeight& left, const SaveBoneWeight& right) { + return left.Weight > right.Weight; + }); + + // 상위 4개만 선택 + _uint selectedCount = min<_uint>(4, static_cast<_uint>(influences.size())); + + pVertices[iVertexIndex].vBlendIndex = XMUINT4(0, 0, 0, 0); + pVertices[iVertexIndex].vBlendWeight = _float4(0.f, 0.f, 0.f, 0.f); + + float totalWeight = 0.f; + for (_uint iSelectedIndex = 0; iSelectedIndex < selectedCount; ++iSelectedIndex) + { + SaveBoneWeight& influence = influences[iSelectedIndex]; + + if (iSelectedIndex == 0) { pVertices[iVertexIndex].vBlendIndex.x = influence.VertexId; pVertices[iVertexIndex].vBlendWeight.x = influence.Weight; } + if (iSelectedIndex == 1) { pVertices[iVertexIndex].vBlendIndex.y = influence.VertexId; pVertices[iVertexIndex].vBlendWeight.y = influence.Weight; } + if (iSelectedIndex == 2) { pVertices[iVertexIndex].vBlendIndex.z = influence.VertexId; pVertices[iVertexIndex].vBlendWeight.z = influence.Weight; } + if (iSelectedIndex == 3) { pVertices[iVertexIndex].vBlendIndex.w = influence.VertexId; pVertices[iVertexIndex].vBlendWeight.w = influence.Weight; } + + totalWeight += influence.Weight; + } + + if (totalWeight > 0.f) + { + pVertices[iVertexIndex].vBlendWeight.x /= totalWeight; + pVertices[iVertexIndex].vBlendWeight.y /= totalWeight; + pVertices[iVertexIndex].vBlendWeight.z /= totalWeight; + pVertices[iVertexIndex].vBlendWeight.w /= totalWeight; } } if (0 == m_iNumBones) { diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index a9784e5a2..99cad7dad 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -1,12 +1,12 @@ #include "pch.h" -#include "Model.h" -#include "Bone.h" -#include "Mesh.h" -#include "Material.h" #include "Animation.h" -#include "GameObject.h" -#include "Transform.h" +#include "Bone.h" #include "ComputeShader.h" +#include "GameObject.h" +#include "Material.h" +#include "Mesh.h" +#include "Model.h" +#include "Transform.h" CModel::CModel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CComponent{ pDevice, pContext } @@ -119,6 +119,22 @@ HRESULT CModel::Bind_BoneMatrices(_uint iMeshIndex, CShader* pShader, const _cha return m_Meshes[iMeshIndex]->Bind_BoneMatrices(m_Bones, pShader, pConstantName); } +HRESULT CModel::Capture_BoneMatrices(_uint iMeshIndex, vector<_float4x4>& pDestination) +{ + if (iMeshIndex >= m_iNumMeshes) { + return E_FAIL; + } + return m_Meshes[iMeshIndex]->Copy_BoneMatrices(pDestination); +} + +_int CModel::Get_MeshInfluencedBoneNum(_uint iMeshIndex) +{ + if (iMeshIndex >= m_iNumMeshes) { + return E_FAIL; + } + return m_Meshes[iMeshIndex]->Get_NumBone(); +} + _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform) { if (!m_bPlayAnim){ @@ -699,6 +715,16 @@ HRESULT CModel::Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix return S_OK; } +//HRESULT CModel::Set_BoneLocalTransformationMatrix(const _char* pBoneName, _fmatrix newTransformation) +//{ +// _int iBoneIndex = Find_BoneIndex(pBoneName); +// if (iBoneIndex < 0) { +// return E_FAIL; +// } +// m_Bones[iBoneIndex]->Set_TransformationMatrix(newTransformation); +// return S_OK; +//} + void CModel::Set_CurrentTrackPosition(_float TrackPosition) { diff --git a/Jusin154_Team3D/Engine/Public/Mesh.h b/Jusin154_Team3D/Engine/Public/Mesh.h index 9110f48d3..2fc002147 100644 --- a/Jusin154_Team3D/Engine/Public/Mesh.h +++ b/Jusin154_Team3D/Engine/Public/Mesh.h @@ -22,6 +22,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer HRESULT Bind_BoneMatrices(const vector& Bones, class CShader* pShader, const _char* pConstantName); HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName); HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation); + HRESULT Copy_BoneMatrices(vector<_float4x4>& pDestination); #ifdef EDITOR_PROJECT private: virtual HRESULT Initialize_Prototype(MODEL eType, vector& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix); diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index ae82cd7ac..b6da518ac 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -95,6 +95,9 @@ class ENGINE_DLL CModel final : public CComponent #pragma endregion #pragma region Mesh const _char* Get_MeshName(_uint iIndex); + HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName); + HRESULT Capture_BoneMatrices(_uint iMeshIndex, vector<_float4x4>& pDestination); + _int Get_MeshInfluencedBoneNum(_uint iMeshIndex); _uint Get_NumMeshes() const { return m_iNumMeshes; } void Update_RootBone(_float Amount = 1.f); void Initialize_RootBone(); @@ -104,19 +107,19 @@ class ENGINE_DLL CModel final : public CComponent void Mark_CPUChain(_int boneIdx); #pragma endregion #pragma region Bone - HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName); - const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName); - _matrix Get_BoneMatrix(const _char* pBoneName); - _matrix Get_BoneMatrix(const _char* pBoneName) const; - const _float4x4* Get_BoneLocalMatrixPtr(const _char* pBoneName); - _matrix Get_BoneLocalMatrix(const _char* pBoneName) const; - static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 ) - _int Get_BoneIndex(const _char* pBoneName) const; - _matrix Get_BoneMatrix(_uint iBoneIndex); - void Combined_BoneMatrix(); - void Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount); - _int Find_BoneIndex(const _char* pBoneName); - HRESULT Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation); + const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName); + _matrix Get_BoneMatrix(const _char* pBoneName); + _matrix Get_BoneMatrix(const _char* pBoneName) const; + const _float4x4* Get_BoneLocalMatrixPtr(const _char* pBoneName); + _matrix Get_BoneLocalMatrix(const _char* pBoneName) const; + static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 ) + _int Get_BoneIndex(const _char* pBoneName) const; + _matrix Get_BoneMatrix(_uint iBoneIndex); + void Combined_BoneMatrix(); + void Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount); + _int Find_BoneIndex(const _char* pBoneName); + HRESULT Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation); +// HRESULT Set_BoneLocalTransformationMatrix(const _char* pBoneName, _fmatrix newTransformation); #pragma endregion #pragma region Material