From 861ea610dc6d8fa62c4cbb9d00b7775561a28e64 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 13 Nov 2025 19:22:06 +0900 Subject: [PATCH] =?UTF-8?q?[add]=20=ED=94=BC=EC=A7=81=EC=8A=A4=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EB=94=94=EB=B2=84=EA=B7=B8=20=EB=93=9C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 2 + .../Editor/Default/Editor.vcxproj.filters | 6 + .../Editor/Private/Dummy_PhysXBox.cpp | 26 +++-- .../Editor/Private/Dummy_PhysXPlayable.cpp | 24 ++-- .../Editor/Private/Information.cpp | 86 ++++++++++++++ Jusin154_Team3D/Editor/Public/Information.h | 60 ++++++++++ .../Engine/Private/Character_Controller.cpp | 3 +- Jusin154_Team3D/Engine/Private/RigidBody.cpp | 108 ++++++++++++++---- Jusin154_Team3D/Engine/Public/RigidBody.h | 22 +++- 9 files changed, 286 insertions(+), 51 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Private/Information.cpp create mode 100644 Jusin154_Team3D/Editor/Public/Information.h diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 8f15dadeb..ffc59e6ae 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -172,6 +172,7 @@ + @@ -238,6 +239,7 @@ + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 882f752d3..88d1d739d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -405,6 +405,9 @@ 02.GameObjects\Dummys\DummySkyBox + + 03.Information + @@ -604,6 +607,9 @@ 02.GameObjects\Dummys\DummySkyBox + + 03.Information + diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp index 72f8668cd..07e8045ee 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp @@ -50,20 +50,26 @@ void CDummy_PhysXBox::Late_Update(_float fTimeDelta) HRESULT CDummy_PhysXBox::Render() { - if (FAILED(Bind_ShaderResources())) { - return E_FAIL; - } + //if (FAILED(Bind_ShaderResources())) { + // return E_FAIL; + //} - if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; - } + //if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + // return E_FAIL; + //} - if (FAILED(m_pModelCom->Render(0))) { + //if (FAILED(m_pModelCom->Render(0))) { + // return E_FAIL; + //} +#ifdef _DEBUG + if (FAILED(m_pRigidBody->Render())) { return E_FAIL; } +#endif // _DEBUG + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp index cdeb29156..f6677f98d 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp @@ -53,20 +53,20 @@ void CDummy_PhysXPlayable::Late_Update(_float fTimeDelta) HRESULT CDummy_PhysXPlayable::Render() { - if (FAILED(Bind_ShaderResources())) { - return E_FAIL; - } + //if (FAILED(Bind_ShaderResources())) { + // return E_FAIL; + //} - if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; - } + //if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + // return E_FAIL; + //} + //if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + // return E_FAIL; + //} - if (FAILED(m_pModelCom->Render(0))) { - return E_FAIL; - } + //if (FAILED(m_pModelCom->Render(0))) { + // return E_FAIL; + //} #ifdef _DEBUG if (FAILED(m_pCharacter_Controller->Render())) { return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Information.cpp b/Jusin154_Team3D/Editor/Private/Information.cpp new file mode 100644 index 000000000..aab0c25df --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Information.cpp @@ -0,0 +1,86 @@ +#include "pch.h" + +#include "Information.h" + +IMPLEMENT_SINGLETON(CInformation) + + +HRESULT CInformation::Initialize_Info(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + m_pDevice = pDevice; + m_pContext = pContext; + SAFE_ADDREF(m_pDevice); + SAFE_ADDREF(m_pContext); + + + + return S_OK; +} + +HRESULT CInformation::Release_Info() +{ + if (nullptr == s_pInstance) { + return S_OK; + } + DestroyInstance(); + + //SAFE_RELEASE(); + //SAFE_RELEASE(); + + return S_OK; +} + +_bool CInformation::strListBox(const _char* Label, _int& iCurrentIndex, vector<_string>& contents) +{ + assert(iCurrentIndex < contents.size()); + assert(iCurrentIndex >= 0); + return GUI::ListBox(Label, &iCurrentIndex, [](void* data, _int iIndex)->const _char* + { + auto vec = static_cast*>(data); + return (*vec)[iIndex].c_str(); + }, &contents, (_int)(contents.size()) + ); +} + +_bool CInformation::wstrListBox(const _char* Label, _int& iCurrentIndex, vector<_wstring>& contents) +{ + assert(iCurrentIndex < contents.size()); + assert(iCurrentIndex >= 0); + return GUI::ListBox(Label, &iCurrentIndex, [](void* data, _int iIndex)->const _char* + { + auto vec = static_cast*>(data); + return CMyTools::ToString((*vec)[iIndex]).c_str(); + }, &contents, (_int)(contents.size()) + ); +} + +void CInformation::Log_Render() +{ + GUI::Begin("Log"); + GUI::Text(m_strLog.c_str()); + GUI::End(); +} + +void CInformation::Log_Push(const _char* pContents) +{ + m_strLog.append(_string("\n") + pContents); +} + +void CInformation::Log_Clear() +{ + m_strLog.clear(); +} + +CInformation::CInformation() +{ +} + +void CInformation::Free() +{ + __super::Free(); + + + + SAFE_RELEASE(m_pDevice); + SAFE_RELEASE(m_pContext); +} diff --git a/Jusin154_Team3D/Editor/Public/Information.h b/Jusin154_Team3D/Editor/Public/Information.h new file mode 100644 index 000000000..77b8932ea --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Information.h @@ -0,0 +1,60 @@ +#pragma once + +#include "Base.h" +#include "Editor_Define.h" + +NS_BEGIN(Editor) + +typedef class CInformation final : public CBase +{ + DECLARE_SINGLETON(CInformation) +public: + HRESULT Initialize_Info(ID3D11Device* pDevice = nullptr, ID3D11DeviceContext* pContext = nullptr); + HRESULT Release_Info(); +#pragma region WHOLEPART + _bool strListBox(const _char* Label, _int& iCurrentIndex, vector<_string>& contents); + _bool wstrListBox(const _char* Label, _int& iCurrentIndex, vector<_wstring>& contents); + +#pragma endregion // 전역 + +#pragma region OBJECTVIEWER + +#pragma endregion +#pragma region MAPVIEWER + +#pragma endregion +#pragma region EFFECTVIEWER + +#pragma endregion +#pragma region UIVIEWER + +#pragma endregion +#pragma region PHYSXVIEWER + +#pragma endregion +#pragma region COMBINEDVIEWER + +#pragma endregion + +public: +#pragma region LOG + void Log_Render(); + void Log_Push(const _char* pContents); + void Log_Clear(); +#pragma endregion + +private: + ID3D11Device* m_pDevice = { nullptr }; + ID3D11DeviceContext* m_pContext = { nullptr }; + class CGameInstance* m_pGameInstance = { nullptr }; + + _string m_strLog = {}; + + +private: + CInformation(); + virtual ~CInformation() = default; + virtual void Free() override; +}INFO; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp index 435ff750d..bee442a08 100644 --- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp +++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp @@ -53,8 +53,7 @@ HRESULT CCharacter_Controller::Render() m_pSubShape->Draw(ScaleSphereMatrix * WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); m_pSubShape->Draw(ScaleSphereMatrix * WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); - } - break; + } break; default: break; } diff --git a/Jusin154_Team3D/Engine/Private/RigidBody.cpp b/Jusin154_Team3D/Engine/Private/RigidBody.cpp index 155a5ea53..f7d42b472 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody.cpp @@ -18,8 +18,39 @@ CRigidBody::CRigidBody(const CRigidBody& rhs): m_bExclusive(rhs.m_bExclusive), m_bKinematic(rhs.m_bKinematic) { - //m_pMaterial->acquireReference(); } +#ifdef _DEBUG +HRESULT CRigidBody::Render() +{ + _matrix WorldMatrix = m_pTransform->Get_XMWorldMatrix(); + _matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f); + + switch (m_eActorType) + { + case ACTOR::BOX: + { + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + } break; + case ACTOR::CAPSULE: + { + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + _matrix WorldUp = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * m_vhalfGeometryInfo.y); + _matrix WorldDown = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * -m_vhalfGeometryInfo.y); + m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + } break; + case ACTOR::SPHERE: + { + m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true); + } break; + default: + break; + } + return S_OK; +} +#endif // _DEBUG HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc) { @@ -29,31 +60,22 @@ HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc) case ACTOR::BOX: case ACTOR::CAPSULE: case ACTOR::SPHERE: - m_pMaterial = m_pGameInstance->Get_Material(Desc.tRigidDynamicDesc.vMatInfo); - m_vhalfGeometryInfo = Desc.tRigidDynamicDesc.vhalfGeometryInfo; - m_bExclusive = Desc.tRigidDynamicDesc.bExclusive; - m_pShape = m_pGameInstance->Create_Shape(m_eActorType, m_vhalfGeometryInfo, *m_pMaterial, m_bExclusive, Desc.tRigidDynamicDesc.ePxShapeFlag); - if (nullptr == m_pShape) { - assert(false); - m_pMaterial->release(); - m_pMaterial = nullptr; - return E_FAIL; - } + Add_DynamicPrototype(Desc); break; case ACTOR::PLANE: - break; case ACTOR::TRIANGLEMESH: - { - m_pMaterial = m_pGameInstance->Get_Material(Desc.tRigidDynamicDesc.vMatInfo); - m_wstrMeshKey = CMyTools::ToWstring(Desc.tRigidStaticDesc.szMeshName); - } - break; case ACTOR::HEIGHTFIELD: break; default: break; } - return S_OK; + +#ifdef _DEBUG + if (FAILED(Add_DebugShape())) { + return E_FAIL; + } +#endif // _DEBUG + return S_OK; } @@ -92,12 +114,54 @@ HRESULT CRigidBody::Initialize(void* pArg) default: break; } - - +#ifdef _DEBUG + Add_DebugShape(); +#endif // _DEBUG return S_OK; } +HRESULT CRigidBody::Add_DynamicPrototype(RIGIDBODY_PROTOTYPEDESC& Desc) +{ + m_pMaterial = m_pGameInstance->Get_Material(Desc.tRigidDynamicDesc.vMatInfo); + m_vhalfGeometryInfo = Desc.tRigidDynamicDesc.vhalfGeometryInfo; + m_bExclusive = Desc.tRigidDynamicDesc.bExclusive; + m_pShape = m_pGameInstance->Create_Shape(m_eActorType, m_vhalfGeometryInfo, *m_pMaterial, m_bExclusive, Desc.tRigidDynamicDesc.ePxShapeFlag); + if (nullptr == m_pShape) { + assert(false); + m_pMaterial->release(); + m_pMaterial = nullptr; + return E_FAIL; + } + return S_OK; +} + +#ifdef _DEBUG +HRESULT CRigidBody::Add_DebugShape() +{ + switch (m_eActorType) + { + case ACTOR::BOX: + m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, m_vhalfGeometryInfo, false, false)); + break; + case ACTOR::CAPSULE: + m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false)); + m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, m_vhalfGeometryInfo.y, m_vhalfGeometryInfo.x, 10, false)); + break; + case ACTOR::SPHERE: + m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false)); + break; + case ACTOR::PLANE: + case ACTOR::TRIANGLEMESH: + case ACTOR::HEIGHTFIELD: + break; + default: + break; + } + return S_OK; +} +#endif // _DEBUG + CRigidBody* CRigidBody::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPEDESC& Desc) { CRigidBody* pInstance = new CRigidBody(pDevice, pContext); @@ -127,10 +191,6 @@ void CRigidBody::Free() __super::Free(); SAFE_RELEASE(m_pTransform); - //if (nullptr != m_pMaterial) { - // m_pMaterial->release(); - // m_pMaterial = nullptr; - //} } void CRigidBody::Describe_Entity() diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h index 9bd599f90..e30f24581 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody.h @@ -26,6 +26,8 @@ class ENGINE_DLL CRigidBody final : public CComponent PSX::PxShapeFlags ePxShapeFlag = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; }RIGID_DYNAMIC_PROTOTYPEDESC; + + typedef struct tagRigidBody_PrototypeDesc { ACTOR eType; @@ -65,6 +67,11 @@ class ENGINE_DLL CRigidBody final : public CComponent CRigidBody(const CRigidBody& rhs); virtual ~CRigidBody() = default; public: +#ifdef _DEBUG + virtual HRESULT Render()override; +#endif // _DEBUG + + ACTOR Get_Type() const { return m_eActorType; } PSX::PxShape* Get_ShapePtr() const { return m_pShape; } CTransform* Get_PxTransformPtr() const { return m_pTransform; } @@ -76,9 +83,9 @@ class ENGINE_DLL CRigidBody final : public CComponent private: ACTOR m_eActorType = ACTOR::END; - const PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체 - PSX::PxMaterial* m_pMaterial = { nullptr }; // 피직스 객체의 속성 등 - PSX::PxShape* m_pShape = { nullptr }; // 피직스 객체의 모양 ( 머테리얼로 만들어짐 ) + const PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체 + PSX::PxMaterial* m_pMaterial = { nullptr }; // 피직스 객체의 속성 등 + PSX::PxShape* m_pShape = { nullptr }; // 피직스 객체의 모양 ( 머테리얼로 만들어짐 ) _float3 m_vhalfGeometryInfo = {}; _float m_fContactOffset = { 0.05f }; CTransform* m_pTransform = { nullptr }; @@ -88,8 +95,17 @@ class ENGINE_DLL CRigidBody final : public CComponent _wstring m_wstrMeshKey = { }; private: +#ifdef _DEBUG + unique_ptr m_pMainShape = { nullptr }; + unique_ptr m_pSubShape = { nullptr }; +#endif // _DEBUG + HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc); HRESULT Initialize(void* pArg); + HRESULT Add_DynamicPrototype(RIGIDBODY_PROTOTYPEDESC& Desc); +#ifdef _DEBUG + HRESULT Add_DebugShape(); +#endif public: static CRigidBody* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPEDESC& Desc);