diff --git a/Jusin154_Team3D/.editorconfig b/Jusin154_Team3D/.editorconfig
index 3c2b1f208..51486a1fb 100644
--- a/Jusin154_Team3D/.editorconfig
+++ b/Jusin154_Team3D/.editorconfig
@@ -1,13 +1,26 @@
#sln
+# h ì €ìž¥í˜•ì‹� ì§€ì •
+[*.h]
+charset = utf-8-bom
+insert_final_newline = true
+end_of_line = crlf
+
+# cpp ì €ìž¥í˜•ì‹� ì§€ì •
+[*.cpp]
+charset = utf-8-bom
+insert_final_newline = true
+end_of_line = crlf
+
+
# hlsl ì €ìž¥í˜•ì‹� ì§€ì •
[*.hlsl]
-charset = utf-8
+charset = utf-8-bom
insert_final_newline = true
end_of_line = crlf
# hlsli ì €ìž¥í˜•ì‹� ì§€ì •
[*.hlsli]
-charset = utf-8
+charset = utf-8-bom
insert_final_newline = true
end_of_line = crlf
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
index 69c236b93..5fee516e1 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
@@ -172,6 +172,7 @@
+
@@ -236,6 +237,7 @@
+
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
index ae2078d47..762ab4e89 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
@@ -393,6 +393,9 @@
02.GameObjects\Dummys\DummySkyBox
+
+ 03.Information
+
@@ -586,6 +589,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 748af56c8..71e22c420 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
@@ -43,8 +43,9 @@ void CDummy_PhysXBox::Update(_float fTimeDelta)
void CDummy_PhysXBox::Late_Update(_float fTimeDelta)
{
- //_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
- //m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
+ _float4 vPos;
+ XMStoreFloat4(&vPos, Get_WorldPostion());
+ m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
}
HRESULT CDummy_PhysXBox::Render()
@@ -53,26 +54,21 @@ HRESULT CDummy_PhysXBox::Render()
// return E_FAIL;
//}
-
- //_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
-
- //for (_uint i = 0; i < iNumMeshes; i++)
- //{
- // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- // return E_FAIL;
- // }
- // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- // return E_FAIL;
- // }
-
- // if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SKYBOX)))) {
- // return E_FAIL;
- // }
-
- // if (FAILED(m_pModelCom->Render(i))) {
- // 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;
+ //}
+#ifdef _DEBUG
+ if (FAILED(m_pRigidBody->Render())) {
+ return E_FAIL;
+ }
+#endif // _DEBUG
return S_OK;
@@ -91,39 +87,40 @@ HRESULT CDummy_PhysXBox::Ready_Components(void* pArg)
{ // RIGID_BODY
CRigidBody::RIGIDBODY_DESC Desc{};
- Desc.tRigidDynamicDesc.bIsKinematic = false;
- Desc.tRigidDynamicDesc.fDensity = 1000.f;
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
return E_FAIL;
}
-
- m_pActor = m_pGameInstance->Add_DynamicActor(*m_pRigidBody);
- if (nullptr == m_pActor) {
- assert(false);
- return E_FAIL;
- }
-
}
+ /* Com_Shader */
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
+ reinterpret_cast(&m_pShaderCom))))
+ return E_FAIL;
+
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Box"), (CComponent**)&m_pModelCom))) {
+ return E_FAIL;
+ }
+
+
return S_OK;
}
HRESULT CDummy_PhysXBox::Bind_ShaderResources()
{
- //if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
- // return E_FAIL;
- //}
- //if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
- // return E_FAIL;
- //}
- //if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
- // return E_FAIL;
- //}
+ if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
+ return E_FAIL;
+ }
- //if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
- // return E_FAIL;
- //}
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
+ return E_FAIL;
+ }
return S_OK;
}
@@ -158,8 +155,8 @@ void CDummy_PhysXBox::Free()
__super::Free();
SAFE_RELEASE(m_pRigidBody);
- //SAFE_RELEASE(m_pModelCom);
- //SAFE_RELEASE(m_pShaderCom);
+ Safe_Release(m_pShaderCom);
+ Safe_Release(m_pModelCom);
}
void CDummy_PhysXBox::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
index cbf2b0e7f..b7abf064a 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
@@ -34,32 +34,6 @@ HRESULT CDummy_PhysXMesh::Initialize(void* pArg)
void CDummy_PhysXMesh::Priority_Update(_float fTimeDelta)
{
- if (m_pGameInstance->Key_Down(DIK_F2)) {
- CModel* pModel = Get_Component();
- _uint iNumMesh = pModel->Get_NumMeshes();
- pModel->Save_PhysXTriMeshes("../Bin/Resources/Models/River/River.bin");
-
- CRigidBody::RIGIDBODY_DESC Desc{};
- Desc.eType = ACTOR::TRIANGLEMESH;
- for (_uint i = 0; i < iNumMesh; ++i)
- { // RIGID_BODY
- Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i);
-
- Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(pModel->Get_MeshName(i)).c_str(), nullptr, &Desc);
- }
- }
- if (m_pGameInstance->Key_Down(DIK_F3)) {
- CModel* pModel = Get_Component();
- _uint iNumMesh = pModel->Get_NumMeshes();
- CRigidBody::RIGIDBODY_DESC Desc{};
- Desc.eType = ACTOR::TRIANGLEMESH;
- for (_uint i = 0; i < iNumMesh; ++i)
- { // RIGID_BODY
- Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i);
-
- Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(pModel->Get_MeshName(i)).c_str(), nullptr, &Desc);
- }
- }
}
void CDummy_PhysXMesh::Update(_float fTimeDelta)
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
index 9bf8e5261..918bdd082 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
@@ -16,29 +16,32 @@ CDummy_PhysXPlayable::CDummy_PhysXPlayable(const CDummy_PhysXPlayable& rhs):
void CDummy_PhysXPlayable::Priority_Update(_float fTimeDelta)
{
m_pTransformCom->RewindMomentum();
+ m_pTransformCom->Set_State(STATE::POSITION, m_pCharacter_Controller->Get_Position());
}
void CDummy_PhysXPlayable::Update(_float fTimeDelta)
{
- if (m_pGameInstance->Key_Pressing(DIK_W)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 0.f, 1.f, 0.f));
+ if (m_pGameInstance->Key_Pressing(DIK_UPARROW)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 0.f, 1.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
}
- if (m_pGameInstance->Key_Pressing(DIK_A)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(-1.f, 0.f, 0.f, 0.f));
+ if (m_pGameInstance->Key_Pressing(DIK_LEFT)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(-1.f, 0.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
}
- if (m_pGameInstance->Key_Pressing(DIK_S)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 0.f, -1.f, 0.f));
+ if (m_pGameInstance->Key_Pressing(DIK_DOWN)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 0.f, -1.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
}
- if (m_pGameInstance->Key_Pressing(DIK_D)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(1.f, 0.f, 0.f, 0.f));
+ if (m_pGameInstance->Key_Pressing(DIK_RIGHT)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(1.f, 0.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
}
- if (m_pGameInstance->Key_Pressing(DIK_SPACE)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 10.f, 0.f, 0.f));
+ if (m_pGameInstance->Key_Pressing(DIK_LCONTROL)) {
+ if (m_pGameInstance->Key_Pressing(DIK_SPACE)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, 10.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
+ }
+ if (m_pGameInstance->Key_Pressing(DIK_C)) {
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -10.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
+ }
}
- if (m_pGameInstance->Key_Pressing(DIK_C)) {
- m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -10.f, 0.f, 0.f));
- }
- //m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY, 0.f, 0.f));
+ m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f));
m_pCharacter_Controller->Move(fTimeDelta);
}
@@ -52,34 +55,25 @@ void CDummy_PhysXPlayable::Late_Update(_float fTimeDelta)
HRESULT CDummy_PhysXPlayable::Render()
{
- if (FAILED(Bind_ShaderResources())) {
+ //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->Render(0))) {
+ // return E_FAIL;
+ //}
+#ifdef _DEBUG
+ if (FAILED(m_pCharacter_Controller->Render())) {
return E_FAIL;
}
-
- _uint iNumMeshes = m_pModelCom->Get_NumMeshes();
-
- //m_pShaderCom->Bind_SRV("g_NormalTexture", nullptr);
- for (_uint i = 0; i < iNumMeshes; i++)
- {
- //if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
- // return E_FAIL;
- //}
-
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
- if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
- return E_FAIL;
- }
-
- if (FAILED(m_pModelCom->Render(i))) {
- return E_FAIL;
- }
- }
+#endif // _DEBUG
return S_OK;
}
@@ -104,9 +98,16 @@ HRESULT CDummy_PhysXPlayable::Initialize(void* pArg)
HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
{
- if (FAILED(__super::Ready_Components(nullptr))) {
+ CTransform::TRANSFORM_DESC TransformDesc{};
+ TransformDesc.fRadius = 100.f;
+ TransformDesc.fRotationPerSec = XMConvertToRadians(60.f);
+ TransformDesc.fSpeedPerSec = 30.f;
+ if (FAILED(__super::Ready_Components(&TransformDesc))) {
return E_FAIL;
}
+ PlayableSTARTPOS_DESC* pDesc = static_cast(pArg);
+ m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPos), 1.f));
+ m_pTransformCom->Rotation(pDesc->vRotRPY.x, pDesc->vRotRPY.y, pDesc->vRotRPY.z);
{
CCharacter_Controller::Character_Controller_DESC Desc{};
@@ -116,22 +117,24 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
Desc.fMaterial = { 0.5f, 0.5f, 0.6f };
Desc.bAutoStepping = { false };
Desc.fStepOffset = { 0.05f };
- Desc.tCapsuleInfo.fRadius = 1.5f;
- Desc.tCapsuleInfo.fHeight = 3.0f;
+ Desc.tCapsuleInfo.fRadius = 0.5f;
+ Desc.tCapsuleInfo.fHeight = 1.0f;
Desc.tCapsuleInfo.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) {
return E_FAIL;
}
}
+ m_pCharacter_Controller->Set_Position(m_pTransformCom->Get_State(STATE::POSITION));
/* Com_Shader */
- if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH,
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
reinterpret_cast(&m_pShaderCom))))
return E_FAIL;
- //m_pModelCom->Change_AnimationIndex(0, true, 0.4f, true);
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Box"), (CComponent**)&m_pModelCom))) {
+ return E_FAIL;
+ }
- return S_OK;
return S_OK;
}
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/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp
index 344c79e51..54db9e602 100644
--- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp
+++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp
@@ -97,24 +97,24 @@ HRESULT CLevel_PhysXLab::Ready_Layer_Terrain(const _wstring& strLayerTag)
HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag)
{
- //for (int i = 0; i < 50; ++i) {
- // CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{};
- // Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) };
- // Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) };
+ for (int i = 0; i < 50; ++i) {
+ CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{};
+ Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) };
+ Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) };
- // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) {
- // return E_FAIL;
- // }
- //}
- //
- //{
- // CDummy_PhysXPlayable::BOXSTARTPOS_DESC Desc{};
- // Desc.vPos = { 0.f, 10.f, 0.f };
- // Desc.vRotRPY = { 0.f, 0.f, 0.f };
- // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) {
- // return E_FAIL;
- // }
- //}
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) {
+ return E_FAIL;
+ }
+ }
+
+ {
+ CDummy_PhysXPlayable::PlayableSTARTPOS_DESC Desc{};
+ Desc.vPos = { 0.f, 100.f, 0.f };
+ Desc.vRotRPY = { 0.f, 0.f, 0.f };
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) {
+ return E_FAIL;
+ }
+ }
//{
// CDummy_PhysXMesh::BOXSTARTPOS_DESC Desc{};
diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp
index 42d8358e5..036e8ed73 100644
--- a/Jusin154_Team3D/Editor/Private/Loader.cpp
+++ b/Jusin154_Team3D/Editor/Private/Loader.cpp
@@ -495,23 +495,23 @@ HRESULT CLoader::Loading_For_PhysXLevel()
{
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
- Desc.tRigidDynamicDesc.bExclusive = false;
- Desc.tRigidDynamicDesc.vhalfGeometryInfo = { 0.5f, 0.5f, 0.5f };
- Desc.tRigidDynamicDesc.vMatInfo = { 0.5f, 0.5f, 0.6f };
- Desc.tRigidDynamicDesc.ePxShapeFlag = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
-
+ {
+ Desc.eType = ACTOR::BOX;
+ Desc.ePxRigidBodyFlags = {};
+ Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
+ Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT };
+ Desc.vMatInfo = { 0.5f, 0.5f, 0.6f };
+ Desc.fContactOffset = { 0.05f };
+ Desc.vhalfGeometryInfo = { 1.f, 1.f, 1.f };
+ Desc.fDensity = 10.f;
+ }
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
return E_FAIL;
}
}
- //if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"),
- // //CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
- // CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
- // return E_FAIL;
- //}
-
{
+
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) {
return E_FAIL;
}
@@ -526,17 +526,17 @@ HRESULT CLoader::Loading_For_PhysXLevel()
m_strMessage = TEXT("Model Loading..");
- //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Box"),
- // CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))){
- // return E_FAIL;
- //}
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Box"),
+ CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
+ return E_FAIL;
+ }
#ifdef 기무리
vector<_wstring> ModelPrototypeTags = {};
vector ModelPrototypePath = {};
//for (const auto& file : filesystem::directory_iterator("..\\Bin\\Resources\\Models\\MapMesh"))
- for (const auto& file : filesystem::directory_iterator("C:\\Users\\kimnuri\\Desktop\\Hogwart\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain"))
+ for (const auto& file : filesystem::directory_iterator("C:\\Users\\kimnuri\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain"))
{
if (file.is_directory()){
continue;
@@ -569,10 +569,16 @@ HRESULT CLoader::Loading_For_PhysXLevel()
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
for (_uint i = 0; i < iNumMesh; ++i) {
- Desc.eType = ACTOR::TRIANGLEMESH;
- Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i);
- Desc.tRigidStaticDesc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
- if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(Desc.tRigidStaticDesc.szMeshName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
+ _string strDestName = pModel->Get_MeshName(i) + to_string(i);
+ {
+ 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.f;
+ }
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
return E_FAIL;
}
}
@@ -834,12 +840,19 @@ HRESULT CLoader::Loading_For_MapViewer()
_uint iNumMesh = pModel->Get_NumMeshes();
+
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
for (_uint i = 0; i < iNumMesh; ++i) {
- Desc.eType = ACTOR::TRIANGLEMESH;
- Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i);
- Desc.tRigidStaticDesc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
- if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(Desc.tRigidStaticDesc.szMeshName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
+ _string strDestName = pModel->Get_MeshName(i) + to_string(i);
+ {
+ 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.f;
+ }
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
return E_FAIL;
}
}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
index def354f62..0f9956dc8 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
@@ -284,22 +284,21 @@ void CMapObject_LOD::Describe_Entity()
GUI::SameLine();
if (GUI::Button("Bake!!!")) {
CMapObject_Manager* pManager = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_MAPOBJECTMANAGER)->Get_Object();
- for (_uint i = 0; i < (_uint)m_ModelPrototypeTags.size(); ++i) {
+ for (_uint i = 0; i < (_uint)m_ModelPathIndices.size(); ++i) {
filesystem::path filePath = pManager->Get_PrototypePath(m_ModelPathIndices[i]);
CModel* pModel = m_pModelComs[i];
_uint iNumMesh = pModel->Get_NumMeshes();
pModel->Save_PhysXTriMeshes(filePath.string().c_str());
-
CRigidBody::RIGIDBODY_DESC Desc{};
- Desc.eType = ACTOR::TRIANGLEMESH;
for (_uint i = 0; i < iNumMesh; ++i)
{ // RIGID_BODY
- Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i);
+ _string strDestName = pModel->Get_MeshName(i) + to_string(i);
+ Desc.szMeshName = strDestName.c_str();
- if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(pModel->Get_MeshName(i)).c_str(), nullptr, &Desc))) {
+ if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), nullptr, &Desc))) {
assert(false);
}
}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
index cd092cb15..67cc3c8f8 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "MapObject_Manager.h"
#include "GameInstance.h"
@@ -374,7 +374,7 @@ HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName)
#pragma endregion
- // ÀúÀå
+ // ÀúÀå
if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) {
MSG_BOX("Failed to Save File");
}
@@ -451,7 +451,7 @@ HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _ch
for (_uint i = 0; i < pMapObject->Get_LodLevel() + 1; ++i)
{
- // ÅØ½ºÆ®
+ // ÅØ½ºÆ®
tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag");
proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag(i)).c_str());
PartObject->InsertEndChild(proto);
@@ -498,7 +498,7 @@ HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _ch
m_pSelectObject = nullptr;
#pragma endregion
- // ÀúÀå
+ // ÀúÀå
if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) {
MSG_BOX("Failed to Save File");
}
@@ -1117,4 +1117,4 @@ void CMapObject_Manager::Free()
void CMapObject_Manager::Describe_Entity()
{
-}
\ No newline at end of file
+}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
index e54c46af8..69b4f1871 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
@@ -254,13 +254,11 @@ void CMapObject_Static::Describe_Entity()
_uint iNumMesh = m_pModelCom->Get_NumMeshes();
CRigidBody::RIGIDBODY_DESC Desc{};
- Desc.eType = ACTOR::TRIANGLEMESH;
-
for (_uint i = 0; i < iNumMesh; ++i)
{ // RIGID_BODY
- Desc.tRigidStaticDesc.szMeshName = m_pModelCom->Get_MeshName(i);
+ Desc.szMeshName = _string(m_pModelCom->Get_MeshName(i) + to_string(i)).c_str();
- if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(m_pModelCom->Get_MeshName(i)).c_str(), nullptr, &Desc))) {
+ if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(Desc.szMeshName).c_str(), nullptr, &Desc))) {
assert(false);
}
}
diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h
index 706670cd6..00f39daa0 100644
--- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h
+++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h
@@ -33,8 +33,8 @@ class CDummy_PhysXBox final : public CGameObject
private:
CRigidBody* m_pRigidBody = { nullptr };
const PSX::PxRigidDynamic* m_pActor = { nullptr };
- //CModel* m_pModelCom = { nullptr };
- //CShader* m_pShaderCom = { nullptr };
+ CModel* m_pModelCom = { nullptr };
+ CShader* m_pShaderCom = { nullptr };
private:
diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h
index 97fa5d0e3..44d4b7f3b 100644
--- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h
+++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h
@@ -14,11 +14,11 @@ NS_BEGIN(Editor)
class CDummy_PhysXPlayable final : public CGameObject
{
public:
- typedef struct tagBoxStartPos
+ typedef struct tagPlayableStartPos
{
_float3 vPos = {};
_float3 vRotRPY = {};
- }BOXSTARTPOS_DESC;
+ }PlayableSTARTPOS_DESC;
private:
CDummy_PhysXPlayable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CDummy_PhysXPlayable(const CDummy_PhysXPlayable& rhs);
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 6cc49ee53..c518f534b 100644
--- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp
+++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp
@@ -13,6 +13,54 @@ CCharacter_Controller::CCharacter_Controller(const CCharacter_Controller& rhs)
{
}
+#ifdef _DEBUG
+
+HRESULT CCharacter_Controller::Render()
+{
+ _vector vPos = Get_Position();
+ _float3 vVolume = Get_Volume();
+ _matrix WorldMatrix = XMMatrixTranslationFromVector(vPos);
+
+ _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_eBodyType)
+ {
+ case ACTOR::BOX:
+ {
+ // vVolume = half-extents(Hx,Hy,Hz) ¶ó°í °¡Á¤
+ const _matrix ScaleMatrix =
+ XMMatrixScaling(vVolume.x / 0.5f,
+ vVolume.y / 0.5f,
+ vVolume.z / 0.5f);
+ m_pMainShape->Draw(ScaleMatrix * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
+ } break;
+ case ACTOR::CAPSULE:
+ {
+ _float fHalf = vVolume.y;
+
+ _matrix ScaleMatrix =
+ XMMatrixScaling(vVolume.x / 0.5f,
+ fHalf / (2.f * 0.5f),
+ vVolume.x / 0.5f);
+ m_pMainShape->Draw(ScaleMatrix * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
+
+ _matrix ScaleSphereMatrix = XMMatrixScaling(vVolume.x / 0.5f, vVolume.x / 0.5f, vVolume.x / 0.5f);
+
+ _matrix WorldUp = XMMatrixTranslation(0.f, +fHalf * 0.5f, 0.f);
+ _matrix WorldDown = XMMatrixTranslation(0.f, -fHalf * 0.5f, 0.f);
+
+ m_pSubShape->Draw(ScaleSphereMatrix * WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
+ m_pSubShape->Draw(ScaleSphereMatrix * WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
+ } break;
+ default:
+ break;
+ }
+ return S_OK;
+}
+
+#endif // _DEBUG
void CCharacter_Controller::Modify_Volume(_float3 fVolume)
{
@@ -111,6 +159,12 @@ void CCharacter_Controller::Set_Position(_fvector vNewPos)
m_pController->setPosition(pxLVec3NewPos);
}
+_vector CCharacter_Controller::Get_Position()
+{
+ PSX::PxExtendedVec3 pxVPos = m_pController->getPosition();
+ return XMVectorSet((_float)pxVPos.x, (_float)pxVPos.y, (_float)pxVPos.z, 1.f);
+}
+
_float3 CCharacter_Controller::Get_FootPosition()
{
PSX::PxExtendedVec3 pxLVecfootPos = m_pController->getFootPosition();
@@ -143,8 +197,12 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
Desc.halfSideExtent = {};
Desc.halfForwardExtent = {};
Desc.contactOffset = pDesc->fContactOffset;
- Desc.material = m_pGameInstance->Get_Material(pDesc->fMaterial);
+ Desc.material = m_pGameInstance->Get_Material(&pDesc->fMaterial);
m_pController = m_pGameInstance->Add_BoxController(Desc);
+#ifdef _DEBUG
+ _float3 vVolume = Get_Volume();
+ m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vVolume, false, false));
+#endif // _DEBUG
} break;
case Engine::ACTOR::CAPSULE:
{
@@ -153,8 +211,13 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
Desc.height = pDesc->tCapsuleInfo.fHeight;
Desc.climbingMode = pDesc->tCapsuleInfo.eClimbingMode; // 񃧯 eEASY
Desc.contactOffset = pDesc->fContactOffset;
- Desc.material = m_pGameInstance->Get_Material(pDesc->fMaterial);
+ Desc.material = m_pGameInstance->Get_Material(&pDesc->fMaterial);
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
+#ifdef _DEBUG
+ _float3 vVolume = Get_Volume();
+ m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, vVolume.x, 10, false, false));
+ m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, vVolume.y, vVolume.x, 10, false));
+#endif // _DEBUG
} break;
default:
assert(false); // PhysX¿¡¼ ºÒ°¡´É
diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp
index e0b6830a1..caec4e169 100644
--- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp
+++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp
@@ -559,7 +559,7 @@ SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
}
#pragma region PhysX_Manager
-PSX::PxMaterial* CGameInstance::Get_Material(_float3& vMatInfo)
+PSX::PxMaterial* CGameInstance::Get_Material(_float3* vMatInfo)
{
return m_pPhysX_Manager->Get_Material(vMatInfo);
}
@@ -569,10 +569,6 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
}
-PSX::PxShape* CGameInstance::Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag)
-{
- return m_pPhysX_Manager->Create_Shape(eType, vhalfGeometryInfo, pxMaterial, bExclusive, ePxShapeFlag);
-}
const PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
{
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp
index 9ea7d5551..0ad54a6c9 100644
--- a/Jusin154_Team3D/Engine/Private/Material.cpp
+++ b/Jusin154_Team3D/Engine/Private/Material.cpp
@@ -405,85 +405,6 @@ HRESULT CMaterial::Bind_SRV(CShader* pShader, const _char* pConstantName, _uint
return pShader->Bind_SRV(pConstantName, m_SRVs[iType][iTextureIndex]);
}
-
-HRESULT CMaterial::Initialize(const _char* pModelFilePath, HANDLE hFile, DWORD& dwByte)
-{
- for (int i = 0; i < AI_TEXTURE_TYPE_MAX; ++i) {
- _uint iNumSrv = { 0 };
- if (!ReadFile(hFile, &i, sizeof(_uint), &dwByte, nullptr)) {
- return E_FAIL;
- }
- if (!ReadFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr)) {
- return E_FAIL;
- }
- if (iNumSrv == 0) {
- continue;
- }
- m_SRVs[i].reserve(iNumSrv);
-
- ID3D11ShaderResourceView* pSRV = { nullptr };
- HRESULT hr = {};
-
- for (_uint j = 0; j < iNumSrv; ++j) {
- _uint strLength = { 0 };
- if (!ReadFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr)) {
- return E_FAIL;
- }
- _char szTextureName[MAX_PATH] = {};
- if (!ReadFile(hFile, szTextureName, strLength, &dwByte, nullptr)) {
- return E_FAIL;
- }
-
- _char szTextureDir[MAX_PATH] = {};
- _char szDrive[MAX_PATH] = {};
- _char szDir[MAX_PATH] = {};
- _splitpath_s(pModelFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, nullptr, 0, nullptr, 0);
- strcpy_s(szTextureDir, sizeof(_char) * MAX_PATH, szDrive);
- strcat_s(szTextureDir, sizeof(_char) * MAX_PATH, szDir);
- strcat_s(szTextureDir, sizeof(_char) * MAX_PATH, szTextureName);
-
-
- {
- _char szTextureFileName[MAX_PATH] = {};
- _char szTextureFilePath[MAX_PATH] = {};
- _char szDrive[MAX_PATH] = {};
- _char szDir[MAX_PATH] = {};
- _char szFileName[MAX_PATH] = {};
- _char szEXT[MAX_PATH] = {};
- _splitpath_s(szTextureDir, szDrive, MAX_PATH, szDir, MAX_PATH, szFileName, MAX_PATH, szEXT, MAX_PATH);
- strcpy_s(szTextureFileName, szDrive);
- strcat_s(szTextureFileName, szDir);
- strcat_s(szTextureFileName, szFileName);
-
- strcat_s(szTextureFilePath, szTextureFileName);
- strcat_s(szTextureFilePath, ".dds");
-
- hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // ÀÏ´Ü dds·Î ½ÃµµÇϰí
- if (FAILED(hr)) {
- memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // ½ÇÆÐÇÏ¸é ¿ø·¡ È®ÀåÀÚ·Î ´Ù½Ã ½Ãµµ
- strcat_s(szTextureFilePath, szTextureFileName);
- strcat_s(szTextureFilePath, szEXT);
-
- if (false == strcmp(".tga", szEXT)) {
- assert(false); // trying to Load TGA
- hr = S_OK;
- }
- else {
- hr = CreateWICTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV);
- }
- }
-
- }
- if (FAILED(hr)) {
- return E_FAIL;
- }
-
- m_SRVs[i].push_back(pSRV);
- }
- }
- return S_OK;
-}
-
HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _SaveMaterial)
{
for (size_t type = 0; type < 27; type++)
@@ -524,19 +445,6 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _
return S_OK;
}
-
-CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, HANDLE hFile, DWORD& dwByte) {
- CMaterial* pInstance = new CMaterial(pDevice, pContext);
-
- if (FAILED(pInstance->Initialize(pModelFilePath, hFile, dwByte)))
- {
- MSG_BOX("Failed to Created : CMaterial");
- SAFE_RELEASE(pInstance);
- }
-
- return pInstance;
-}
-
CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, const SaveMaterial& _SaveMaterial)
{
CMaterial* pInstance = new CMaterial(pDevice, pContext);
diff --git a/Jusin154_Team3D/Engine/Private/Mesh.cpp b/Jusin154_Team3D/Engine/Private/Mesh.cpp
index 0e9f70129..4305bda17 100644
--- a/Jusin154_Team3D/Engine/Private/Mesh.cpp
+++ b/Jusin154_Team3D/Engine/Private/Mesh.cpp
@@ -607,7 +607,7 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
return S_OK;
}
-PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _fmatrix WorldMatrix)
+PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _matrix WorldMatrix)
{
PSX::PxTriangleMeshDesc tMeshDesc = {};
vector Vertices = {};
@@ -616,7 +616,7 @@ PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam,
tMeshDesc.points.count = m_iNumVertices;
tMeshDesc.points.stride = sizeof(PSX::PxVec3);
Vertices.resize(m_iNumVertices);
- XMVector3TransformCoordStream(reinterpret_cast<_float3*>(Vertices.data()), sizeof(PSX::PxVec3), (_float3*)m_pVertexPositions, sizeof(_float3), m_iNumVertices, WorldMatrix);
+ memcpy(Vertices.data(), m_pVertexPositions, sizeof(PSX::PxVec3) * m_iNumVertices);
tMeshDesc.points.data = Vertices.data();
}
{
diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp
index eb690b3bc..cd5c2f967 100644
--- a/Jusin154_Team3D/Engine/Private/Model.cpp
+++ b/Jusin154_Team3D/Engine/Private/Model.cpp
@@ -351,7 +351,7 @@ HRESULT CModel::Ready_PhysXMeshes()
m_TriMeshes.reserve(m_iNumMeshes);
- m_pGameInstance->ConvertToTriMeshes(m_Meshes, m_TriMeshes, m_pTransform->Get_XMWorldMatrix());
+ m_pGameInstance->ConvertToTriMeshes(m_Meshes, m_TriMeshes);
return S_OK;
}
@@ -362,7 +362,7 @@ HRESULT CModel::Save_PhysXTriMeshes(const _char* pModelFilePath)
return E_FAIL;
}
for (_uint i = 0; i < m_iNumMeshes; ++i) {
- m_pGameInstance->RegistTriMesh(m_Meshes[i]->Get_Name(), m_TriMeshes[i]);
+ m_pGameInstance->RegistTriMesh((m_Meshes[i]->Get_Name() + to_string(i)).c_str(), m_TriMeshes[i]);
}
return m_pGameInstance->SaveTriMeshes(pModelFilePath, m_TriMeshes);
}
@@ -410,7 +410,7 @@ HRESULT CModel::Ready_Materials_FromFile(const aiScene* pAIScene, const _char* p
if (!file.is_open())
{
//MSG_BOX("Failed to Open Mesh File");
- /* LOD */
+ ///* LOD */
return S_OK;
}
@@ -856,7 +856,9 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
strcpy_s(Temp, szDir);
strcat_s(Temp, szName);
strcat_s(Temp, ".bin");
- Assimp_Model_Load(pModelFilePath, eType, PreTransformMatrix, 0);
+ if (FAILED(Assimp_Model_Load(pModelFilePath, eType, PreTransformMatrix, 0))) {
+ return E_FAIL;
+ }
SaveAssimpModel(Temp);
return S_OK;
diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
index c9dcd5c73..50c8631c5 100644
--- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
+++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
@@ -5,7 +5,7 @@
#include "RigidBody.h"
#include "Mesh.h"
-static PSX::PxTransform XMWorldToPx(const _matrix& WorldMatrix)
+static PSX::PxTransform XMWorldToPx_NoScale(const _matrix& WorldMatrix)
{
_vector vPos, vRotq, vScale;
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
@@ -15,7 +15,6 @@ static PSX::PxTransform XMWorldToPx(const _matrix& WorldMatrix)
PSX::PxTransform out;
XMStoreFloat3((_float3*)&out.p, vPos);
XMStoreFloat4((_float4*)&out.q, vRotq);
-
return out;
}
@@ -31,22 +30,57 @@ CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
const PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
{
- _matrix WorldMatrix = RigidBody.Get_PxTransformPtr()->Get_XMWorldMatrix();
+ _matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
- PSX::PxTransform pxWorldMatrix = XMWorldToPx(WorldMatrix);
+ PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
// PxRigidDynamic ¾ÀÀÇ µ¿Àû ¹Ùµð ÀÎÅÍÆäÀ̽º
PSX::PxRigidDynamic* pActorDynamic = m_pPhysics->createRigidDynamic(pxWorldMatrix);
pActorDynamic->userData = &RigidBody;
- pActorDynamic->attachShape(*RigidBody.Get_ShapePtr());
- if (RigidBody.Is_Kinematic()) {
- pActorDynamic->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true);
+
+ PSX::PxShape* pClone = nullptr;
+ PSX::PxGeometryHolder geoHolder = {};
+
+ _float3 vVolume = RigidBody.Get_HalfGeometryInfo();
+
+ switch (RigidBody.Get_Type()) {
+ case ACTOR::BOX:
+ geoHolder = PSX::PxBoxGeometry(PSX::PxVec3(vVolume.x, vVolume.y, vVolume.z));
+ pClone = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.box(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
+ assert(nullptr != pClone);
+ break;
+ case ACTOR::CAPSULE:
+ geoHolder = PSX::PxCapsuleGeometry(vVolume.x, vVolume.y);
+ pClone = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.capsule(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
+ assert(nullptr != pClone);
+ break;
+ case ACTOR::SPHERE:
+ geoHolder = PSX::PxCapsuleGeometry(vVolume.x);
+ pClone = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.sphere(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
+ assert(nullptr != pClone);
+ break;
+ default:
+ assert(false); break;
+ }
+
+ pClone->setFlags(RigidBody.Get_ShapeFlags());
+ pClone->setContactOffset(RigidBody.Get_ContactOffset());
+ pClone->setRestOffset(0.f);
+
+
+ pActorDynamic->attachShape(*pClone);
+ PSX::PxRigidBodyFlags pxRigidFlags = RigidBody.Get_RigidBodyFlags();
+ pActorDynamic->setRigidBodyFlags(pxRigidFlags);
+
+
+
+ if (pxRigidFlags.isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) {
+
}
else {
PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density());
}
-
m_RigidBodys.emplace_back(&RigidBody, pActorDynamic);
m_pScene->addActor(*pActorDynamic);
@@ -55,12 +89,12 @@ const PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBod
const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
{
- _matrix WorldMatrix = RigidBody.Get_PxTransformPtr()->Get_XMWorldMatrix();
+ _matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
- PSX::PxTransform pxWorldMatrix = XMWorldToPx(WorldMatrix);
+ PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
// PxRigidStatic ¾ÀÀÇ Á¤Àû ¹Ùµð ÀÎÅÍÆäÀ̽º
- const PSX::PxTriangleMesh* pPxMesh = { nullptr };
+ PSX::PxTriangleMesh* pPxMesh = { nullptr };
{
auto iter = m_TriangleMeshes.find(RigidBody.Get_PxMeshKey());
if (m_TriangleMeshes.end() == iter) {
@@ -69,18 +103,27 @@ const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
}
pPxMesh = iter->second;
}
- const 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) // ½ºÄÉÀÏ ÃàÀº ·ÎÄà ±âÁØ(º¸Åë Identity°¡ °¡Àå ¾ÈÀü)
+ );
+ PSX::PxTriangleMeshGeometry* pPxMeshGeometry = new PSX::PxTriangleMeshGeometry(pPxMesh, meshScale);
{
- auto iter = m_TriangleMeshGeometry.find(RigidBody.Get_PxMeshKey());
- if (m_TriangleMeshGeometry.end() == iter) {
- assert(false);
- return nullptr;
- }
- pPxMeshGeometry = iter->second;
+ pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
+ PX_ASSERT(pPxMeshGeometry.isValid()); // À¯È¿¼º üũ
+ m_TriangleMeshGeometry.emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry);
}
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
- PSX::PxShape* pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pPxMeshGeometry, *RigidBody.Get_PxMaterial());
+ PSX::PxShape* pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pPxMeshGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
pShape->setFlag(PSX::PxShapeFlag::eSCENE_QUERY_SHAPE, true);
pShape->setFlag(PSX::PxShapeFlag::eSIMULATION_SHAPE, true);
@@ -92,41 +135,15 @@ const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
return pActor;
}
-PSX::PxMaterial* CPhysX_Manager::Get_Material(_float3& vMatInfo)
+PSX::PxMaterial* CPhysX_Manager::Get_Material(const _float3* vMatInfo)
{
- PSX::PxMaterial* pPxMaterial = m_pPhysics->createMaterial(vMatInfo.x, vMatInfo.y, vMatInfo.z);
+ PSX::PxMaterial* pPxMaterial = m_pPhysics->createMaterial(vMatInfo->x, vMatInfo->y, vMatInfo->z);
return pPxMaterial;
}
-PSX::PxShape* CPhysX_Manager::Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag)
-{
- PSX::PxShape* pShape = { nullptr };
- switch (eType)
- {
- case Engine::ACTOR::BOX:
- pShape = m_pPhysics->createShape(PSX::PxBoxGeometry(vhalfGeometryInfo.x, vhalfGeometryInfo.y, vhalfGeometryInfo.z), pxMaterial,
- bExclusive, ePxShapeFlag);
- break;
- case Engine::ACTOR::CAPSULE:
- pShape = m_pPhysics->createShape(PSX::PxCapsuleGeometry(vhalfGeometryInfo.x, vhalfGeometryInfo.y), pxMaterial,
- bExclusive, ePxShapeFlag);
- break;
- case Engine::ACTOR::SPHERE:
- pShape = m_pPhysics->createShape(PSX::PxSphereGeometry(vhalfGeometryInfo.x), pxMaterial,
- bExclusive, ePxShapeFlag);
- break;
- default:
- break;
- }
- return pShape;
-}
-
void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh) {
m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh);
- PSX::PxTriangleMeshGeometry* pGeometry = new PSX::PxTriangleMeshGeometry(pPxTriMesh);
- pGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
- m_TriangleMeshGeometry.emplace(CMyTools::ToWstring(pName), pGeometry);
}
HRESULT CPhysX_Manager::ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix)
@@ -274,9 +291,10 @@ void CPhysX_Manager::Update_Kinematic()
if (pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC)
{
CRigidBody* pBody = pairBody.first;
- const CTransform* pTransform = pBody->Get_PxTransformPtr();
+ const CTransform* pTransform = pBody->Get_TransformPtr();
+
- pActor->setKinematicTarget(XMWorldToPx(pTransform->Get_XMWorldMatrix()));
+ pActor->setKinematicTarget(XMWorldToPx_NoScale(pTransform->Get_XMWorldMatrix()));
}
}
}
@@ -294,11 +312,12 @@ void CPhysX_Manager::Update(_float fTimeDelta)
_bool bResult = m_pScene->fetchResults(true);
}
{ // Post
- Update_Dynamic();
+ // Update_Dynamic_ActiveActors();
+ Update_Dynamic_AllActors();
}
}
-void CPhysX_Manager::Update_Dynamic()
+void CPhysX_Manager::Update_Dynamic_ActiveActors()
{
PSX::PxU32 iNumActiveActor = {};
PSX::PxActor** ppActiveActors = m_pScene->getActiveActors(iNumActiveActor);
@@ -310,7 +329,7 @@ void CPhysX_Manager::Update_Dynamic()
if (nullptr == ppActiveActors[i]->userData) {
continue;
}
- CTransform* pTransform = ((CRigidBody*)ppActiveActors[i]->userData)->Get_PxTransformPtr();
+ CTransform* pTransform = ((CRigidBody*)ppActiveActors[i]->userData)->Get_TransformPtr();
PSX::PxTransform pPrevPxTransform;
PSX::PxTransform pPxTransform = pActorDynamic->getGlobalPose();
@@ -319,7 +338,27 @@ void CPhysX_Manager::Update_Dynamic()
WorldMatrix = XMMatrixAffineTransformation(XMLoadFloat3(&vOriginalScale), XMVectorZero(), XMLoadFloat4((_float4*)&pPxTransform.q), XMLoadFloat3((_float3*)&pPxTransform.p));
pTransform->Set_WorldMatrix(WorldMatrix);
+ }
+ }
+ //_uint iNumActor = (_uint)m_RigidBodys.size();
+ //for (_uint i = 0; i < iNumActor; ++i) {
+ //for (auto& pairBody : m_RigidBodys)
+ // pairBody.second->userData
+ //}
+}
+void CPhysX_Manager::Update_Dynamic_AllActors()
+{
+ for (pair& pairActors : m_RigidBodys) {
+ PSX::PxRigidDynamic* pActorDynamic = pairActors.second->is();
+ if (nullptr != pActorDynamic) {
+ CTransform* pTransform = ((CRigidBody*)(pActorDynamic->userData))->Get_TransformPtr();
+
+ PSX::PxTransform pxTransform = pActorDynamic->getGlobalPose();
+ _float3 vOriginalScale = pTransform->Get_Scale();
+ _matrix WorldMatrix = {};
+ WorldMatrix = XMMatrixAffineTransformation(XMLoadFloat3(&vOriginalScale), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMLoadFloat3((_float3*)&pxTransform.p));
+ pTransform->Set_WorldMatrix(WorldMatrix);
}
}
}
@@ -410,7 +449,7 @@ HRESULT CPhysX_Manager::Initialize()
sceneDesc.filterShader = PSX::PxDefaultSimulationFilterShader;
- sceneDesc.flags = PSX::PxSceneFlag::eENABLE_PCM | PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS | PSX::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS;
+ sceneDesc.flags = PSX::PxSceneFlag::eENABLE_PCM | PSX::PxSceneFlag::eENABLE_CCD| PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS | PSX::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS;
if (false == sceneDesc.isValid()) {
assert(false);
return E_FAIL;
@@ -431,9 +470,10 @@ HRESULT CPhysX_Manager::Initialize()
// m_pScene->overlap();??????
#ifdef ±â¹«¸®
- physx::PxMaterial* pMaterial = m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f);
- //physx::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 90), *pMaterial);
- //m_pScene->addActor(*pGroundPlane);
+ m_pMaterials.reserve(ENUM_CLASS(PXMATERIAL::END));
+ m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
+ PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
+ m_pScene->addActor(*pGroundPlane);
//{
// float halfExtent = .5f;
@@ -451,7 +491,6 @@ HRESULT CPhysX_Manager::Initialize()
// }
// }
//}
- //pMaterial->release();
#endif // ±â¹«¸®
diff --git a/Jusin154_Team3D/Engine/Private/RigidBody.cpp b/Jusin154_Team3D/Engine/Private/RigidBody.cpp
index 900beff26..803097118 100644
--- a/Jusin154_Team3D/Engine/Private/RigidBody.cpp
+++ b/Jusin154_Team3D/Engine/Private/RigidBody.cpp
@@ -8,52 +8,67 @@ CRigidBody::CRigidBody(ID3D11Device* pDevice, ID3D11DeviceContext* pContext):
{
}
-CRigidBody::CRigidBody(const CRigidBody& rhs):
+CRigidBody::CRigidBody(const CRigidBody& rhs) :
CComponent(rhs),
- m_pMaterial(rhs.m_pMaterial),
m_eActorType(rhs.m_eActorType),
m_vhalfGeometryInfo(rhs.m_vhalfGeometryInfo),
- m_pShape(rhs.m_pShape),
m_wstrMeshKey(rhs.m_wstrMeshKey),
- m_bExclusive(rhs.m_bExclusive),
- m_bKinematic(rhs.m_bKinematic)
+ m_vMatInfo(rhs.m_vMatInfo),
+ m_ePxRigidBodyFlags(rhs.m_ePxRigidBodyFlags),
+ m_ePxShapeFlags(rhs.m_ePxShapeFlags),
+ m_eMatType(rhs.m_eMatType),
+ m_fContactOffset(rhs.m_fContactOffset)
{
-
}
-
-HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
+#ifdef _DEBUG
+HRESULT CRigidBody::Render()
{
- m_eActorType = Desc.eType;
+ _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_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;
- }
- 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;
+ {
+ m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
+ } break;
default:
break;
}
- return S_OK;
+ return S_OK;
+}
+#endif // _DEBUG
+
+HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
+{
+ m_eActorType = Desc.eType;
+ m_ePxRigidBodyFlags = Desc.ePxRigidBodyFlags;
+ m_ePxShapeFlags = Desc.ePxShapeFlags;
+ m_eMatType = Desc.ePxMaterialTypes;
+ m_vMatInfo = Desc.vMatInfo;
+ m_fContactOffset = Desc.fContactOffset;
+ m_vhalfGeometryInfo = Desc.vhalfGeometryInfo;
+ m_fDensity = Desc.fDensity;
+#ifdef _DEBUG
+ if (FAILED(Add_DebugShape())) {
+ return E_FAIL;
+ }
+#endif // _DEBUG
+
return S_OK;
}
@@ -64,9 +79,6 @@ HRESULT CRigidBody::Initialize(void* pArg)
if (FAILED(__super::Initialize(pArg))) {
return E_FAIL;
}
- if (true == m_bExclusive) {
- return E_FAIL;
- }
m_pTransform = m_pOwner->Get_Component();
SAFE_ADDREF(m_pTransform);
@@ -76,8 +88,6 @@ HRESULT CRigidBody::Initialize(void* pArg)
case Engine::ACTOR::BOX:
case Engine::ACTOR::CAPSULE:
case Engine::ACTOR::SPHERE:
- m_fDensity = pDesc->tRigidDynamicDesc.fDensity;
- m_bKinematic = pDesc->tRigidDynamicDesc.bIsKinematic;
m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this);
break;
case Engine::ACTOR::PLANE:
@@ -92,12 +102,39 @@ HRESULT CRigidBody::Initialize(void* pArg)
default:
break;
}
-
-
+#ifdef _DEBUG
+ Add_DebugShape();
+#endif // _DEBUG
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);
diff --git a/Jusin154_Team3D/Engine/Public/Character_Controller.h b/Jusin154_Team3D/Engine/Public/Character_Controller.h
index 71382325c..5e92e8839 100644
--- a/Jusin154_Team3D/Engine/Public/Character_Controller.h
+++ b/Jusin154_Team3D/Engine/Public/Character_Controller.h
@@ -43,13 +43,19 @@ class ENGINE_DLL CCharacter_Controller final :
CCharacter_Controller(const CCharacter_Controller& rhs);
virtual ~CCharacter_Controller() = default;
public:
+#ifdef _DEBUG
+ virtual HRESULT Render() override;
+#endif
+
_float Get_ContactOffset() const { return m_pController->getContactOffset(); }
void Set_ContactOffset(_float fValue) const { return m_pController->setContactOffset((PSX::PxF32)fValue); }
void Move(_float fTimeDelta); // À̵¿
void Set_Position(_fvector vNewPos); // ¼ø°£À̵¿
+ _vector Get_Position();
_float3 Get_FootPosition(); // ContactOffsetÀÌ °í·ÁµÈ ¹ß¹Ù´Ú À§Ä¡( ½ÇÁ¦º¸´Ù ´õ ¾Æ·¡¿¡ À§Ä¡ÇÑ´Ù´Â ¶æ )
+
void Resize_Volume(_float fHeight); // ³ôÀ̸¦ ¼öÁ¤ÇÏ°í ¹Ù´Ú¿¡ ºÙÀÓ
void Modify_Volume(_float3 fVolume);
_float3 Get_Volume();
@@ -65,6 +71,11 @@ class ENGINE_DLL CCharacter_Controller final :
function m_funcHitCallback = { nullptr };
function m_funcBehaviorCallback = { nullptr };
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};;
+#ifdef _DEBUG
+ unique_ptr m_pMainShape = { nullptr };
+ unique_ptr m_pSubShape = { nullptr };
+#endif // _DEBUG
+
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
index cee04b82b..01b17de36 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
@@ -16,7 +16,10 @@ enum class TEXTURE_LOAD_TYPE {
PATH, // original/
END
};
-
+enum class PXMATERIAL {
+ DEFAULT,
+ END,
+};
enum class MOUSEKEYSTATE { LBUTTON, RBUTTON, WBUTTON, XBUTTON };
@@ -77,4 +80,98 @@ enum class PHYSX_KIND {
BODY_DYNAMIC = 4,
};
-NS_END
\ No newline at end of file
+NS_END
+
+//enum PxRigidBodyFlag::Enum // createBody� 들어�
+//{
+// // 해당 바디는 키네마틱 모드가 �.
+// // ì¤‘ë ¥, 힘, 모멘텀ì—� ì˜�í–¥ì�„ ì•ˆë°›ê³ ë¬´í•œì§ˆëŸ‰ìœ¼ë¡œ 취급함
+// // 다른 다�나믹 바디는 밀어내지만
+// // 스태틱, 키네마틱과는 충�x, CCT� �걸 씀
+// // ì§�ì ‘ 개발ìž�ê°€ ì�´ë�™ì‹œì¼œì¤˜ì•¼ 함
+// // CCD와 호환�지 않�, ��으로 한쪽� 꺼�
+// // 키는 순간 바디는 sleep ìƒ�태가 ë�˜ê³ ì†�ë�„ë�„ 0ì�´ ë�¨
+// [eKINEMATIC]
+//
+// // 주ì�˜ * 다ì�Œ í”„ë ˆìž„ì—� ì �ìš©ë�¨ *
+// // 씬 쿼리를 ì„¸íŒ…í•˜ê³ ì�´ë¯¸ 움ì§�ì�¸ 것 처럼 씬 쿼리를 í•˜ê³ ì‹¶ì�„ 때 씀
+// [eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES]
+//
+// // ê³ ì†� ì�´ë�™ìœ¼ë¡œ ì�¸í•œ 튕김/뚫림 방지를 ì�´ 바디ì—� 등ë¡�함
+// // � 플래그가 필요한 shape 페어�는 eDetect_ccd_contact� 켜야 �
+// // 키네마틱과 호환�지 않�
+// // ë§Žì�´ 키면 ë ‰ê±¸ë¦¼
+// [eENABLE_CCD]
+//
+// // CCD� 마찰� 활성화 시킴
+// // �알� 표면� 스치면서 마찰로 ���소 등
+// [eENABLE_CCD_FRICTION]
+//
+// // contact offset� 바디 ��� 따� 키워서
+// // 관통� 줄�는 방�� CCD
+// // 엄밀히 CCD는 아니지만 터��� 줄� 순 있�
+// [eENABLE_SPECULATIVE_CCD]
+//
+// // 물리 결과를 scene.fetchResult �중� 얻� 수 있�
+// // 콜백으로 받게 ë�¨, 물리 결과를 미리 ë°˜ì˜�í•˜ê³ ì‹¶ì�„ 때 사용
+// [eENABLE_POSE_INTEGRATION_PREVIEW]
+//
+// // ì¶©ë�Œ 시 ì �ìš©ë�˜ëŠ” 최대 임펄스 수를 ì œí•œ?
+// // ì�¼ë°˜ ì ‘ì´‰ì—�ë§Œ ì �ìš©ë�˜ë�˜ 걸 CCDì—�ë�„ ì �용하게ë�” 만듬
+// // 보통 offë�¼ê³ 함
+// [eENABLE_CCD_MAX_CONTACT_IMPULSE]
+//
+// // 힘/ê°€ì†�ë�„ê°€ 다ì�Œ ì‹œë®¬ë ˆì�´ì…˜ì—�서ë�„ 계ì†�해서 ì“°ìž„
+// // addForce(), addTorque() 등으로 준 것들� �래는 시뮬 �나면 지워�
+// // ë ˆì�¼ê±´ ê°™ì�€ ì´�알ì�´ë‚˜ ìš°ì£¼ì„ ë“±
+// [eRETAIN_ACCELERATIONS]
+//
+// // 키네마틱페어를 ì „ì²´ì �으로 ì—†ì• ëŠ”
+// // PxSceneDesc::kineKineFilteringModeê°€ ì¼œì ¸ 있어ë�„
+// // 키네마틱 페어를 서로 충��벤트 발�시키게 함
+// // 런타임ì—� 바꾸면 씬ì—�서 ì œê±°í•˜ê³ ë‹¤ì‹œ 추가하기 ì „ê¹Œì§€ ë°˜ì˜� 안ë�¨
+// [eFORCE_KINE_KINE_NOTIFICATIONS]
+//
+// // 위랑 똑같�� 위�껀 키네마틱 페어�면
+// // �건 스태틱-키네마틱 페어임
+// [eFORCE_STATIC_KINE_NOTIFICATIONS]
+//
+// // 강하게 íšŒì „í•˜ëŠ” 바디ì—�서 관성ì—� ì�˜í•œ ë³´ì •ì�„ ë�” 엄밀히 계산함
+// // 비용ì¦�ê°€, ìš´ë�™ëŸ‰ ì•ˆì •í™”
+// [eENABLE_GYROSCOPIC_FORCES]
+//
+// // 예약 플래그임. 안�야함
+// [eRESERVED]
+//};
+//
+
+
+//enum PxShapeFlag::Enum // createShape� 들어�
+//{
+// // 물리 ì‹œë®¬ë ˆì�´ì…˜ì—�서 ì¶©ë�Œ/ì ‘ì´‰ 계산ì—� 참여,
+// // PxSimulationEventCallback::onContact ì ‘ì´‰ ì�´ë²¤íЏë�„ ì�´ 플래그 들 ë�¼ë¦¬ì�˜ ì¶©ë�Œì—�서 나옴
+// // eTrigger_Shape와 �시� 킬 수 없�
+// // (default = on)
+// [eSIMULATION_SHAPE],
+//
+//
+// // 씬쿼리 대ìƒ�ì�´ ë�¨, ë ˆì�´ì¼€ìŠ¤íŠ¸, 오버랩, 스윕 등
+// // ì¶©ë�Œì‹œë®¬ë ˆì�´ì…˜ê³¼ëŠ” 별ë�„ì�˜ ë�™ìž‘
+// // (default = on)
+// [eSCENE_QUERY_SHAPE],
+//
+// // 다른 shapeê°€ ë“¤ì–´ì˜¤ê³ ë‚˜ê°ˆ 때 onTrigger 콜백ì�„ ë°œìƒ�시킴
+// // 통과가능한 shape�며 �벤트만 발�시킴
+// // TriangleMesh, HeightField는 트리거사용불가
+// // (default = off)
+// [eTRIGGER_SHAPE],
+//
+// // 디버그용, ì „ìš©ë””ë²„ê±° PVDì—� ì�´ shape를 그리게 함
+// // 꺼ë�„ ë�˜ê³ , 키면 PxSceneì—�서 ì„¤ì •ì�„ 해줘야함
+// // (default = on)
+// [eVISUALIZATION],
+//
+// // PhysX Particle들ì�´ 닿는 순간 ê·¸ 파티í�´ì�„ 'í�¡ìˆ˜'해서 ì œê±°í•¨
+// // (default = off)
+// [ePARTICLE_DRAIN],
+//};
\ No newline at end of file
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
index 859a091fa..a053164a4 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
@@ -82,7 +82,7 @@ struct SaveBone
string BoneName;
unsigned int BoneNameSize = {};
- XMFLOAT4X4 OffsetMatrix;
+ _float4x4 OffsetMatrix = {};
int BoneIndex = {};
unsigned int WeightsCount = {};
vectorWeights = {};
@@ -95,7 +95,7 @@ struct SaveNode
unsigned int NodeNameSize = {};
int ParentIndex = {};
unsigned int ChildrenCount = {};
- XMFLOAT4X4 Transformation;
+ _float4x4 Transformation = {};
vector ChildrenIndices;
};
diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h
index 46a91ddcc..0433ef372 100644
--- a/Jusin154_Team3D/Engine/Public/GameInstance.h
+++ b/Jusin154_Team3D/Engine/Public/GameInstance.h
@@ -178,9 +178,8 @@ class ENGINE_DLL CGameInstance final : public CBase
_bool isPicking(_float3* pOut);
#pragma endregion
#pragma region PhysX_Manager
- PSX::PxMaterial* Get_Material(_float3& vMatInfo);
+ PSX::PxMaterial* Get_Material(_float3* vMatInfo);
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
- PSX::PxShape* Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive = false, PSX::PxShapeFlags ePxShapeFlag = PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE);
const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
@@ -190,7 +189,7 @@ class ENGINE_DLL CGameInstance final : public CBase
PSX::PxController* Get_Controller(_uint iControllerIndex);
void ReleaseController(_uint iControllerIndex);
- HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix);
+ HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes);
HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // ¸ðµ¨ ºÒ·¯¿Ô´ø °æ·Î¿¡ ±×´ë·Î ÀÖÀ½
#pragma endregion
diff --git a/Jusin154_Team3D/Engine/Public/Material.h b/Jusin154_Team3D/Engine/Public/Material.h
index 60c305709..7f56edd79 100644
--- a/Jusin154_Team3D/Engine/Public/Material.h
+++ b/Jusin154_Team3D/Engine/Public/Material.h
@@ -34,13 +34,11 @@ class ENGINE_DLL CMaterial final : public CBase
HRESULT Add_Texture(const _char* pTextureFolderPath, string& FileType);
#endif // EDITOR_PROJECT
- virtual HRESULT Initialize(const _char* pModelFilePath, HANDLE hFile, DWORD& dwByte);
// ¹ÙÀ̳ʸ®
HRESULT Initialize(const _char* pModelFilePath, const SaveMaterial& _SaveMaterial);
//
public:
- static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, HANDLE hFile, DWORD& dwByte);
// ¹ÙÀ̳ʸ®
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePathconst, const SaveMaterial& _SaveMaterial);
//
diff --git a/Jusin154_Team3D/Engine/Public/Mesh.h b/Jusin154_Team3D/Engine/Public/Mesh.h
index d821533d6..63a669d03 100644
--- a/Jusin154_Team3D/Engine/Public/Mesh.h
+++ b/Jusin154_Team3D/Engine/Public/Mesh.h
@@ -28,7 +28,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
public:
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
- PSX::PxTriangleMesh* ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _fmatrix WorldMatrix);
+ PSX::PxTriangleMesh* ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _matrix WorldMatrix);
#endif // EDITOR_PROJECT
public:
diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h
index aa90bca4a..2cdd0b66f 100644
--- a/Jusin154_Team3D/Engine/Public/Model.h
+++ b/Jusin154_Team3D/Engine/Public/Model.h
@@ -12,49 +12,59 @@ class ENGINE_DLL CModel final : public CComponent
virtual ~CModel() = default;
public:
- static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // º»ÀÇ º¤ÅÍ¿Í À̸§À» ³Ñ°ÜÁÖ¸é À妽º¸¦ ³Ñ°ÜÁÜ ( n ¼øÈ¸ )
- _int Get_BoneIndex(const _char* pBoneName) const;
- void Set_RootBoneIndex(_int iIndex) { m_iRootBoneIndex = iIndex; }
+#pragma region Model
+ MODEL Get_Type() const { return m_eType; }
+ _float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
+ _float4x4 Get_PreTransformMatrix() const { return m_PreTransformMatrix; };
+ virtual HRESULT Render(_uint iMeshIndex);
+ virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
+#pragma endregion
+#pragma region Animation
void Change_AnimationIndex(_int iAnimationIndex, _bool bIsLoop, _float fLerpDuration, _bool bIgnoreCurrentIndex = false); // ¾Ö´Ï¸ÞÀ̼ÇÀ» ´Ù¸¥ À妽º·Î º¯°æÇÔ
_bool Play_Animation(_float fTimeDelta); // ¾Ö´Ï¸ÞÀ̼ǿ¡ µ¨Å¸Å¸ÀÓÀ» ³Ö¾îÁÜ
- void Set_AnimationIndex(_uint iIndex, _bool isLoop = true);
+ void RefreshAnim(); // ¾Ö´ÔÀ» ÇöÀç ¾Ö´ÔÀÇ Ãʱâ»óÅ·ΠµÇµ¹¸²
+ void Set_AnimationIndex(_uint iIndex, _bool isLoop = true);
void Stop_Animation(); // ¾Ö´Ï¸ÞÀ̼ÇÀ» Á¤Áö (Ãʱâ»óÅ·Î)
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
_bool IsFinishedLerp() const { return m_bIsFinishedLerp; }
- void RefreshAnim(); // ¾Ö´ÔÀ» ÇöÀç ¾Ö´ÔÀÇ Ãʱâ»óÅ·ΠµÇµ¹¸²
_float Get_AnimProgressRatio();
_int Get_AnimProgressPostion(const char* pAnimChannelName);
_float Get_AnimEstimatedDuration();
void Set_AnimProgressPostion(const _char* pChannelName, _uint iPosition);
void Set_AnimPauseState(_bool bValue);// ¾Ö´ÔÀ» ÇöÀç»óÅ·ΠÁ¤Áö
void ReallocateResources(class CTransform* pTransform = nullptr); // ¾Ö´Ô À̵¿ÀÇ ´ë»ó Æ®·£½ºÆû(À̵¿½ÃÄѾßÇÒ Æ®·£½ºÆû)À» ÀçÁöÁ¤ÇÔ
- _int Get_RootBoneIndex() const { return m_iRootBoneIndex; }
- const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
- _uint Get_NumMeshes() const { return m_iNumMeshes; }
- const _char* Get_MeshName(_uint iIndex);
- MODEL Get_Type() const { return m_eType; }
- _matrix Get_BoneMatrix(_uint iBoneIndex);
-
- _float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
- _float4x4 Get_PreTransformMatrix() const { return m_PreTransformMatrix; };
- void Get_BoneMatrices(_float4x4* pOut);
- _uint Get_BonesNum() const { return (_uint)m_Bones.size(); }
-
void Set_CurrentTrackPosition(_float TrackPosition);
const _char* Get_AnimList(_uint iIndex);
size_t Get_AnimSize() { return m_Animations.size(); }
_float Get_CurrentTrackPosition();
void Set_PlayAnim(_bool bPlayAnim) { m_bPlayAnim = bPlayAnim; }
- _bool Get_PlayAnim() { return m_bPlayAnim; }
- _int Get_AnimIndex() { return m_iCurrentAnimIndex; }
+ _bool Get_PlayAnim() const { return m_bPlayAnim; }
+ _int Get_AnimIndex() const { return m_iCurrentAnimIndex; }
_float Get_AnimSpeed();
void Set_AnimSpeed(_float fSpeed);
-public:
- HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex);
+#pragma endregion
+#pragma region Mesh
+ const _char* Get_MeshName(_uint iIndex);
+ _uint Get_NumMeshes() const { return m_iNumMeshes; }
+#pragma endregion
+#pragma region Bone
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
- virtual HRESULT Render(_uint iMeshIndex);
- virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
+ void Get_BoneMatrices(_float4x4* pOut);
+ _uint Get_BonesNum() const { return (_uint)m_Bones.size(); }
+ const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
+ _int Get_RootBoneIndex() const { return m_iRootBoneIndex; }
+ void Set_RootBoneIndex(_int iIndex) { m_iRootBoneIndex = iIndex; }
+static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // º»ÀÇ º¤ÅÍ¿Í À̸§À» ³Ñ°ÜÁÖ¸é À妽º¸¦ ³Ñ°ÜÁÜ ( n ¼øÈ¸ )
+ _int Get_BoneIndex(const _char* pBoneName) const;
+ _matrix Get_BoneMatrix(_uint iBoneIndex);
+#pragma endregion
+#pragma region Material
+ HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex);
+#pragma endregion
+
+
+public:
#ifdef EDITOR_PROJECT
HRESULT Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
HRESULT Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& PreTransformMatrix);
diff --git a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
index ef2a593ec..ad0abf562 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
@@ -24,8 +24,7 @@ class CPhysX_Manager final : public CBase
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
- PSX::PxMaterial* Get_Material(_float3& vMatInfo);
- PSX::PxShape* Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag);
+ PSX::PxMaterial* Get_Material(const _float3* vMatInfo);
HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix);
HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes);
@@ -76,12 +75,15 @@ class CPhysX_Manager final : public CBase
list> m_RigidBodys = { };
map<_wstring, PSX::PxTriangleMesh*> m_TriangleMeshes = {};
map<_wstring, PSX::PxTriangleMeshGeometry*> m_TriangleMeshGeometry = {};
+
+ vector m_pMaterials = { };
_uint m_iNumLevel = {};
private:
HRESULT Initialize();
HRESULT Connect_DebugServer();
void Update_Kinematic();
- void Update_Dynamic();
+ void Update_Dynamic_ActiveActors();
+ void Update_Dynamic_AllActors();
public:
static CPhysX_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h
index ec4ba9b73..2de7495d8 100644
--- a/Jusin154_Team3D/Engine/Public/RigidBody.h
+++ b/Jusin154_Team3D/Engine/Public/RigidBody.h
@@ -12,52 +12,30 @@ class CMesh;
class ENGINE_DLL CRigidBody final : public CComponent
{
-public:
- typedef struct tagRigidStatic_PrototypeDesc
+public: // MORE INFO ON ENGINE_ENUM
+ typedef struct tagRigidBody_PrototypeDesc // ´Ù ä¿ì¼¼¿ä NONE »©°í, ¸ñÀû¿¡ ¾È¸Â´Â°Å »©°í
{
- _float3 vMatInfo;
- const _char* szMeshName = { } ;
- }RIGID_STATIC_PROTOTYPEDESC;
- typedef struct tagRigidDynamic_PrototypeDesc
- {
- _float3 vMatInfo;
- _float3 vhalfGeometryInfo;
- _bool bExclusive = { false };
- PSX::PxShapeFlags ePxShapeFlag = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
- }RIGID_DYNAMIC_PROTOTYPEDESC;
-
- typedef struct tagRigidBody_PrototypeDesc
- {
- ACTOR eType;
- union
- {
- RIGID_STATIC_PROTOTYPEDESC tRigidStaticDesc;
- RIGID_DYNAMIC_PROTOTYPEDESC tRigidDynamicDesc;
- };
+ ACTOR eType;
+ PSX::PxRigidBodyFlags ePxRigidBodyFlags = { /* NONE */};
+ PSX::PxShapeFlags ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
+ PXMATERIAL ePxMaterialTypes = { PXMATERIAL::DEFAULT };
+ _float3 vMatInfo = { 0.5f, 0.5f, 0.6f }; // ÇÇÁ÷½º °´Ã¼ÀÇ ¼Ó¼º µî
+ _float fContactOffset = { 0.05f }; // Á¢ÃË À¯°Ý ¿ÀÇÁ¼Â
+#pragma region DYNAMIC
+ _float3 vhalfGeometryInfo; // ¹Ú½º´Â vSize, ĸ½¶Àº radius, height·Î ¾¸
+ _float fDensity = { 1000.f }; // ¹Ðµµ, ½ÇÁ¦ ¹«°Ô´Â ºÎÇÇ¿¡ µû¶ó ´Þ¶óÁü
+#pragma endregion
+#pragma region STATIC
+#pragma endregion
}RIGIDBODY_PROTOTYPEDESC;
- typedef struct tagRigidStatic_Desc {
- const _char* szMeshName = { };
- }RIGID_STATIC_DESC;
- typedef struct tagRigidDynamic_Desc {
- _float fDensity = { 1000.f };
- _bool bIsKinematic = { false };
- }RIGID_DYNAMIC_DESC;
+
typedef struct tagRigidBody_Desc
{
- ACTOR eType;
- union
- {
- RIGID_STATIC_DESC tRigidStaticDesc;
- RIGID_DYNAMIC_DESC tRigidDynamicDesc;
- };
- // Ű³×¸¶Æ½À» ÄѸé,
- // ÇÁ·¹ÀÓ º° Á÷Á¢ À§Ä¡ ÁöÁ¤ÀÌ °¡´ÉÇÏ´Ù.
- // ¹°¸®¿£ÁøÀÇ Èû, Áß·Â µîÀÇ ¿µÇâÀ» ¹ÞÁö ¾Ê´Â´Ù.
- // ´Ü, ´Ù¸¥ ¹°¸®¿£Áø ¿ÀºêÁ§Æ®¿ÍÀÇ Ãæµ¹Àº ¹ß»ýÇÑ´Ù.
- // Áï, °Á¦·Î ¿òÁ÷ÀÌÁö¸¸, Ãæµ¹Àº ½Ã¹Ä·¹ÀÌ¼Ç ÇÑ´Ù.
- // ±×·¯¹Ç·Î Ű³×¸¶Æ½ ¿ÀºêÁ§Æ®´Â ´Ù¸¥ ¿ÀºêÁ§Æ®¿¡ ¿µÇâÀ» ÁÖÁö¸¸, ´Ù¸¥ ¿ÀºêÁ§Æ®ÀÇ Èû¿¡ ¿µÇâÀ» ¹ÞÁö ¾Ê´Â´Ù.
- // ÁÖ·Î ¿òÁ÷ÀÌ´Â Ç÷§Æû, ¹® µî¿¡ »ç¿ëµÈ´Ù.
- // ½ºÅÂÆ½ ¸®Áöµå¹Ùµð¿Í ´Þ¸® ¿òÁ÷ÀÏ ¼ö ÀÖ´Ù !!!
+#pragma region DYNAMIC
+#pragma endregion
+#pragma region STATIC
+ const _char* szMeshName = { };
+#pragma endregion
}RIGIDBODY_DESC;
private:
@@ -65,29 +43,52 @@ class ENGINE_DLL CRigidBody final : public CComponent
CRigidBody(const CRigidBody& rhs);
virtual ~CRigidBody() = default;
public:
- PSX::PxShape* Get_ShapePtr() const { return m_pShape; }
- CTransform* Get_PxTransformPtr() const { return m_pTransform; }
- const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
- const PSX::PxMaterial* Get_PxMaterial() const { return m_pMaterial; }
+#ifdef _DEBUG
+ virtual HRESULT Render()override;
+#endif // _DEBUG
- _float Get_Density() const { return m_fDensity; }
- _bool Is_Kinematic() const { return m_bKinematic; }
+
+ ACTOR Get_Type() const { return m_eActorType; }
+ CTransform* Get_TransformPtr() const { return m_pTransform; }
+ const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
+ PXMATERIAL Get_MaterialType() const { return m_eMatType; }
+ _float Get_ContactOffset() const { return m_fContactOffset; }
+ _float Get_Density() const { return m_fDensity; }
+ PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; }
+ PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; }
+ _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
private:
- ACTOR m_eActorType = ACTOR::END;
- const PSX::PxActor* m_pRigidBody = { nullptr }; // ½ÇÁ¦ ½Ã¹Ä·¹À̼ÇÀ» µµ´Â º»Ã¼
- PSX::PxMaterial* m_pMaterial = { nullptr }; // ÇÇÁ÷½º °´Ã¼ÀÇ ¼Ó¼º µî
- PSX::PxShape* m_pShape = { nullptr }; // ÇÇÁ÷½º °´Ã¼ÀÇ ¸ð¾ç ( ¸ÓÅ׸®¾ó·Î ¸¸µé¾îÁü )
- _float3 m_vhalfGeometryInfo = {};
- CTransform* m_pTransform = { nullptr };
- _bool m_bKinematic = { false };
- _bool m_bExclusive = { false };
- _float m_fDensity = { 1000.f };
- _wstring m_wstrMeshKey = { };
+ ACTOR m_eActorType = ACTOR::END;
+ PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = {};
+ PXMATERIAL m_eMatType = { PXMATERIAL::END };
+ _float m_fContactOffset = { 0.05f };
+ const PSX::PxActor* m_pRigidBody = { nullptr }; // ½ÇÁ¦ ½Ã¹Ä·¹À̼ÇÀ» µµ´Â º»Ã¼
+
+ CTransform* m_pTransform = { nullptr };
+
+#pragma region DYNAMIC
+ PSX::PxShapeFlags m_ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
+ _float3 m_vMatInfo = {};
+ _float3 m_vhalfGeometryInfo = {};
+ _float m_fDensity = { 1000.f };
+#pragma endregion
+#pragma region STATIC
+ _wstring m_wstrMeshKey = { }; // ¦²á ½ºÅÂÆ½ ¸Þ½ÃÀÇ triangleMesh Ű
+#pragma endregion
+
+private:
+#ifdef _DEBUG
+ unique_ptr m_pMainShape = { nullptr };
+ unique_ptr m_pSubShape = { nullptr };
+#endif // _DEBUG
private:
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
HRESULT Initialize(void* pArg);
+#ifdef _DEBUG
+ HRESULT Add_DebugShape();
+#endif
public:
static CRigidBody* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPEDESC& Desc);
diff --git a/Jusin154_Team3D/Engine/Public/pch.h b/Jusin154_Team3D/Engine/Public/pch.h
index 83fef3926..ca3b1478e 100644
--- a/Jusin154_Team3D/Engine/Public/pch.h
+++ b/Jusin154_Team3D/Engine/Public/pch.h
@@ -19,6 +19,8 @@
#include "DirectXTK/SpriteBatch.h"
#include "DirectXTK/SpriteFont.h"
+#include "DirectXTK/GeometricPrimitive.h"
+
// FX11
#include "FX11/d3dx11effect.h"
diff --git a/Jusin154_Team3D/Jusin154_Team3D.sln b/Jusin154_Team3D/Jusin154_Team3D.sln
index 3030ee6cc..78e5e4dca 100644
--- a/Jusin154_Team3D/Jusin154_Team3D.sln
+++ b/Jusin154_Team3D/Jusin154_Team3D.sln
@@ -8,9 +8,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01.Editor", "01.Editor", "{8F2ABBAF-8EC5-4CF8-8AD2-B09FB2AC9B14}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.Engine", "03.Engine", "{C8D5274F-AC00-46C7-1F8D-E88E81087A52}"
- ProjectSection(SolutionItems) = preProject
- Editor\public\DummySkyBox.h = Editor\public\DummySkyBox.h
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "98.Batch", "98.Batch", "{15C374FB-70F1-426A-AF16-1922F28ABE5D}"
ProjectSection(SolutionItems) = preProject