From 2b4658c89b37fdda0e2e6060116aeac7cdbeebf7 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 4 Jan 2026 07:07:08 +0900 Subject: [PATCH 1/4] [add] shadow [fix] Wrong Call --- Jusin154_Team3D/Client/Default/Client.cpp | 26 ------------------- .../Client/Private/Goblin_Assassin.cpp | 15 +---------- .../Client/Private/NPC_EleazarFig.cpp | 2 +- .../Client/Private/NPC_Ollivander.cpp | 2 +- Jusin154_Team3D/Client/Private/Player.cpp | 2 -- Jusin154_Team3D/Client/Private/PlayerRobe.cpp | 2 +- Jusin154_Team3D/Client/Private/Ranrok.cpp | 2 +- Jusin154_Team3D/Client/Private/Troll.cpp | 2 +- .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 8 +++--- .../Engine/Private/PhysX_Manager.cpp | 4 +++ .../Engine/Private/RigidBody_Dynamic.cpp | 8 ++++++ .../Engine/Public/RigidBody_Dynamic.h | 1 + 12 files changed, 23 insertions(+), 51 deletions(-) diff --git a/Jusin154_Team3D/Client/Default/Client.cpp b/Jusin154_Team3D/Client/Default/Client.cpp index eef769517..154505838 100644 --- a/Jusin154_Team3D/Client/Default/Client.cpp +++ b/Jusin154_Team3D/Client/Default/Client.cpp @@ -196,32 +196,6 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) g_hWnd = hWnd; -#ifndef _DEBUG - int screenX = GetSystemMetrics(SM_CXSCREEN); - int screenY = GetSystemMetrics(SM_CYSCREEN); - - HWND hWnd = CreateWindowW( - szWindowClass, - szTitle, - WS_POPUP, - 0, 0, - screenX, screenY, - nullptr, - nullptr, - hInstance, - nullptr - ); - - if (!hWnd) - return FALSE; - - g_hWnd = hWnd; - - ShowWindow(hWnd, SW_SHOW); - UpdateWindow(hWnd); - -#endif // !_DEBUG - return TRUE; } diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp index 2838f4cee..fb3cfa06d 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp @@ -208,19 +208,6 @@ HRESULT CGoblin_Assassin::Render() Render_OutLine(); } -#ifdef _DEBUG - //if (true == m_pCharacter_Controller->IsActive()) { - // if (FAILED(m_pCharacter_Controller->Render())) { - // return E_FAIL; - // } - //} - //else { - // if (FAILED(m_pRigidBody->Render())) { - // return E_FAIL; - // } - //} -#endif - if (0.f < m_fDeadRatio) { _bool bDisolve = false; if (FAILED(m_pShaderCom->Bind_RawValue("g_bDisolve", &bDisolve, sizeof(_bool)))) { @@ -327,7 +314,7 @@ HRESULT CGoblin_Assassin::Render_Shadow(SHADOW eType) return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/NPC_EleazarFig.cpp b/Jusin154_Team3D/Client/Private/NPC_EleazarFig.cpp index cef6f3c2f..a07507f8c 100644 --- a/Jusin154_Team3D/Client/Private/NPC_EleazarFig.cpp +++ b/Jusin154_Team3D/Client/Private/NPC_EleazarFig.cpp @@ -109,7 +109,7 @@ HRESULT CNPC_EleazarFig::Render_Shadow(SHADOW eType) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp index 2ea612b2f..eaf298607 100644 --- a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp +++ b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp @@ -109,7 +109,7 @@ HRESULT CNPC_Ollivander::Render_Shadow(SHADOW eType) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 24b7cddb9..21b7ad2d1 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -619,7 +619,6 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) fMixerFactor = 0.658333f; iColorMixerMethod = 1; break; -#ifdef _DEBUG case PLAYER_MESH_ORDER::ROBE_CLOTH: { CMesh* pMesh = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)); @@ -662,7 +661,6 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) } } break; -#endif // _DEBUG default: break; diff --git a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp index b9bde8795..38edd0c58 100644 --- a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp +++ b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp @@ -29,7 +29,7 @@ void CPlayerRobe::Update(_float fTimeDelta) XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()); m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false); - m_pRobeMainAnchor->Get_Actor()->wakeUp(); + //m_pRobeMainAnchor->Get_Actor()->wakeUp(); Update_LegsPosition(); Update_RobeSocketPosition(); diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 128d9ac8e..9279f65c6 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -234,7 +234,7 @@ HRESULT CRanrok::Render_Shadow(SHADOW eType) return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Troll.cpp b/Jusin154_Team3D/Client/Private/Troll.cpp index 186518c16..35a0c10de 100644 --- a/Jusin154_Team3D/Client/Private/Troll.cpp +++ b/Jusin154_Team3D/Client/Private/Troll.cpp @@ -333,7 +333,7 @@ HRESULT CTroll::Render_Shadow(SHADOW eType) return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { return E_FAIL; } 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 f47253c30..7e1caa130 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 @@ -205,8 +205,8 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) matrix BoneMatrix = (matrix) 0; matrix TempBoneMatrix = (matrix) 0; - int MinIdx = 30; - int MaxIdx = 41; + uint MinIdx = 30; + uint MaxIdx = 41; if (idx.x >= MinIdx && idx.x <= MaxIdx) //g_RobeBoneMask[idx.x] == 1) @@ -412,8 +412,8 @@ VS_OUT_SHADOW VS_MAIN_SHADOW_LEGACY(VS_IN In) matrix BoneMatrix = (matrix) 0; matrix TempBoneMatrix = (matrix) 0; - int MinIdx = 30; - int MaxIdx = 41; + uint MinIdx = 30; + uint MaxIdx = 41; if (idx.x >= MinIdx && idx.x <= MaxIdx) //g_RobeBoneMask[idx.x] == 1) diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index a6a4cc748..f55f3765c 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -233,6 +233,9 @@ _bool CPhysX_Manager::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir _bool CPhysX_Manager::SphereCast(_float fRadius, _fvector _vStartPos, _gvector _vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) { + if (fDistance < FLT_EPSILON3) { + return false; + } _float3 vDir = {}; _float3 vStartPos = {}; @@ -766,6 +769,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) PxInitExtensions(*m_pPhysics, m_pPvd); m_pCookingParam = new PSX::PxCookingParams(m_pPhysics->getTolerancesScale()); + m_pCookingParam->meshWeldTolerance = FLT_EPSILON3; m_pCookingParam->meshPreprocessParams |= PSX::PxMeshPreprocessingFlag::eWELD_VERTICES; PSX::PxSceneDesc sceneDesc = { m_pPhysics->getTolerancesScale() }; diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index 1fbf4d9bf..d262691e9 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -276,6 +276,9 @@ void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform, _bool bTele m_pRigidBody->setGlobalPose(pxTransform, true); if (true == bTeleport) { + if (IsKinematic()) { + return; + } m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f)); m_pRigidBody->clearForce(); @@ -396,6 +399,11 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg) return S_OK; } +_bool CRigidBody_Dynamic::IsKinematic() +{ + return m_pRigidBody->getRigidBodyFlags().isSet(PSX::PxRigidBodyFlag::eKINEMATIC); +} + //void CRigidBody_Dynamic::Move(PSX::PxTransform& pxTransform, _bool bTeleport) //{ // if (m_pRigidBody->getRigidBodyFlags().isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) { diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h index f49664b07..23482af90 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h @@ -93,6 +93,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc); virtual HRESULT Initialize(void* pArg) override; // void Move(PSX::PxTransform& pxTransform, _bool bTeleport); + _bool IsKinematic(); #ifdef _DEBUG HRESULT Add_DebugShape(); From e38d4577b9e9c1b1a606c29792f514f8bef4142e Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 4 Jan 2026 17:08:01 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[add]=20=EC=B9=B4=EB=A9=94=EB=9D=BC=20?= =?UTF-8?q?=EB=B3=B4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/Private/Camera_Model.cpp | 38 +++++++++---------- .../Client/Private/Level_GamePlay.cpp | 8 ++-- Jusin154_Team3D/Client/Private/Loader.cpp | 10 ++--- Jusin154_Team3D/Client/Private/Player.cpp | 10 +++++ .../ShaderFiles/Shader_Deferred.hlsl | 20 +++++----- .../Editor/Private/Loader_ObjectViewer.cpp | 12 ++++-- .../ShaderFiles/Shader_Deferred.hlsl | 20 +++++----- .../Engine/Private/RenderTarget_Manager.cpp | 21 +++++++++- Jusin154_Team3D/Engine/Private/Renderer.cpp | 31 +++++++++++---- .../Engine/Public/RenderTarget_Manager.h | 2 + 10 files changed, 112 insertions(+), 60 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Camera_Model.cpp b/Jusin154_Team3D/Client/Private/Camera_Model.cpp index 75023281f..8c75ab782 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Model.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Model.cpp @@ -17,6 +17,16 @@ CCamera_Model::CCamera_Model(const CCamera_Model& rhs) void CCamera_Model::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); + _float3 vCamPos = {}; + _float3 vCamMomentum = {}; + XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION)); + XMStoreFloat3(&vCamMomentum, m_pTransformCom->Get_CurrentMomentum()); +#ifdef _DEBUG + GUI::Text("Cam_Model Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); + GUI::Text("v %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); +#endif // _DEBUG + m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); #ifdef _DEBUG m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_MODEL, false); #endif // _DEBUG @@ -24,13 +34,7 @@ void CCamera_Model::Priority_Update(_float fTimeDelta) if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_MODEL))) { return; } - m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); - _float3 vCamPos = {}; - XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION)); -#ifdef _DEBUG - GUI::Text("Cam_Model Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); -#endif // _DEBUG __super::Bind_Matrices(); } @@ -39,12 +43,15 @@ void CCamera_Model::Update(_float fTimeDelta) { #ifdef _DEBUG Describe_Entity(); + _matrix matBoneSKT = m_pModelCom->Get_BoneMatrix(m_pModelCom->Get_BoneIndex("ctrl_1")); + m_pTransformCom->Set_WorldMatrix(matBoneSKT); + #endif // _DEBUG } void CCamera_Model::Late_Update(_float fTimeDelta) { - m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); } HRESULT CCamera_Model::Render() @@ -61,24 +68,10 @@ HRESULT CCamera_Model::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_Matrices( - "g_OffsetMatrix", - m_pModelCom->Get_OffsetMatrix(i).data(), - (_int)m_pModelCom->Get_OffsetMatrix(i).size() - ))) - { - return E_FAIL; - } - - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { return E_FAIL; } - m_pModelCom->Bind_OutPut_SRV_VS(31, 0); - m_pModelCom->Bind_OutPut_SRV_VS_Prev(32, 0); - - if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } @@ -103,6 +96,7 @@ HRESULT CCamera_Model::Initialize(void* pArg) if (FAILED(Ready_Components(pArg))) { return E_FAIL; } + m_pModelCom->Set_DisableRootMotionScale(true); m_matInitial = *m_pTransformCom->Get_WorldMatrixPtr(); m_bActive = true; @@ -190,6 +184,8 @@ void CCamera_Model::Describe_Entity() { _float3 vPosition = {}; GUI::Begin("CameraAnim List"); + //GUI::Text("%f", m_pModelCom->Get_CurrentTrackProgressRatio()); + for (_int i = 0; i < m_pModelCom->Get_AnimSize(); i++) { if (GUI::Button(m_pModelCom->Get_AnimList(i))) diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 3025ec963..6f6e5b26d 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -336,9 +336,9 @@ HRESULT CLevel_GamePlay::Ready_Background() isReady_Hogwart = false; #endif // #ifdef 기무리 - isReady_Background = true; - isReady_Hogsmeade = true; - isReady_Hogwart = true; + isReady_Background = false; + isReady_Hogsmeade = false; + isReady_Hogwart = false; #endif // #ifdef 나 isReady_Background = true; @@ -703,7 +703,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) #endif // #ifdef 기무리 - isLoad_NPC = true; + isLoad_NPC = false; #endif // #ifdef 나 diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 2b2963ae4..740fe082f 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -400,10 +400,10 @@ HRESULT CLoader::Loading_For_GamePlay() isLoad_UI_SEQUANTIAL = false; #endif // #ifdef 기무리 - isLoad_Background = true; - isLoad_Hogwart = true; - isLoad_UI_SEQUANTIAL = true; - isLoad_NPC = true; + isLoad_Background = false; + isLoad_Hogwart = false; + isLoad_UI_SEQUANTIAL = false; + isLoad_NPC = false; isLoad_Monster = true; #endif // #ifdef 나 @@ -2068,7 +2068,7 @@ HRESULT CLoader::Loading_For_GamePlay() } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Camera_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Object/Camera/Camera.bin", XMMatrixIdentity())))) { + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/Camera.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationX(XMConvertToRadians(-90.f)) * XMMatrixIdentity())))) { return E_FAIL; } } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 21b7ad2d1..486fdd440 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -345,10 +345,13 @@ HRESULT CPlayer::Render_Shadow(SHADOW eType) if (FAILED(Bind_ShaderParameters(i))) { return E_FAIL; } + if (i == ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)){ +#ifdef 기무리 if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW_LEGACY)))) { return E_FAIL; } +#endif // 기무리 } else { if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::SHADOW)))) { @@ -543,6 +546,8 @@ HRESULT CPlayer::Ready_Parts() //m_pModelCom->Play_Animation() //XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("broomSocket")); +#ifdef 기무리 + { CPlayerRobe::PlayerRobe_DESC Desc{}; Desc.pModel = m_pModelCom; @@ -553,6 +558,8 @@ HRESULT CPlayer::Ready_Parts() } } +#endif // 기무리 + return S_OK; } @@ -619,6 +626,8 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) fMixerFactor = 0.658333f; iColorMixerMethod = 1; break; +#ifdef 기무리 + case PLAYER_MESH_ORDER::ROBE_CLOTH: { CMesh* pMesh = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)); @@ -661,6 +670,7 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) } } break; +#endif // 기무리 default: break; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 80babe0fc..56284fa88 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -231,7 +231,11 @@ struct PS_OUT_FLT4_DOUBLE struct PS_OUT_BLUR_X { float4 vBlurX : SV_TARGET0; - float4 vBlurWeight : SV_TARGET1; +}; +struct PS_OUT_BLUR_X_ENV +{ + float4 vBlurX : SV_TARGET0; + float fBlurWeight : SV_TARGET1; }; struct PS_OUT_SSAO_AMBIENT_OCCLUSION { @@ -956,13 +960,12 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In) } Out.vBlurX = vColor; - Out.vBlurWeight = 0.f; return Out; } -PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) +PS_OUT_BLUR_X_ENV PS_MAIN_BLUR_X_ENV(PS_IN In) { - PS_OUT_BLUR_X Out; + PS_OUT_BLUR_X_ENV Out; float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f); float3 vColor = float3(0.f, 0.f, 0.f); @@ -979,7 +982,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (false == AlmostEqual3(vCenter.a, fTerrain)) { // 터레인셀이 아니면 스킵 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } @@ -994,7 +997,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (fBlurAmount <= FLT_EPSILON3) { // 최소치 이내면 블러 안함 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } @@ -1024,7 +1027,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (fAcc <= FLT_EPSILON3) { // 블러 실패하면 원본값 씀 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } else @@ -1046,7 +1049,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount); Out.vBlurX = float4(vColor, fOriginalAlpha); - Out.vBlurWeight = fAcc; + Out.fBlurWeight = fAcc; return Out; } @@ -1157,7 +1160,6 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_Y(PS_IN In) } Out.vBlurX = vColor; - Out.vBlurWeight = 0.f; return Out; } diff --git a/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp index 47f289944..a738d9625 100644 --- a/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp @@ -183,10 +183,10 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Prototype_Component_GerboldOlivander_Model") )); - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/Camera.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_Camera_Model") - )); + //futures.emplace_back(Deferred_ModelLoad( + // MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/Camera.bin", XMMatrixIdentity(), + // TEXT("Prototype_Component_Camera_Model") + //)); //futures.emplace_back(Deferred_ModelLoad( // MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/Camera_Spell.fbx", XMMatrixIdentity(), @@ -202,6 +202,10 @@ HRESULT CLoader::Loading_For_ObjectViewer() 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; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Camera_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Camera/Camera.bin", 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") diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 80babe0fc..56284fa88 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -231,7 +231,11 @@ struct PS_OUT_FLT4_DOUBLE struct PS_OUT_BLUR_X { float4 vBlurX : SV_TARGET0; - float4 vBlurWeight : SV_TARGET1; +}; +struct PS_OUT_BLUR_X_ENV +{ + float4 vBlurX : SV_TARGET0; + float fBlurWeight : SV_TARGET1; }; struct PS_OUT_SSAO_AMBIENT_OCCLUSION { @@ -956,13 +960,12 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In) } Out.vBlurX = vColor; - Out.vBlurWeight = 0.f; return Out; } -PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) +PS_OUT_BLUR_X_ENV PS_MAIN_BLUR_X_ENV(PS_IN In) { - PS_OUT_BLUR_X Out; + PS_OUT_BLUR_X_ENV Out; float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f); float3 vColor = float3(0.f, 0.f, 0.f); @@ -979,7 +982,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (false == AlmostEqual3(vCenter.a, fTerrain)) { // 터레인셀이 아니면 스킵 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } @@ -994,7 +997,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (fBlurAmount <= FLT_EPSILON3) { // 최소치 이내면 블러 안함 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } @@ -1024,7 +1027,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) if (fAcc <= FLT_EPSILON3) { // 블러 실패하면 원본값 씀 Out.vBlurX = vOriginal; - Out.vBlurWeight = 0.0f; + Out.fBlurWeight = 0.f; return Out; } else @@ -1046,7 +1049,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In) float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount); Out.vBlurX = float4(vColor, fOriginalAlpha); - Out.vBlurWeight = fAcc; + Out.fBlurWeight = fAcc; return Out; } @@ -1157,7 +1160,6 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_Y(PS_IN In) } Out.vBlurX = vColor; - Out.vBlurWeight = 0.f; return Out; } diff --git a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp index 497c93e9f..2f0e60a33 100644 --- a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp @@ -516,6 +516,24 @@ HRESULT CRenderTarget_Manager::Finish_RenderTarget(CVIBuffer_Rect* pVIBuffer, CS return S_OK; } +void CRenderTarget_Manager::Flush_All_SRVs(_uint iStartSlot, _uint numSlots) +{ + ID3D11ShaderResourceView* nullSrvs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {}; + + m_pContext->VSSetShaderResources(iStartSlot, numSlots, nullSrvs); + m_pContext->PSSetShaderResources(iStartSlot, numSlots, nullSrvs); + m_pContext->GSSetShaderResources(iStartSlot, numSlots, nullSrvs); + m_pContext->HSSetShaderResources(iStartSlot, numSlots, nullSrvs); + m_pContext->DSSetShaderResources(iStartSlot, numSlots, nullSrvs); + m_pContext->CSSetShaderResources(iStartSlot, numSlots, nullSrvs); +} + +void CRenderTarget_Manager::Flush_All_CSUAVs(_uint iStartSlot, _uint numSlots) +{ + ID3D11UnorderedAccessView* nullUavs[D3D11_PS_CS_UAV_REGISTER_COUNT] = {}; + m_pContext->CSSetUnorderedAccessViews(iStartSlot, numSlots, nullUavs, nullptr); +} + HRESULT CRenderTarget_Manager::End_MRT() { @@ -525,7 +543,8 @@ HRESULT CRenderTarget_Manager::End_MRT() SAFE_RELEASE(m_pBackBufferRTV); SAFE_RELEASE(m_pOriginalDSV); - + Flush_All_SRVs(); + Flush_All_CSUAVs(); return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 3fdeb6b54..a0eb90d47 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -572,23 +572,37 @@ void CRenderer::Render_Fog() return; } - m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::FOG)); + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::PRINT_BACKBUFFER)); m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); + + { // BackBuffer + ID3D11Texture2D* pBackBuffer = nullptr; + m_pGameInstance->Get_BackBufferPTR(&pBackBuffer); + m_pGameInstance->Copy_RenderTargetFrom(TEXT("Target_Fog"), pBackBuffer); + SAFE_RELEASE(pBackBuffer); + } + m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)); m_pShader->Bind_RawValue("g_fDepthPackExponent", m_pGameInstance->Get_DepthPackExponentPtr(), sizeof(_float)); - if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌 - assert(false); - } + //if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌 + // assert(false); + //} if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) { return; } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_OriginalTexture"))) { + return; + } - m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::PRINT_BACKBUFFER)); + if (FAILED(m_pShader->Bind_SRV("g_VolumeTexture", m_pGameInstance->Get_VolumeSRV()))) + return; + + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::FOG)); m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); @@ -653,8 +667,11 @@ void CRenderer::Render_NonLight() m_eType = RENDER::NONLIGHT; for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::NONLIGHT)]) { - if (nullptr != pRenderObject) - pRenderObject->Render(); + if (nullptr != pRenderObject){ + if (FAILED(pRenderObject->Render())) { + assert(false); + } + } SAFE_RELEASE(pRenderObject); } diff --git a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h index 65ad0f832..26e844e9b 100644 --- a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h +++ b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h @@ -29,6 +29,8 @@ class CRenderTarget_Manager final : public CBase // 랜더 타겟의 크기를 dest로 다시 맞춤 HRESULT Refit_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput, SHADER_PASS_DEFERRED ePass); HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass); + void Flush_All_SRVs(_uint iStartSlot = 0, _uint numSlots = D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT); + void Flush_All_CSUAVs(_uint iStartSlot = 0, _uint numSlots = D3D11_PS_CS_UAV_REGISTER_COUNT); #ifdef _DEBUG public: From 254c798ead98afd0990e9b910384312efe34adda Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 4 Jan 2026 17:59:47 +0900 Subject: [PATCH 3/4] [add] ToneMapping --- .../Client/Private/Level_GamePlay.cpp | 8 ++++---- Jusin154_Team3D/Client/Private/Light_Main.cpp | 10 ++++++++-- Jusin154_Team3D/Client/Private/Loader.cpp | 8 ++++---- Jusin154_Team3D/Engine/Public/Engine_Macro.h | 2 +- Jusin154_Team3D/Engine/Public/Renderer.h | 18 +++++++++--------- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 6f6e5b26d..3025ec963 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -336,9 +336,9 @@ HRESULT CLevel_GamePlay::Ready_Background() isReady_Hogwart = false; #endif // #ifdef 기무리 - isReady_Background = false; - isReady_Hogsmeade = false; - isReady_Hogwart = false; + isReady_Background = true; + isReady_Hogsmeade = true; + isReady_Hogwart = true; #endif // #ifdef 나 isReady_Background = true; @@ -703,7 +703,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) #endif // #ifdef 기무리 - isLoad_NPC = false; + isLoad_NPC = true; #endif // #ifdef 나 diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 82c6a5ca2..235ee5384 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -68,7 +68,7 @@ HRESULT CLight_Main::Capture_PreShadow() vector<_float3> vNeededPos = {}; vNeededPos.reserve(12); { - // 외곽이 더 많아지면 많아질수록 더 정밀한 경계가 가능 + // 외곽이 더 많아지면 많아질수록 더 정밀한 경계가 가능함 // 하지만 더 실제보다 멀리 외곽을 두르면 필요한 것보다 더 많이 찍게 됨 // 결국 딱 맞춰서 찍는게 제일 중요함 vNeededPos.emplace_back(_float3(-112.f, 155.f, 362.f)); @@ -97,7 +97,13 @@ HRESULT CLight_Main::Capture_PreShadow() HRESULT CLight_Main::Ready_Components(void* pArg) { __super::Ready_Components(nullptr); - m_pTransformCom->Rotation(60.f, 0.f, 0.f); + + _matrix LIGHT_WorldMatrixDoNotModify = + _matrix(0.819145918f, 0.f, -0.573572040f, 0.f, + 0.553958654f, 0.258784860f, 0.791134834f, 0.f + , 0.148416296f, -0.965690017f, 0.211960629f, 0.f + , 0.f, 0.f, 0.f, 1.f); + m_pTransformCom->Set_WorldMatrix(LIGHT_WorldMatrixDoNotModify); LIGHT_DESC* pLightDescArg = static_cast(pArg); diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 740fe082f..273390622 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -400,10 +400,10 @@ HRESULT CLoader::Loading_For_GamePlay() isLoad_UI_SEQUANTIAL = false; #endif // #ifdef 기무리 - isLoad_Background = false; - isLoad_Hogwart = false; - isLoad_UI_SEQUANTIAL = false; - isLoad_NPC = false; + isLoad_Background = true; + isLoad_Hogwart = true; + isLoad_UI_SEQUANTIAL = true; + isLoad_NPC = true; isLoad_Monster = true; #endif // #ifdef 나 diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h index d9a55d3cf..6d084ea41 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h @@ -35,7 +35,7 @@ #undef ASSERT_NURI #define ASSERT_NURI(expression) assert(expression) #define MSG_BOX(_message) MessageBox(NULL, TEXT(_message), L"System Message", MB_OK); assert(false); -//#undef USE_LOWTEXTURE // 매크로 옵션으로 해상도 조절, 주석 걸면 디버그모드에서 저해상도 유지 +#undef USE_LOWTEXTURE // 매크로 옵션으로 해상도 조절, 주석 걸면 디버그모드에서 저해상도 유지 //#undef OPTIONAL_TRUE_KEYINPUTGUICHECK //#define OPTIONAL_TRUE_KEYINPUTGUICHECK true|| #elif 진우 diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index 8ebd8d1cf..2f3762957 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -74,7 +74,7 @@ class CRenderer final : public CBase #pragma region TunningParameters /* TunningParam */ // Variable - _float m_fLightSpecularMaximum = { 1.f }; + _float m_fLightSpecularMaximum = { 2.f }; // MotionBlur _float m_fMBBlurRadius = { 28.f }; @@ -94,16 +94,16 @@ class CRenderer final : public CBase _float m_fBloomThreshold = { 1.26f }; // DOF Environment - _float m_fDOF_ENV_CutThreshold = { 0.1350f }; - _float m_fDOF_ENV_FocusDistance = { 31.1f }; - _float m_fDOF_ENV_StartDistance = { 130.f }; - _float m_fDOF_ENV_MaxEnd = { 350.f }; - _float m_fDOF_ENV_AmountRadius = { 1.f }; + _float m_fDOF_ENV_CutThreshold = { 0.191f }; + _float m_fDOF_ENV_FocusDistance = { 38.f }; + _float m_fDOF_ENV_StartDistance = { 88.f }; + _float m_fDOF_ENV_MaxEnd = { 237.f }; + _float m_fDOF_ENV_AmountRadius = { 1.2f }; // SSAO - _float m_fSSAO_Radius = { 1.6300f }; - _float m_fSSAO_BIAS = { 0.234f }; - _float m_fSSAOStrength = { 2.83f }; + _float m_fSSAO_Radius = { 0.543f }; + _float m_fSSAO_BIAS = { 0.401f }; + _float m_fSSAOStrength = { 4.f }; SSAO_GEOMETRY_HEMISPHERE m_tagSSAOGeometry = {}; SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL m_tagSSAOGeometryDirections = {}; From 079d91aa7838246a928a218797fd70e6de60661a Mon Sep 17 00:00:00 2001 From: Chanbin Kim <127280695+JinhoBa@users.noreply.github.com> Date: Sun, 4 Jan 2026 18:15:30 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[add]=20InstanceProp=20RigidBody=5FStatic?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20[add]=20VIBuffer=5FModel=5FInstance=20?= =?UTF-8?q?=ED=94=BC=EC=A7=81=EC=8A=A4=20=ED=95=A8=EC=88=98,=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Default/Client.cpp | 26 +++ .../Client/Private/InstancedProp.cpp | 70 +++++++-- .../Client/Private/InstancedProp_Light.cpp | 65 +++++++- .../Client/Private/Level_GamePlay.cpp | 21 ++- Jusin154_Team3D/Client/Private/Loader.cpp | 148 ++++++++++++++---- .../Client/Private/MapElement_Static.cpp | 1 + .../Client/Private/MapObject_Collision.cpp | 1 + .../Client/Private/MapObject_Render.cpp | 1 + Jusin154_Team3D/Client/Private/Terrain.cpp | 1 + Jusin154_Team3D/Client/Public/InstancedProp.h | 17 +- .../Client/Public/InstancedProp_Light.h | 24 +-- Jusin154_Team3D/Client/Public/Loader.h | 2 + .../Data/Map/Terrain/Hogsmeade_HeightMap.bin | 2 +- .../Editor/Private/InstancedProp.cpp | 2 - .../Editor/Private/Level_MapViewer.cpp | 46 +++--- Jusin154_Team3D/Editor/Private/Loader.cpp | 4 +- .../Editor/Private/MapObject_LOD.cpp | 2 +- .../Editor/Private/MapObject_Manager.cpp | 4 +- Jusin154_Team3D/Editor/Private/Terrain.cpp | 46 +++--- Jusin154_Team3D/Editor/Public/InstancedProp.h | 1 + .../Engine/Private/GameInstance.cpp | 4 + .../Engine/Private/PhysX_Manager.cpp | 80 +++++++++- Jusin154_Team3D/Engine/Private/Renderer.cpp | 4 - .../Engine/Private/RigidBody_Static.cpp | 3 +- .../Private/VIBuffer_Model_Instance.cpp | 22 +++ Jusin154_Team3D/Engine/Public/GameInstance.h | 1 + Jusin154_Team3D/Engine/Public/PhysX_Manager.h | 3 +- .../Engine/Public/RigidBody_Static.h | 3 +- .../Engine/Public/VIBuffer_Model_Instance.h | 6 + 29 files changed, 482 insertions(+), 128 deletions(-) diff --git a/Jusin154_Team3D/Client/Default/Client.cpp b/Jusin154_Team3D/Client/Default/Client.cpp index 154505838..39a543820 100644 --- a/Jusin154_Team3D/Client/Default/Client.cpp +++ b/Jusin154_Team3D/Client/Default/Client.cpp @@ -196,6 +196,32 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) g_hWnd = hWnd; +#ifndef _DEBUG + //int screenX = GetSystemMetrics(SM_CXSCREEN); + //int screenY = GetSystemMetrics(SM_CYSCREEN); + + //HWND hWnd = CreateWindowW( + // szWindowClass, + // szTitle, + // WS_POPUP, + // 0, 0, + // screenX, screenY, + // nullptr, + // nullptr, + // hInstance, + // nullptr + //); + + //if (!hWnd) + // return FALSE; + + //g_hWnd = hWnd; + + //ShowWindow(hWnd, SW_SHOW); + //UpdateWindow(hWnd); + +#endif // !_DEBUG + return TRUE; } diff --git a/Jusin154_Team3D/Client/Private/InstancedProp.cpp b/Jusin154_Team3D/Client/Private/InstancedProp.cpp index aaab466ab..0a89ecc4f 100644 --- a/Jusin154_Team3D/Client/Private/InstancedProp.cpp +++ b/Jusin154_Team3D/Client/Private/InstancedProp.cpp @@ -89,9 +89,6 @@ HRESULT CInstancedProp::Initialize(void* pArg) if (FAILED(Ready_Components(pArg))) return E_FAIL; - - m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh(); - return S_OK; } @@ -107,8 +104,16 @@ HRESULT CInstancedProp::Ready_Components(void* pArg) reinterpret_cast(&m_pVIBufferInstanceCom)))) return E_FAIL; + m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh(); + + if(pDesc->bEnableRigidbody) + { + if (FAILED(ReadyForPhysX())) + return E_FAIL; + } + /* Laod Instance Data */ - if(FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str()))) + if(FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str(), pDesc))) return E_FAIL; m_isShake = pDesc->isShake; @@ -143,7 +148,16 @@ HRESULT CInstancedProp::Bind_ShaderResources() return S_OK; } -HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath) +HRESULT CInstancedProp::ReadyForPhysX() +{ + if (FAILED(m_pVIBufferInstanceCom->Ready_PhysXMeshes(NEXT_LEVEL))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath, INSTANCE_PROP_DESC* pDesc) { ifstream FileIn(pFilePath, ios::binary); @@ -155,19 +169,52 @@ HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath) vector<_float4x4> WorldMatrices = {}; - _uint iNumWorldMatrix = 0; + m_iNumInstacne = 0; - FileIn.read(reinterpret_cast(&iNumWorldMatrix), sizeof(_uint)); - WorldMatrices.reserve(iNumWorldMatrix); + FileIn.read(reinterpret_cast(&m_iNumInstacne), sizeof(_uint)); + WorldMatrices.reserve(m_iNumInstacne); + m_RigidBody.reserve(m_iNumInstacne); _float4x4 WorldMatrix = {}; - for (_uint i = 0; i < iNumWorldMatrix; ++i) +#pragma region FOR RIGIDBODY + CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{}; + + Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); + + vector<_wstring> RigidBodyTags; + + + for (_uint i = 0; i < m_iNumMesh; ++i) + { + RigidBodyTags.push_back(CMyTools::ToWstring(m_pVIBufferInstanceCom->Get_MeshName(i)) + to_wstring(i)); + } +#pragma endregion + + for (_uint i = 0; i < m_iNumInstacne; ++i) { FileIn.read(reinterpret_cast(&WorldMatrix), sizeof(_float4x4)); WorldMatrices.push_back(WorldMatrix); + + if(pDesc->bEnableRigidbody) + { + for (_uint i = 0; i < m_iNumMesh; ++i) + { + CRigidBody_Static* pRigidBody = { nullptr }; + CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {}; + Desc.pMeshName = RigidBodyTags[i].c_str(); + Desc.pWorldMatrix = &WorldMatrix; + if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, RigidBodyTags[i], (CComponent**)&pRigidBody, &Desc))) { + return E_FAIL; + } + + m_RigidBody.push_back(pRigidBody); + } + + } } + FileIn.close(); if (FAILED(m_pVIBufferInstanceCom->Load_WorldData(WorldMatrices))) @@ -209,6 +256,11 @@ void CInstancedProp::Free() { __super::Free(); + for (auto& pRigidBody : m_RigidBody) + { + SAFE_RELEASE(pRigidBody); + } + SAFE_RELEASE(m_pShaderCom); SAFE_RELEASE(m_pVIBufferInstanceCom); } diff --git a/Jusin154_Team3D/Client/Private/InstancedProp_Light.cpp b/Jusin154_Team3D/Client/Private/InstancedProp_Light.cpp index cbac1c878..646f8e4b9 100644 --- a/Jusin154_Team3D/Client/Private/InstancedProp_Light.cpp +++ b/Jusin154_Team3D/Client/Private/InstancedProp_Light.cpp @@ -111,16 +111,22 @@ HRESULT CInstancedProp_Light::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; + m_bEnableRigidbody = pDesc->bEnableRigidbody; m_iGlassMeshIndex = pDesc->iGlassMeshIndex; if (FAILED(Ready_Components(pArg))) return E_FAIL; - - Load_InstancedProp(pDesc->strInstanceDataPath.c_str()); - m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh(); + if(m_bEnableRigidbody) + { + if (FAILED(ReadyForPhysX())) + return E_FAIL; + } + + if (FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str()))) + return E_FAIL; return S_OK; } @@ -133,7 +139,7 @@ HRESULT CInstancedProp_Light::Ready_Components(void* pArg) INSTANCE_PROP_LIGHT_DESC* pDesc = static_cast(pArg); /* Com_VIBuffer_Instance_Model */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pDesc->strPrototypeTag, + if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, pDesc->strPrototypeTag, reinterpret_cast(&m_pVIBufferInstanceCom)))) return E_FAIL; @@ -180,6 +186,15 @@ HRESULT CInstancedProp_Light::Bind_ShaderResources() return S_OK; } +HRESULT CInstancedProp_Light::ReadyForPhysX() +{ + if (FAILED(m_pVIBufferInstanceCom->Ready_PhysXMeshes(NEXT_LEVEL))) { + return E_FAIL; + } + + return S_OK; +} + HRESULT CInstancedProp_Light::Load_InstancedProp(const _char* pFilePath) { ifstream FileIn(pFilePath, ios::binary); @@ -192,18 +207,47 @@ HRESULT CInstancedProp_Light::Load_InstancedProp(const _char* pFilePath) vector<_float4x4> WorldMatrices = {}; - _uint iNumWorldMatrix = 0; +#pragma region FOR RIGIDBODY + CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{}; - FileIn.read(reinterpret_cast(&iNumWorldMatrix), sizeof(_uint)); - WorldMatrices.reserve(iNumWorldMatrix); + Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); + + vector<_wstring> RigidBodyTags; + + + for (_uint i = 0; i < m_iNumMesh; ++i) + { + RigidBodyTags.push_back(CMyTools::ToWstring(m_pVIBufferInstanceCom->Get_MeshName(i)) + to_wstring(i)); + } +#pragma endregion + + FileIn.read(reinterpret_cast(&m_iNumInstacne), sizeof(_uint)); + WorldMatrices.reserve(m_iNumInstacne); _float4x4 WorldMatrix = {}; - for (_uint i = 0; i < iNumWorldMatrix; ++i) + for (_uint i = 0; i < m_iNumInstacne; ++i) { FileIn.read(reinterpret_cast(&WorldMatrix), sizeof(_float4x4)); WorldMatrices.push_back(WorldMatrix); + + if (m_bEnableRigidbody) + { + for (_uint i = 0; i < m_iNumMesh; ++i) + { + CRigidBody_Static* pRigidBody = { nullptr }; + CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {}; + Desc.pMeshName = RigidBodyTags[i].c_str(); + Desc.pWorldMatrix = &WorldMatrix; + if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, RigidBodyTags[i], (CComponent**)&pRigidBody, &Desc))) { + return E_FAIL; + } + + m_RigidBody.push_back(pRigidBody); + } + + } } FileIn.close(); @@ -246,6 +290,11 @@ void CInstancedProp_Light::Free() { __super::Free(); + for (auto& pRigidBody : m_RigidBody) + { + SAFE_RELEASE(pRigidBody); + } + SAFE_RELEASE(m_pShaderCom); SAFE_RELEASE(m_pVIBufferInstanceCom); SAFE_RELEASE(m_pGlassTextureCom); diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 3025ec963..692d336f5 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -449,7 +449,8 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* InstanceProp Oak_Tree*/ Desc.isShake = true; - Desc.vRadius = _float2(0.015f, 0.04f); + Desc.bEnableRigidbody = true; + Desc.vRadius = _float2(0.015f, 0.02f); Desc.vSpeed = _float2(0.3f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/OakTree_MedA.bin"; @@ -459,6 +460,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* BearBerry */ Desc.isShake = true; + Desc.bEnableRigidbody = false; Desc.vRadius = _float2(0.015f, 0.02f); Desc.vSpeed = _float2(0.6f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A"; @@ -469,6 +471,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* SM_HM_OwlPost_Window_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_OwlPost_Window_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/OwlPost_Window.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -476,6 +479,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() ///* WA_Rectangle_Double_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Rectangle_Double_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Rectangle_Double_A.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -483,6 +487,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() ///* WC_Retangle_Double_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Retangle_Double_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Retangle_Double_A.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -490,6 +495,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() ///* WA_Square_Double_C */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Square_Double_C"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WA_Square_Double_C.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -497,6 +503,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* Quid_Window_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Quid_Window_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Quid_Window_A.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -504,6 +511,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* Ollivanders_Box_Window */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Ollivanders_Box_Window"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Ollivanders_Box.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -511,6 +519,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* WC_L_DoubleS_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_L_DoubleS_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_L_DoubleS_A.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -518,6 +527,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* WC_Round_Double_A */ Desc.isShake = false; + Desc.bEnableRigidbody = false; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Round_Double_A"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Round_Double_A.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -525,6 +535,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* SM_HM_Door1a */ Desc.isShake = false; + Desc.bEnableRigidbody = true; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door1a.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -532,6 +543,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* SM_HM_Door2b */ Desc.isShake = false; + Desc.bEnableRigidbody = true; Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"; Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door2b.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc))) @@ -539,6 +551,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* OakTree_TallA */ Desc.isShake = false; + Desc.bEnableRigidbody = true; Desc.vRadius = _float2(0.015f, 0.016f); Desc.vSpeed = _float2(0.01f, 0.1f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA"; @@ -548,6 +561,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* Shrub_B */ Desc.isShake = true; + Desc.bEnableRigidbody = false; Desc.vRadius = _float2(0.015f, 0.04f); Desc.vSpeed = _float2(0.3f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Shrub_B"; @@ -557,6 +571,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* BogMyrtle_A */ Desc.isShake = true; + Desc.bEnableRigidbody = false; Desc.vRadius = _float2(0.015f, 0.04f); Desc.vSpeed = _float2(0.3f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_BogMyrtle_A"; @@ -566,6 +581,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* Dogwood_B */ Desc.isShake = true; + Desc.bEnableRigidbody = true; Desc.vRadius = _float2(0.015f, 0.02f); Desc.vSpeed = _float2(0.3f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B"; @@ -575,6 +591,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* ScotsPine_LargeA */ Desc.isShake = false; + Desc.bEnableRigidbody = true; Desc.vRadius = _float2(0.015f, 0.02f); Desc.vSpeed = _float2(0.3f, 1.f); Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA"; @@ -587,6 +604,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* LightPost */ LightDesc.isShake = false; + LightDesc.bEnableRigidbody = true; LightDesc.iGlassMeshIndex = 0; LightDesc.vRadius = _float2(0.f, 0.f); LightDesc.vSpeed = _float2(0.f, 0.f); @@ -597,6 +615,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp() /* LightPost_Floating */ LightDesc.isShake = false; + LightDesc.bEnableRigidbody = true; LightDesc.iGlassMeshIndex = 1; LightDesc.vRadius = _float2(0.f, 0.f); LightDesc.vSpeed = _float2(0.f, 0.f); diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 273390622..9824e6bc0 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -2861,12 +2861,21 @@ HRESULT CLoader::Loading_For_GamePlay() } #pragma region MAP_INSTANCE + + _string strMaterailPath = "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"; + /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin", - "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A"), @@ -2924,22 +2933,43 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_HM_Door1a.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Door1a.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_HM_Door2b.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Door2b.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_OakTree_TallA.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_OakTree_TallA.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_Shrub_B*/ if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Shrub_B"), @@ -2954,28 +2984,56 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; /* For.Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_Dogwood_B.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_Dogwood_B.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_ScotsPine_LargeA_Master.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_ScotsPine_LargeA_Master.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_LightPost */ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_LightPost"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_HM_LightPost.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_LightPost.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_LightPost"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } /* For.Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating */ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"), - CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, - "../Bin/Resources/Models/InstanceProp/SM_HM_Light_Post_Floating.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml")))) - return E_FAIL; + { + CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext, + "../Bin/Resources/Models/InstanceProp/SM_HM_Light_Post_Floating.bin", strMaterailPath.c_str()); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"), + pModel_Instance))) + return E_FAIL; + + if (FAILED(Ready_RigidBody_Static(pModel_Instance))) + return E_FAIL; + } #pragma endregion /* For.Prototype_Component_South_Hogwart_Land_LOD1 */ @@ -3599,6 +3657,30 @@ void CLoader::Ready_MapModels(vector*>>& jobMapModel } +HRESULT CLoader::Ready_RigidBody_Static(CVIBuffer_Model_Instance* pModel_Instance) +{ + _uint iNumMesh = pModel_Instance->Get_NumMesh(); + for (_uint i = 0; i < iNumMesh; ++i) + { + CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{}; // + { + Desc.eType = ACTOR::TRIANGLEMESH; + Desc.ePxRigidBodyFlags = {}; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = PXMATERIAL::DEFAULT; + Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f); + Desc.fContactOffset = 0.001f; + } + CRigidBody_Static* pRigid = CRigidBody_Static::Create(m_pDevice, m_pContext, Desc); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, CMyTools::ToWstring(pModel_Instance->Get_MeshName(i) + to_string(i)), pRigid))) { + return E_FAIL; + } + } + + + return S_OK; +} + CLoader* CLoader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eNextLevelID) { CLoader* pInstance = new CLoader(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Private/MapElement_Static.cpp b/Jusin154_Team3D/Client/Private/MapElement_Static.cpp index f74831165..38854ab5e 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Static.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Static.cpp @@ -181,6 +181,7 @@ void CMapElement_Static::ConvertToPhysX() CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {}; Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); Desc.pMeshName = wstrName.c_str(); + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) { assert(false); } diff --git a/Jusin154_Team3D/Client/Private/MapObject_Collision.cpp b/Jusin154_Team3D/Client/Private/MapObject_Collision.cpp index a1faabc72..805c557be 100644 --- a/Jusin154_Team3D/Client/Private/MapObject_Collision.cpp +++ b/Jusin154_Team3D/Client/Private/MapObject_Collision.cpp @@ -188,6 +188,7 @@ void CMapObject_Collision::ConvertToPhysX() CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {}; Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); Desc.pMeshName = wstrName.c_str(); + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) { assert(false); } diff --git a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp index 1cb0b22f9..a993d244c 100644 --- a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp +++ b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp @@ -187,6 +187,7 @@ void CMapObject_Render::ConvertToPhysX() CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {}; Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); Desc.pMeshName = wstrName.c_str(); + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) { assert(false); } diff --git a/Jusin154_Team3D/Client/Private/Terrain.cpp b/Jusin154_Team3D/Client/Private/Terrain.cpp index 96c9a21ea..7adfede7d 100644 --- a/Jusin154_Team3D/Client/Private/Terrain.cpp +++ b/Jusin154_Team3D/Client/Private/Terrain.cpp @@ -39,6 +39,7 @@ HRESULT CTerrain::Initialize(void* pArg) CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{}; Desc.pMeshName = pDesc->strRigidBody_MeshName.c_str(); Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); /* Com_RigidBody */ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pDesc->strRigidBody_ComponentTag, reinterpret_cast(&m_pRigidBody), &Desc))) { diff --git a/Jusin154_Team3D/Client/Public/InstancedProp.h b/Jusin154_Team3D/Client/Public/InstancedProp.h index e40ff16b0..a1003cf15 100644 --- a/Jusin154_Team3D/Client/Public/InstancedProp.h +++ b/Jusin154_Team3D/Client/Public/InstancedProp.h @@ -16,11 +16,12 @@ class CInstancedProp final : public CGameObject public: typedef struct tagInstancedPropDesc { - _bool isShake; - _float2 vRadius; - _float2 vSpeed; - _wstring strPrototypeTag; - _string strInstanceDataPath; + _bool isShake; + _bool bEnableRigidbody; + _float2 vRadius; + _float2 vSpeed; + _wstring strPrototypeTag; + _string strInstanceDataPath; }INSTANCE_PROP_DESC; private: CInstancedProp(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); @@ -37,7 +38,9 @@ class CInstancedProp final : public CGameObject private: _bool m_isShake = {}; _uint m_iNumMesh = {}; + _uint m_iNumInstacne = {}; + vector m_RigidBody = { nullptr }; CVIBuffer_Model_Instance* m_pVIBufferInstanceCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; @@ -47,12 +50,14 @@ class CInstancedProp final : public CGameObject virtual HRESULT Ready_Components(void* pArg) override; virtual HRESULT Bind_ShaderResources() override; - HRESULT Load_InstancedProp(const _char* pFilePath); + HRESULT ReadyForPhysX(); + HRESULT Load_InstancedProp(const _char* pFilePath, INSTANCE_PROP_DESC* pDesc); public: static CInstancedProp* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; + #ifdef _DEBUG void Describe_Entity() override; #endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Public/InstancedProp_Light.h b/Jusin154_Team3D/Client/Public/InstancedProp_Light.h index e407ddd30..a84af2d13 100644 --- a/Jusin154_Team3D/Client/Public/InstancedProp_Light.h +++ b/Jusin154_Team3D/Client/Public/InstancedProp_Light.h @@ -17,12 +17,14 @@ class CInstancedProp_Light final : public CGameObject typedef struct tagInstancedPropLightDesc { _bool isShake; + _bool bEnableRigidbody; _uint iGlassMeshIndex{}; _float2 vRadius; _float2 vSpeed; _wstring strPrototypeTag; - _string strInstanceDataPath; + _string strInstanceDataPath; }INSTANCE_PROP_LIGHT_DESC; + private: CInstancedProp_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CInstancedProp_Light(const CInstancedProp_Light& rhs); @@ -35,23 +37,25 @@ class CInstancedProp_Light final : public CGameObject virtual HRESULT Render() override; virtual HRESULT Render_Bloom() override; - private: _bool m_bLightOn = { true }; + _bool m_bEnableRigidbody = { }; + + _uint m_iNumMesh = {}; + _uint m_iNumInstacne = {}; + _uint m_iGlassMeshIndex = {}; + + _float m_fGlassRatio = { 0.5f }; + _float m_fBloomStrength = { 15.f }; + CVIBuffer_Model_Instance* m_pVIBufferInstanceCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; CTexture* m_pGlassTextureCom = { nullptr }; CTexture* m_pMaskTextureCom = { nullptr }; CTexture* m_pEmissiveTextureCom = { nullptr }; - - _uint m_iNumMesh = {}; - _uint m_iGlassMeshIndex = {}; - - _float m_fGlassRatio = { 0.5f }; - _float m_fBloomStrength = { 15.f }; - + vector m_RigidBody = { nullptr }; private: virtual HRESULT Initialize_Prototype() override; @@ -59,12 +63,14 @@ class CInstancedProp_Light final : public CGameObject virtual HRESULT Ready_Components(void* pArg) override; virtual HRESULT Bind_ShaderResources() override; + HRESULT ReadyForPhysX(); HRESULT Load_InstancedProp(const _char* pFilePath); public: static CInstancedProp_Light* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; + #ifdef _DEBUG void Describe_Entity() override; #endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Public/Loader.h b/Jusin154_Team3D/Client/Public/Loader.h index cb0ecf432..c6c51748f 100644 --- a/Jusin154_Team3D/Client/Public/Loader.h +++ b/Jusin154_Team3D/Client/Public/Loader.h @@ -6,6 +6,7 @@ NS_BEGIN(Engine) class CGameInstance; class CModel; +class CVIBuffer_Model_Instance; NS_END NS_BEGIN(Client) @@ -43,6 +44,7 @@ class CLoader final : public CBase future*> Deferred_FolderLoad(const _char* pDirectoryPath, const _char* pFileExt, _bool bUseTag); future*> Deferred_ModelLoad(MODEL eType, const _char* pDirectoryPath, _fmatrix PreTransform, const _tchar* pPrototypeTag); void Ready_MapModels(vector*>>& jobMapModels); + HRESULT Ready_RigidBody_Static(CVIBuffer_Model_Instance* pModel_Instance); public: static CLoader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eNextLevelID); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Terrain/Hogsmeade_HeightMap.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Terrain/Hogsmeade_HeightMap.bin index c83e18247..c7b23053b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Terrain/Hogsmeade_HeightMap.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Terrain/Hogsmeade_HeightMap.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d1403c26882c44252bc1a63ed0528c901904c7233bae4d4628f98bf4b2bfee2 +oid sha256:bf3f9ae0a13102dda45fda801e0bfd162db42eca532822d996f5a9a1707f1949 size 1052676 diff --git a/Jusin154_Team3D/Editor/Private/InstancedProp.cpp b/Jusin154_Team3D/Editor/Private/InstancedProp.cpp index df2bb1763..7c696d9d3 100644 --- a/Jusin154_Team3D/Editor/Private/InstancedProp.cpp +++ b/Jusin154_Team3D/Editor/Private/InstancedProp.cpp @@ -127,8 +127,6 @@ HRESULT CInstancedProp::Ready_Components(void* pArg) reinterpret_cast(&m_pVIBufferInstanceCom)))) return E_FAIL; - - /* Com_Shader */ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_INSTANCE_PROP_MODEL, reinterpret_cast(&m_pShaderCom)))) diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 83f202bb3..68be8bbd7 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -68,9 +68,9 @@ HRESULT CLevel_MapViewer::Initialize() return E_FAIL; } - /*if (FAILED(Ready_Layer_InstanceProp(TEXT("Layer_InstanceProp")))) { + if (FAILED(Ready_Layer_InstanceProp(TEXT("Layer_InstanceProp")))) { return E_FAIL; - }*/ + } //if (FAILED(Ready_Layer_BuildingContainer(TEXT("Layer_Building")))) { // return E_FAIL; @@ -148,7 +148,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) CTerrain::TERRAIN_DESC Desc = {}; ///* Hogsmeade */ - Desc.isEdit = false; + Desc.isEdit = true; Desc.iAlphaSizeX = 2048; Desc.iAlphaSizeY = 2048; Desc.vPosition = _float3(-194, 18.5f, -153.f); @@ -427,27 +427,27 @@ HRESULT CLevel_MapViewer::Ready_Layer_InstanceProp(const _wstring& strLayerTag) CInstancedProp_Light::INSTANCE_PROP_LIGHT_DESC LightDesc = {}; - ///* LightPost */ - //LightDesc.bEditMode = false; - //LightDesc.isShake = false; - //LightDesc.iGlassMeshIndex = 0; - //LightDesc.vRadius = _float2(0.f, 0.f); - //LightDesc.vSpeed = _float2(0.f, 0.f); - //LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_LightPost"; - //LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Light_Post_Floating.bin"; - //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc))) - // return E_FAIL; + /* LightPost */ + LightDesc.bEditMode = false; + LightDesc.isShake = false; + LightDesc.iGlassMeshIndex = 0; + LightDesc.vRadius = _float2(0.f, 0.f); + LightDesc.vSpeed = _float2(0.f, 0.f); + LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_LightPost"; + LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/LightPost.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc))) + return E_FAIL; - ///* LightPost_Floating */ - //LightDesc.bEditMode = false; - //LightDesc.isShake = false; - //LightDesc.iGlassMeshIndex = 1; - //LightDesc.vRadius = _float2(0.f, 0.f); - //LightDesc.vSpeed = _float2(0.f, 0.f); - //LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"; - //LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/LightPost.bin"; - //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc))) - // return E_FAIL; + /* LightPost_Floating */ + LightDesc.bEditMode = false; + LightDesc.isShake = false; + LightDesc.iGlassMeshIndex = 1; + LightDesc.vRadius = _float2(0.f, 0.f); + LightDesc.vSpeed = _float2(0.f, 0.f); + LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"; + LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Light_Post_Floating.bin"; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc))) + return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 9a4d4c9bd..c125b1433 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2952,7 +2952,7 @@ HRESULT CLoader::Loading_For_MapViewer() #pragma endregion -_bool bLoadHogsmeade = false; +_bool bLoadHogsmeade = true; if (bLoadHogsmeade) { #pragma region HOGSMEADE_OBJECT @@ -3342,7 +3342,7 @@ vector> jobFutures; _uint iLoadCount = 44; vector*> Contents(iLoadCount); -_bool isLoad_Map = { false }; +_bool isLoad_Map = { true }; if(isLoad_Map) { { /* Terrain */ diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp index 103ece47a..ec9495c9d 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -407,7 +407,7 @@ void CMapObject_LOD::Describe_Entity() _wstring dest = CMyTools::ToWstring(m_pModelComs[iModelIndex]->Get_MeshName(iMeshIndex) + to_string(iMeshIndex)).c_str(); Desc.pMeshName = dest.c_str(); Desc.iSubKind = 998; - + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); if (FAILED(Add_Asset_Component(g_iStaticLevel, Desc.pMeshName, nullptr, &Desc))) { assert(false); } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 183133faf..82d8af06c 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -65,9 +65,9 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) m_iContainerObjectIndex = 99; - /*if (FAILED(Load_MapData("Hogsmeade_MapContainer_Data", LAYER_HOGSMEADE))) + if (FAILED(Load_MapData("Hogsmeade_MapContainer_Data", LAYER_HOGSMEADE))) return E_FAIL; - */ + //m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); diff --git a/Jusin154_Team3D/Editor/Private/Terrain.cpp b/Jusin154_Team3D/Editor/Private/Terrain.cpp index c6ba187c0..479672b13 100644 --- a/Jusin154_Team3D/Editor/Private/Terrain.cpp +++ b/Jusin154_Team3D/Editor/Private/Terrain.cpp @@ -64,6 +64,7 @@ HRESULT CTerrain::Initialize(void* pArg) CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{}; Desc.pMeshName = TEXT("Hogsmeade_HeightMap"); Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); + Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr(); /* Com_RigidBody */ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"), reinterpret_cast(&m_pRigidBody), &Desc))) { @@ -305,36 +306,35 @@ void CTerrain::Describe_Entity() GUI::Begin("Terrain"); #pragma region ALPHA_MAP - GUI::InputInt("Color", &m_iColorIndex); - m_iColorIndex = max(0, min(4, m_iColorIndex)); + //GUI::InputInt("Color", &m_iColorIndex); + //m_iColorIndex = max(0, min(4, m_iColorIndex)); GUI::InputInt("Rnage", (_int*)(&m_iMaskRange)); - GUI::DragFloat("Value", &m_fMaskValue, 0.01f, -1.0f, 1.f); - if (GUI::Button("Save", ImVec2(100.f, 30.f))) - { - m_pAlphaMap->Save_ToFile("Hogwart_AlphaMap.bin"); - } - if (GUI::Button("Load", ImVec2(100.f, 30.f))) - { - m_pAlphaMap->Load_ToFile("Hogwart_AlphaMap.bin"); - } + //GUI::DragFloat("Value", &m_fMaskValue, 0.01f, -1.0f, 1.f); + //if (GUI::Button("Save", ImVec2(100.f, 30.f))) + //{ + // m_pAlphaMap->Save_ToFile("Hogwart_AlphaMap.bin"); + //} + //if (GUI::Button("Load", ImVec2(100.f, 30.f))) + //{ + // m_pAlphaMap->Load_ToFile("Hogwart_AlphaMap.bin"); + //} - m_iMaskRange = max(1, m_iMaskRange); - GUI::DragFloat("Up", &m_fUpValue, 0.01f, -1.0f, 1.f); + m_iMaskRange = max(0, m_iMaskRange); + GUI::InputFloat("Up Value", &m_fUpValue, 0.001f, 0.1f); if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) { if (m_pGameInstance->isPicking(&m_vPickingPosition)) { - //if (m_pGameInstance->Key_Pressing(DIK_PERIOD)) - // m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue, m_vPickingPosition, m_iMaskRange); - //if (m_pGameInstance->Key_Pressing(DIK_COMMA)) - // m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue * -1.f, m_vPickingPosition, m_iMaskRange); + if (m_pGameInstance->Key_Pressing(DIK_PERIOD)) + m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue, m_vPickingPosition, m_iMaskRange); + if (m_pGameInstance->Key_Pressing(DIK_COMMA)) + m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue * -1.f, m_vPickingPosition, m_iMaskRange); - - XMStoreFloat3(&m_vPickingPosition, XMVector3TransformCoord(XMLoadFloat3(&m_vPickingPosition), m_pTransformCom->Get_WorldMatrixInv())); - if(m_pGameInstance->Key_Pressing(DIK_M)) - m_pAlphaMap->Update(m_vPickingPosition, m_iColorIndex, m_fMaskValue, m_iMaskRange); + //XMStoreFloat3(&m_vPickingPosition, XMVector3TransformCoord(XMLoadFloat3(&m_vPickingPosition), m_pTransformCom->Get_WorldMatrixInv())); + //if(m_pGameInstance->Key_Pressing(DIK_M)) + // m_pAlphaMap->Update(m_vPickingPosition, m_iColorIndex, m_fMaskValue, m_iMaskRange); } } @@ -343,9 +343,9 @@ void CTerrain::Describe_Entity() #pragma region HEIGHT MAP HRESULT hr = {}; if(GUI::Button("Save HeightMap")) - hr = m_pVIBufferCom->Save_HeightMap("Hogwart_HeightMap.bin"); + hr = m_pVIBufferCom->Save_HeightMap("Hogsmeade_HeightMap.bin"); if(GUI::Button("Load HeightMap")) - hr = m_pVIBufferCom->Load_HeightMap("Hogwart_HeightMap.bin"); + hr = m_pVIBufferCom->Load_HeightMap("Hogsmeade_HeightMap.bin"); #pragma endregion _float4 vPos = {}; diff --git a/Jusin154_Team3D/Editor/Public/InstancedProp.h b/Jusin154_Team3D/Editor/Public/InstancedProp.h index 30722e8e4..b672c09c8 100644 --- a/Jusin154_Team3D/Editor/Public/InstancedProp.h +++ b/Jusin154_Team3D/Editor/Public/InstancedProp.h @@ -17,6 +17,7 @@ class CInstancedProp final : public CGameObject typedef struct tagInstancedPropDesc { _bool bEditMode{}; + _bool isAddCollider{}; _bool isShake; _float2 vRadius; _float2 vSpeed; diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index b19fbb64d..fefd22ef9 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -1065,6 +1065,10 @@ PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody, { return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel); } +PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix) +{ + return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel, pWorldMatrix); +} PSX::PxJoint* CGameInstance::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1) { return m_pPhysX_Manager->Create_PxJoint(eType, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1); diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index f55f3765c..50a435252 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -72,7 +72,6 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody _matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix(); PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix); - // PxRigidStatic 씬의 정적 바디 인터페이스 PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix); PSX::PxShape* pShape = { nullptr }; @@ -146,6 +145,85 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody return pActorStatic; } +PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix) +{ + _matrix WorldMatrix = XMLoadFloat4x4(pWorldMatrix); + + PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix); + + // PxRigidStatic 씬의 정적 바디 인터페이스 + PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix); + PSX::PxShape* pShape = { nullptr }; + PSX::PxGeometry* pGeometry = { nullptr }; + + switch (RigidBody.Get_Type()) + { + case ACTOR::PLANE: + break; + case ACTOR::TRIANGLEMESH: + { // SetUp Geometry + PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey(), iLevel); + PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr }; + + _vector vPos, vRotq, vScale; + XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix); + vRotq = XMQuaternionNormalize(vRotq); + + PSX::PxTransform out; + XMStoreFloat3((_float3*)&out.p, vPos); + XMStoreFloat4((_float4*)&out.q, vRotq); + PSX::PxMeshScale meshScale( + PSX::PxVec3(fabsf(vScale.m128_f32[0]), fabsf(vScale.m128_f32[1]), fabsf(vScale.m128_f32[2])), + PSX::PxQuat(PSX::PxIdentity) // 스케일 축은 로컬 기준 + ); + pPxMeshGeometry = new PSX::PxTriangleMeshGeometry(pPxMesh, meshScale); + + // GeoFlag 중 더블사이드는 이제 지원 안함, 할거면 노말 뒤집어서 하라고 함 + // pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED; + // 유효성 체크 + PX_ASSERT(pPxMeshGeometry->isValid()); + pGeometry = pPxMeshGeometry; + _bool bEmplaceSuccess = m_TriangleMeshGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry).second; + if (false == bEmplaceSuccess) { + Safe_Delete(pPxMeshGeometry); + pGeometry = (*m_TriangleMeshGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second; + } + } + break; + case ACTOR::HEIGHTFIELD: + { // SetUp HeightField + PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey(), iLevel); + PSX::PxHeightFieldGeometry* pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField); + pPxHeightGeometry->heightScale = 0.01f/* 기본 정밀도 100배 0.01 -> 1cm, 1 -> 1m */; + + // 유효성 체크 + PX_ASSERT(pPxHeightGeometry->isValid()); + pGeometry = pPxHeightGeometry; + _bool bEmplaceSuccess = m_HeightFieldGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxHeightGeometry).second; + if (false == bEmplaceSuccess) { + Safe_Delete(pPxHeightGeometry); + pGeometry = (*m_HeightFieldGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second; + } + } + break; + default: + assert(false); + break; + } + + pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorStatic, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]); + + pShape->setFlags(RigidBody.Get_ShapeFlags()); + pShape->setContactOffset(RigidBody.Get_ContactOffset()); + pShape->setRestOffset(0.f); + + m_pRestBodies[iLevel].insert(pActorStatic); + ApplyFilterData(pActorStatic); + Attach_Actor(*pActorStatic, iLevel); + + return pActorStatic; +} + PSX::PxJoint* CPhysX_Manager::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1) { PSX::PxJoint* pOut = { nullptr }; diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index a0eb90d47..eb1240315 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -588,10 +588,6 @@ void CRenderer::Render_Fog() m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)); m_pShader->Bind_RawValue("g_fDepthPackExponent", m_pGameInstance->Get_DepthPackExponentPtr(), sizeof(_float)); - //if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌 - // assert(false); - //} - if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) { return; } diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp index 22ded3164..3a72a7bd6 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp @@ -32,12 +32,13 @@ HRESULT CRigidBody_Static::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) { return E_FAIL; } + RIGIDBODY_STATIC_DESC* pDesc = static_cast(pArg); m_wstrMeshName = pDesc->pMeshName; m_tagData.pOwner = m_pOwner; XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix()); m_tagData.pBody = this; - m_pRigidBody = m_pGameInstance->Add_StaticActor(*this, m_pGameInstance->Get_NextLevelID()); + m_pRigidBody = m_pGameInstance->Add_StaticActor(*this, m_pGameInstance->Get_NextLevelID(), pDesc->pWorldMatrix); m_pRigidBody->userData = &m_tagData; m_pRigidBody->setName(CMyTools::ToString(m_wstrMeshName).c_str()); diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp index 1fe4a9844..f865ade8c 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_Model_Instance.cpp @@ -40,6 +40,28 @@ CVIBuffer_Model_Instance::CVIBuffer_Model_Instance(const CVIBuffer_Model_Instanc } } +const _char* CVIBuffer_Model_Instance::Get_MeshName(_uint iMeshIndex) +{ + if (m_iNumMeshes <= iMeshIndex) + return nullptr; + + return m_Meshes[iMeshIndex]->Get_Name(); +} + +HRESULT CVIBuffer_Model_Instance::Ready_PhysXMeshes(_uint iLevel) +{ + m_iNumPhysXMeshes = m_iNumMeshes; + + m_TriMeshes.reserve(m_iNumMeshes); + + m_pGameInstance->ConvertToTriMeshes(m_Meshes, m_TriMeshes); + + for (_uint i = 0; i < m_iNumMeshes; ++i) { + m_pGameInstance->RegistTriMesh((m_Meshes[i]->Get_Name() + to_string(i)).c_str(), m_TriMeshes[i], iLevel); + } + return S_OK; +} + HRESULT CVIBuffer_Model_Instance::Initialize_Prototype(const _char* pModelFilePath, const _char* pMatrialPath) { if (FAILED(Load_ModelData(pModelFilePath))) diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 748f6d6e3..773fe4848 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -218,6 +218,7 @@ class ENGINE_DLL CGameInstance final : public CBase void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel); PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel); PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel); + PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix); PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1); PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos); diff --git a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h index 2d2d57264..4ca453131 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h +++ b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h @@ -33,7 +33,8 @@ class CPhysX_Manager final : public CBase PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel); PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel); - + PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix); + // https://documentation.help/nvidia-physx-sdk-guide/Joints.html PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1); PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos); diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Static.h b/Jusin154_Team3D/Engine/Public/RigidBody_Static.h index 7fa36eb73..9ac25e160 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Static.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Static.h @@ -16,7 +16,8 @@ class ENGINE_DLL CRigidBody_Static : public CRigidBody typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_DESC { - const _tchar* pMeshName = { nullptr }; + const _tchar* pMeshName = { nullptr }; + const _float4x4* pWorldMatrix = { nullptr }; }RIGIDBODY_STATIC_DESC; private: diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_Model_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_Model_Instance.h index 9484a81a3..8e30d50b8 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_Model_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_Model_Instance.h @@ -27,6 +27,9 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance public: _uint Get_NumMesh() const { return m_iNumMeshes; } + const _char* Get_MeshName(_uint iMeshIndex); + HRESULT Ready_PhysXMeshes(_uint iLevel); + public: virtual HRESULT Initialize_Prototype(const _char* pModelFilePath, const _char* pMatrialPath); @@ -46,6 +49,8 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance _uint m_iCurrentNumInstance = {}; _uint m_iMaxNumInstance = {}; + _uint m_iNumPhysXMeshes = {}; + _float m_fTimeAcc = {}; class CComputeShader* m_pComputeShader = { nullptr }; @@ -60,6 +65,7 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance vector> m_MeshMaterialPathes = {}; + vector m_TriMeshes = {}; private: HRESULT Reay_Instance_Buffer(); HRESULT Load_InstanceData(ifstream& in);