@@ -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
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Effect_Editor.h" />
|
||||
<ClInclude Include="..\Public\EditEffect.h" />
|
||||
<ClInclude Include="..\Public\Information.h" />
|
||||
<ClInclude Include="..\public\Level_MapViewer.h" />
|
||||
<ClInclude Include="..\Public\LoadingWidget.h" />
|
||||
<ClInclude Include="..\public\MapContainer.h" />
|
||||
@@ -236,6 +237,7 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Effect_Editor.cpp" />
|
||||
<ClCompile Include="..\Private\EditEffect.cpp" />
|
||||
<ClCompile Include="..\Private\Information.cpp" />
|
||||
<ClCompile Include="..\private\Level_MapViewer.cpp" />
|
||||
<ClCompile Include="..\Private\LoadingWidget.cpp" />
|
||||
<ClCompile Include="..\private\MapContainer.cpp" />
|
||||
|
||||
@@ -393,6 +393,9 @@
|
||||
<ClInclude Include="..\public\DummySkyBox.h">
|
||||
<Filter>02.GameObjects\Dummys\DummySkyBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Information.h">
|
||||
<Filter>03.Information</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Editor.ico">
|
||||
@@ -586,6 +589,9 @@
|
||||
<ClCompile Include="..\private\DummySkyBox.cpp">
|
||||
<Filter>02.GameObjects\Dummys\DummySkyBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Information.cpp">
|
||||
<Filter>03.Information</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Editor.rc">
|
||||
|
||||
@@ -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<CComponent**>(&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()
|
||||
|
||||
@@ -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<CModel>();
|
||||
_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<CModel>();
|
||||
_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)
|
||||
|
||||
@@ -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<PlayableSTARTPOS_DESC*>(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<CComponent**>(&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;
|
||||
}
|
||||
|
||||
@@ -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<vector<_string>*>(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<vector<_wstring>*>(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);
|
||||
}
|
||||
@@ -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<CDummy_PhysXBox>(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<CDummy_PhysXPlayable>(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) {
|
||||
// return E_FAIL;
|
||||
// }
|
||||
//}
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CDummy_PhysXBox>(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<CDummy_PhysXPlayable>(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
//{
|
||||
// CDummy_PhysXMesh::BOXSTARTPOS_DESC Desc{};
|
||||
|
||||
@@ -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<filesystem::path> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<CMapObject_Manager>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
// <PrototypeTag>텍스트</PrototypeTag>
|
||||
// <PrototypeTag>ÅØ½ºÆ®</PrototypeTag>
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -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¿¡¼ ºÒ°¡´É
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<PSX::PxVec3> 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();
|
||||
}
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<class CMesh*>& Meshes, vector<PSX::PxTriangleMesh*>& 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<CRigidBody*, PSX::PxActor*>& pairActors : m_RigidBodys) {
|
||||
PSX::PxRigidDynamic* pActorDynamic = pairActors.second->is<PSX::PxRigidDynamic>();
|
||||
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 // 기무리
|
||||
|
||||
|
||||
|
||||
@@ -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<CTransform>();
|
||||
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);
|
||||
|
||||
@@ -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<void()> m_funcHitCallback = { nullptr };
|
||||
function<void()> m_funcBehaviorCallback = { nullptr };
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};;
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
#endif // _DEBUG
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
@@ -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
|
||||
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],
|
||||
//};
|
||||
@@ -82,7 +82,7 @@ struct SaveBone
|
||||
string BoneName;
|
||||
|
||||
unsigned int BoneNameSize = {};
|
||||
XMFLOAT4X4 OffsetMatrix;
|
||||
_float4x4 OffsetMatrix = {};
|
||||
int BoneIndex = {};
|
||||
unsigned int WeightsCount = {};
|
||||
vector<SaveBoneWeight>Weights = {};
|
||||
@@ -95,7 +95,7 @@ struct SaveNode
|
||||
unsigned int NodeNameSize = {};
|
||||
int ParentIndex = {};
|
||||
unsigned int ChildrenCount = {};
|
||||
XMFLOAT4X4 Transformation;
|
||||
_float4x4 Transformation = {};
|
||||
vector<int> ChildrenIndices;
|
||||
};
|
||||
|
||||
|
||||
@@ -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<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix);
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes); // 모델 불러왔던 경로에 그대로 있음
|
||||
#pragma endregion
|
||||
|
||||
@@ -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);
|
||||
//
|
||||
|
||||
@@ -28,7 +28,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
public:
|
||||
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector<class CBone*>& 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:
|
||||
|
||||
@@ -12,49 +12,59 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
virtual ~CModel() = default;
|
||||
|
||||
public:
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> 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<class CBone*> 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);
|
||||
|
||||
@@ -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<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix);
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
@@ -76,12 +75,15 @@ class CPhysX_Manager final : public CBase
|
||||
list<pair<CRigidBody*, PSX::PxActor*>> m_RigidBodys = { };
|
||||
map<_wstring, PSX::PxTriangleMesh*> m_TriangleMeshes = {};
|
||||
map<_wstring, PSX::PxTriangleMeshGeometry*> m_TriangleMeshGeometry = {};
|
||||
|
||||
vector<PSX::PxMaterial*> 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);
|
||||
|
||||
@@ -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<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> 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);
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "DirectXTK/SpriteBatch.h"
|
||||
#include "DirectXTK/SpriteFont.h"
|
||||
|
||||
#include "DirectXTK/GeometricPrimitive.h"
|
||||
|
||||
// FX11
|
||||
#include "FX11/d3dx11effect.h"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user