Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -24,6 +24,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
|||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
//_CrtSetBreakAlloc(1157440);
|
||||||
#endif
|
#endif
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|||||||
@@ -152,6 +152,7 @@
|
|||||||
<ClInclude Include="..\Public\Body.h" />
|
<ClInclude Include="..\Public\Body.h" />
|
||||||
<ClInclude Include="..\public\Active_Icon.h" />
|
<ClInclude Include="..\public\Active_Icon.h" />
|
||||||
<ClInclude Include="..\Public\DummyObject.h" />
|
<ClInclude Include="..\Public\DummyObject.h" />
|
||||||
|
<ClInclude Include="..\Public\Dummy_PhysXPlayable.h" />
|
||||||
<ClInclude Include="..\public\GamePlay_Canvas.h" />
|
<ClInclude Include="..\public\GamePlay_Canvas.h" />
|
||||||
<ClInclude Include="..\public\BuildingContainer.h" />
|
<ClInclude Include="..\public\BuildingContainer.h" />
|
||||||
<ClInclude Include="..\Public\DebugCamera.h" />
|
<ClInclude Include="..\Public\DebugCamera.h" />
|
||||||
@@ -213,6 +214,7 @@
|
|||||||
<ClCompile Include="..\Private\Body.cpp" />
|
<ClCompile Include="..\Private\Body.cpp" />
|
||||||
<ClCompile Include="..\private\Active_Icon.cpp" />
|
<ClCompile Include="..\private\Active_Icon.cpp" />
|
||||||
<ClCompile Include="..\Private\DummyObject.cpp" />
|
<ClCompile Include="..\Private\DummyObject.cpp" />
|
||||||
|
<ClCompile Include="..\Private\Dummy_PhysXPlayable.cpp" />
|
||||||
<ClCompile Include="..\private\GamePlay_Canvas.cpp" />
|
<ClCompile Include="..\private\GamePlay_Canvas.cpp" />
|
||||||
<ClCompile Include="..\private\BuildingContainer.cpp" />
|
<ClCompile Include="..\private\BuildingContainer.cpp" />
|
||||||
<ClCompile Include="..\Private\DebugCamera.cpp" />
|
<ClCompile Include="..\Private\DebugCamera.cpp" />
|
||||||
|
|||||||
@@ -157,10 +157,16 @@
|
|||||||
<Filter Include="50.UI\GamePlay_Canvas\Loding_Panel\LoadingWidget_Flame">
|
<Filter Include="50.UI\GamePlay_Canvas\Loding_Panel\LoadingWidget_Flame">
|
||||||
<UniqueIdentifier>{c347da03-98f1-4095-a4e4-2c840c308916}</UniqueIdentifier>
|
<UniqueIdentifier>{c347da03-98f1-4095-a4e4-2c840c308916}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="02.GameObjects\Dummys\PhysXBox">
|
<Filter Include="02.GameObjects\Dummys\DummyPhysX">
|
||||||
|
<UniqueIdentifier>{de3719fe-5a3a-45bd-ae8f-67533b8150fc}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXPlayable">
|
||||||
|
<UniqueIdentifier>{ad93e84b-166d-4ba2-9103-f4fe0171b2ac}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXBox">
|
||||||
<UniqueIdentifier>{c7e7d3c7-fd26-4035-88b4-11233459559c}</UniqueIdentifier>
|
<UniqueIdentifier>{c7e7d3c7-fd26-4035-88b4-11233459559c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="02.GameObjects\Dummys\PhysXMesh">
|
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXMesh">
|
||||||
<UniqueIdentifier>{15a9dfe7-f3f7-4906-8bd4-91734f4ddc92}</UniqueIdentifier>
|
<UniqueIdentifier>{15a9dfe7-f3f7-4906-8bd4-91734f4ddc92}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="02.GameObjects\Env\00.Manger">
|
<Filter Include="02.GameObjects\Env\00.Manger">
|
||||||
@@ -181,6 +187,9 @@
|
|||||||
<Filter Include="02.GameObjects\Env\02.MapObject\LOD">
|
<Filter Include="02.GameObjects\Env\02.MapObject\LOD">
|
||||||
<UniqueIdentifier>{34fa4d78-8091-44cf-b4b4-59db9fd56d98}</UniqueIdentifier>
|
<UniqueIdentifier>{34fa4d78-8091-44cf-b4b4-59db9fd56d98}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXObstacle">
|
||||||
|
<UniqueIdentifier>{fbe2856d-a829-4563-a9f1-00adc4029c65}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Editor.h">
|
<ClInclude Include="Editor.h">
|
||||||
@@ -328,10 +337,10 @@
|
|||||||
<Filter>01.Level\60.PhysXLab</Filter>
|
<Filter>01.Level\60.PhysXLab</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\Public\Dummy_PhysXBox.h">
|
<ClInclude Include="..\Public\Dummy_PhysXBox.h">
|
||||||
<Filter>02.GameObjects\Dummys\PhysXBox</Filter>
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXBox</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\Public\Dummy_PhysXMesh.h">
|
<ClInclude Include="..\Public\Dummy_PhysXMesh.h">
|
||||||
<Filter>02.GameObjects\Dummys\PhysXMesh</Filter>
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXMesh</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\Public\LoadingWidget.h">
|
<ClInclude Include="..\Public\LoadingWidget.h">
|
||||||
<Filter>50.UI\GamePlay_Canvas\Loding_Panel\LoadingWidget</Filter>
|
<Filter>50.UI\GamePlay_Canvas\Loding_Panel\LoadingWidget</Filter>
|
||||||
@@ -369,6 +378,9 @@
|
|||||||
<ClInclude Include="..\public\MapObject_LOD.h">
|
<ClInclude Include="..\public\MapObject_LOD.h">
|
||||||
<Filter>02.GameObjects\Env\02.MapObject\LOD</Filter>
|
<Filter>02.GameObjects\Env\02.MapObject\LOD</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Public\Dummy_PhysXPlayable.h">
|
||||||
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXPlayable</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="Editor.ico">
|
<Image Include="Editor.ico">
|
||||||
@@ -509,10 +521,10 @@
|
|||||||
<Filter>02.GameObjects\Monster</Filter>
|
<Filter>02.GameObjects\Monster</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\Private\Dummy_PhysXBox.cpp">
|
<ClCompile Include="..\Private\Dummy_PhysXBox.cpp">
|
||||||
<Filter>02.GameObjects\Dummys\PhysXBox</Filter>
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXBox</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\Private\Dummy_PhysXMesh.cpp">
|
<ClCompile Include="..\Private\Dummy_PhysXMesh.cpp">
|
||||||
<Filter>02.GameObjects\Dummys\PhysXMesh</Filter>
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXMesh</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\Private\LoadingWidget.cpp">
|
<ClCompile Include="..\Private\LoadingWidget.cpp">
|
||||||
<Filter>50.UI\LoadingWidget</Filter>
|
<Filter>50.UI\LoadingWidget</Filter>
|
||||||
@@ -553,6 +565,9 @@
|
|||||||
<ClCompile Include="..\private\MapObject_LOD.cpp">
|
<ClCompile Include="..\private\MapObject_LOD.cpp">
|
||||||
<Filter>02.GameObjects\Env\02.MapObject\LOD</Filter>
|
<Filter>02.GameObjects\Env\02.MapObject\LOD</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Private\Dummy_PhysXPlayable.cpp">
|
||||||
|
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXPlayable</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="Editor.rc">
|
<ResourceCompile Include="Editor.rc">
|
||||||
|
|||||||
@@ -34,7 +34,32 @@ HRESULT CDummy_PhysXMesh::Initialize(void* pArg)
|
|||||||
|
|
||||||
void CDummy_PhysXMesh::Priority_Update(_float fTimeDelta)
|
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)
|
void CDummy_PhysXMesh::Update(_float fTimeDelta)
|
||||||
@@ -43,36 +68,36 @@ void CDummy_PhysXMesh::Update(_float fTimeDelta)
|
|||||||
|
|
||||||
void CDummy_PhysXMesh::Late_Update(_float fTimeDelta)
|
void CDummy_PhysXMesh::Late_Update(_float fTimeDelta)
|
||||||
{
|
{
|
||||||
//_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||||
//m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
|
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDummy_PhysXMesh::Render()
|
HRESULT CDummy_PhysXMesh::Render()
|
||||||
{
|
{
|
||||||
//if (FAILED(Bind_ShaderResources())) {
|
if (FAILED(Bind_ShaderResources())) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
//_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||||
|
|
||||||
//for (_uint i = 0; i < iNumMeshes; i++)
|
for (_uint i = 0; i < iNumMeshes; i++)
|
||||||
//{
|
{
|
||||||
// if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
// }
|
}
|
||||||
// if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
|
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SKYBOX)))) {
|
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (FAILED(m_pModelCom->Render(i))) {
|
if (FAILED(m_pModelCom->Render(i))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -83,46 +108,39 @@ HRESULT CDummy_PhysXMesh::Ready_Components(void* pArg)
|
|||||||
if (FAILED(__super::Ready_Components(pArg))) {
|
if (FAILED(__super::Ready_Components(pArg))) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
/* Com_Shader */
|
||||||
|
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||||
|
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
BOXSTARTPOS_DESC* pBox = static_cast<BOXSTARTPOS_DESC*>(pArg);
|
BOXSTARTPOS_DESC* pBox = static_cast<BOXSTARTPOS_DESC*>(pArg);
|
||||||
|
|
||||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f));
|
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f));
|
||||||
m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z);
|
m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z);
|
||||||
|
|
||||||
|
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"), (CComponent**)&m_pModelCom))) {
|
||||||
{ // RIGID_BODY
|
return E_FAIL;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(20.f, 20.f, 20.f, 1.f));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDummy_PhysXMesh::Bind_ShaderResources()
|
HRESULT CDummy_PhysXMesh::Bind_ShaderResources()
|
||||||
{
|
{
|
||||||
//if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
//if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
//if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||||
// return E_FAIL;
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,9 +174,8 @@ void CDummy_PhysXMesh::Free()
|
|||||||
{
|
{
|
||||||
__super::Free();
|
__super::Free();
|
||||||
|
|
||||||
SAFE_RELEASE(m_pRigidBody);
|
SAFE_RELEASE(m_pModelCom);
|
||||||
//SAFE_RELEASE(m_pModelCom);
|
SAFE_RELEASE(m_pShaderCom);
|
||||||
//SAFE_RELEASE(m_pShaderCom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDummy_PhysXMesh::Describe_Entity()
|
void CDummy_PhysXMesh::Describe_Entity()
|
||||||
|
|||||||
@@ -0,0 +1,200 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "Dummy_PhysXPlayable.h"
|
||||||
|
|
||||||
|
#include "GameInstance.h"
|
||||||
|
|
||||||
|
CDummy_PhysXPlayable::CDummy_PhysXPlayable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext):
|
||||||
|
CGameObject(pDevice, pContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CDummy_PhysXPlayable::CDummy_PhysXPlayable(const CDummy_PhysXPlayable& rhs):
|
||||||
|
CGameObject(rhs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDummy_PhysXPlayable::Priority_Update(_float fTimeDelta)
|
||||||
|
{
|
||||||
|
m_pTransformCom->RewindMomentum();
|
||||||
|
}
|
||||||
|
|
||||||
|
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_A)) {
|
||||||
|
m_pTransformCom->AccumulateMomentum(XMVectorSet(-1.f, 0.f, 0.f, 0.f));
|
||||||
|
}
|
||||||
|
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_D)) {
|
||||||
|
m_pTransformCom->AccumulateMomentum(XMVectorSet(1.f, 0.f, 0.f, 0.f));
|
||||||
|
}
|
||||||
|
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_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_pCharacter_Controller->Move(fTimeDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDummy_PhysXPlayable::Late_Update(_float fTimeDelta)
|
||||||
|
{
|
||||||
|
Describe_Entity();
|
||||||
|
_float4 vPos;
|
||||||
|
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||||
|
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDummy_PhysXPlayable::Render()
|
||||||
|
{
|
||||||
|
if (FAILED(Bind_ShaderResources())) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDummy_PhysXPlayable::Initialize_Prototype()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDummy_PhysXPlayable::Initialize(void* pArg)
|
||||||
|
{
|
||||||
|
if (FAILED(__super::Initialize(pArg))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(Ready_Components(pArg))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
|
||||||
|
{
|
||||||
|
if (FAILED(__super::Ready_Components(nullptr))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
CCharacter_Controller::Character_Controller_DESC Desc{};
|
||||||
|
|
||||||
|
Desc.pTransform = m_pTransformCom;
|
||||||
|
Desc.eBodyType = ACTOR::CAPSULE;
|
||||||
|
Desc.fContactOffset = 0.1f;
|
||||||
|
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.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
|
||||||
|
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Com_Model */
|
||||||
|
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Steve_Model"),
|
||||||
|
reinterpret_cast<CComponent**>(&m_pModelCom))))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
/* Com_Shader */
|
||||||
|
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH,
|
||||||
|
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
//m_pModelCom->Change_AnimationIndex(0, true, 0.4f, true);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDummy_PhysXPlayable::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_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
CDummy_PhysXPlayable* CDummy_PhysXPlayable::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||||
|
{
|
||||||
|
CDummy_PhysXPlayable* pInstance = new CDummy_PhysXPlayable(pDevice, pContext);
|
||||||
|
|
||||||
|
if (FAILED(pInstance->Initialize_Prototype()))
|
||||||
|
{
|
||||||
|
MSG_BOX("Failed to Created : CDummy_PhysXPlayable");
|
||||||
|
SAFE_RELEASE(pInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGameObject* CDummy_PhysXPlayable::Clone(void* pArg, CGameObject* pOwner)
|
||||||
|
{
|
||||||
|
CDummy_PhysXPlayable* pInstance = new CDummy_PhysXPlayable(*this);
|
||||||
|
pInstance->m_pOwner = pOwner;
|
||||||
|
if (FAILED(pInstance->Initialize(pArg)))
|
||||||
|
{
|
||||||
|
MSG_BOX("Failed to Cloned : CDummy_PhysXPlayable");
|
||||||
|
SAFE_RELEASE(pInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDummy_PhysXPlayable::Free()
|
||||||
|
{
|
||||||
|
__super::Free();
|
||||||
|
|
||||||
|
SAFE_RELEASE(m_pCharacter_Controller);
|
||||||
|
Safe_Release(m_pShaderCom);
|
||||||
|
Safe_Release(m_pModelCom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDummy_PhysXPlayable::Describe_Entity()
|
||||||
|
{
|
||||||
|
m_pCharacter_Controller->Describe_Entity();
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "DebugCamera.h"
|
#include "DebugCamera.h"
|
||||||
#include "Terrain.h"
|
#include "Terrain.h"
|
||||||
#include "Dummy_PhysXBox.h"
|
#include "Dummy_PhysXBox.h"
|
||||||
|
#include "Dummy_PhysXPlayable.h"
|
||||||
|
#include "Dummy_PhysXMesh.h"
|
||||||
|
|
||||||
CLevel_PhysXLab::CLevel_PhysXLab(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
|
CLevel_PhysXLab::CLevel_PhysXLab(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
|
||||||
: CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
|
: CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
|
||||||
@@ -66,7 +68,7 @@ HRESULT CLevel_PhysXLab::Ready_Layer_Camera(const _wstring& strLayerTag)
|
|||||||
CDebugCamera::CAMERA_DEBUG_DESC CameraDesc{};
|
CDebugCamera::CAMERA_DEBUG_DESC CameraDesc{};
|
||||||
CameraDesc.fFovy = XMConvertToRadians(60.0f);
|
CameraDesc.fFovy = XMConvertToRadians(60.0f);
|
||||||
CameraDesc.fNear = 0.1f;
|
CameraDesc.fNear = 0.1f;
|
||||||
CameraDesc.fFar = 500.f;
|
CameraDesc.fFar = 5000.f;
|
||||||
CameraDesc.vEye = _float3(0.f, 10.f, -10.f);
|
CameraDesc.vEye = _float3(0.f, 10.f, -10.f);
|
||||||
CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
|
CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
|
||||||
CameraDesc.fSpeedPerSec = 2.f;
|
CameraDesc.fSpeedPerSec = 2.f;
|
||||||
@@ -98,6 +100,23 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
CDummy_PhysXMesh::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_PhysXMesh>(g_iStaticLevel, NEXT_LEVEL, LAYER_CHUNK, &Desc))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@
|
|||||||
#pragma region PHYSX_HEADER
|
#pragma region PHYSX_HEADER
|
||||||
|
|
||||||
#include "Dummy_PhysXBox.h"
|
#include "Dummy_PhysXBox.h"
|
||||||
|
#include "Dummy_PhysXPlayable.h"
|
||||||
|
#include "Dummy_PhysXMesh.h"
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
@@ -78,7 +80,7 @@ CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
|||||||
SAFE_ADDREF(m_pContext);
|
SAFE_ADDREF(m_pContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int APIENTRY LoadingMain(void* pArg)
|
_uint APIENTRY LoadingMain(void* pArg)
|
||||||
{
|
{
|
||||||
CLoader* pLoader = static_cast<CLoader*>(pArg);
|
CLoader* pLoader = static_cast<CLoader*>(pArg);
|
||||||
|
|
||||||
@@ -210,11 +212,6 @@ HRESULT CLoader::Loading_For_Logo()
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Desc_Box"),
|
|
||||||
CModel::Create(m_pDevice, m_pContext, "../Bin/Resources/Models/Box/Box.fbx", MODEL::NONANIM, XMMatrixIdentity(), 0))))
|
|
||||||
return E_FAIL;
|
|
||||||
|
|
||||||
|
|
||||||
m_strMessage = TEXT("Prototype Loading..");
|
m_strMessage = TEXT("Prototype Loading..");
|
||||||
|
|
||||||
if (FAILED(m_pGameInstance->Add_Prototype<CDummyRect>(g_iStaticLevel, CDummyRect::Create(m_pDevice, m_pContext)))) {
|
if (FAILED(m_pGameInstance->Add_Prototype<CDummyRect>(g_iStaticLevel, CDummyRect::Create(m_pDevice, m_pContext)))) {
|
||||||
@@ -502,17 +499,39 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
|||||||
|
|
||||||
m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc));
|
m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc));
|
||||||
}
|
}
|
||||||
//{
|
|
||||||
// CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
|
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"),
|
||||||
// Desc.tRigidStaticDesc.pMesh;
|
//CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
|
||||||
// Desc.tRigidStaticDesc.vMatInfo = { 0.5f, 0.5f, 0.6f };
|
CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
|
||||||
// Desc.tRigidStaticDesc.pMeshKey = TEXT("PHYSX_STATIC_MESH");
|
return E_FAIL;
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
CModel* pModel = (CModel*)m_pGameInstance->Find_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"));
|
||||||
|
_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)))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext));
|
||||||
|
}
|
||||||
|
|
||||||
m_strMessage = TEXT("Texture Loading..");
|
m_strMessage = TEXT("Texture Loading..");
|
||||||
|
|
||||||
m_strMessage = TEXT("Model Loading..");
|
m_strMessage = TEXT("Model Loading..");
|
||||||
|
|
||||||
|
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Steve_Model"),
|
||||||
|
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Steve/Steve.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity()))))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
m_strMessage = TEXT("Shader Loading..");
|
m_strMessage = TEXT("Shader Loading..");
|
||||||
|
|
||||||
m_strMessage = TEXT("Prototype Loading..");
|
m_strMessage = TEXT("Prototype Loading..");
|
||||||
@@ -520,6 +539,12 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
|||||||
if (FAILED(m_pGameInstance->Add_Prototype<CDummy_PhysXBox>(g_iStaticLevel, CDummy_PhysXBox::Create(m_pDevice, m_pContext)))) {
|
if (FAILED(m_pGameInstance->Add_Prototype<CDummy_PhysXBox>(g_iStaticLevel, CDummy_PhysXBox::Create(m_pDevice, m_pContext)))) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
if (FAILED(m_pGameInstance->Add_Prototype<CDummy_PhysXPlayable>(g_iStaticLevel, CDummy_PhysXPlayable::Create(m_pDevice, m_pContext)))){
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
if (FAILED(m_pGameInstance->Add_Prototype<CDummy_PhysXMesh>(g_iStaticLevel, CDummy_PhysXMesh::Create(m_pDevice, m_pContext)))){
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
m_strMessage = TEXT("Loading Success!");
|
m_strMessage = TEXT("Loading Success!");
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ HRESULT CLoading_Panel::Ready_Components(void* pArg)
|
|||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Keyboard_0"), reinterpret_cast<CComponent**>(&m_pDiffuse_TextureCom), nullptr)))
|
if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Keyboard_0"), reinterpret_cast<CComponent**>(&m_pTextureCom), nullptr)))
|
||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,12 @@ HRESULT CMainApp::Ready_IMGUI()
|
|||||||
ImGui_ImplWin32_Init(g_hWnd);
|
ImGui_ImplWin32_Init(g_hWnd);
|
||||||
ImGui_ImplDX11_Init(m_pDevice, m_pContext);
|
ImGui_ImplDX11_Init(m_pDevice, m_pContext);
|
||||||
|
|
||||||
string strFontTag = "C:\\Windows\\Fonts\\malgun.ttf";
|
//string strFontTag = "C:\\Windows\\Fonts\\malgun.ttf";
|
||||||
//string strFontTag = "../Bin/Resources/Fonts/SHOWG.TTF";
|
string strFontTag = "../Bin/Resources/Fonts/malgunsl.TTF";
|
||||||
|
ImFontConfig cfg;
|
||||||
|
cfg.OversampleH = 2; // 가독성 향상
|
||||||
|
cfg.OversampleV = 2;
|
||||||
|
cfg.PixelSnapH = true;
|
||||||
ifstream ifile;
|
ifstream ifile;
|
||||||
|
|
||||||
ifile.open(strFontTag);
|
ifile.open(strFontTag);
|
||||||
@@ -119,6 +122,7 @@ HRESULT CMainApp::Ready_IMGUI()
|
|||||||
font = io.Fonts->AddFontFromFileTTF(strFontTag.c_str(), 16.f, NULL, io.Fonts->GetGlyphRangesKorean());
|
font = io.Fonts->AddFontFromFileTTF(strFontTag.c_str(), 16.f, NULL, io.Fonts->GetGlyphRangesKorean());
|
||||||
}
|
}
|
||||||
IM_ASSERT(font != NULL);
|
IM_ASSERT(font != NULL);
|
||||||
|
io.FontDefault = font;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ HRESULT CMiniMap_Panel::Bind_ShaderResources()
|
|||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
|
if (FAILED(m_pTextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
|
||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ HRESULT CMiniMap_Panel::Ready_Components(void* pArg)
|
|||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Keyboard_0"), reinterpret_cast<CComponent**>(&m_pDiffuse_TextureCom), nullptr)))
|
if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Keyboard_0"), reinterpret_cast<CComponent**>(&m_pTextureCom), nullptr)))
|
||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ void CMiniMap_Panel::Free()
|
|||||||
{
|
{
|
||||||
__super::Free();
|
__super::Free();
|
||||||
|
|
||||||
SAFE_RELEASE(m_pDiffuse_TextureCom);
|
SAFE_RELEASE(m_pTextureCom);
|
||||||
SAFE_RELEASE(m_pShaderCom);
|
SAFE_RELEASE(m_pShaderCom);
|
||||||
SAFE_RELEASE(m_pVIBufferCom);
|
SAFE_RELEASE(m_pVIBufferCom);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,13 +29,9 @@ class CDummy_PhysXMesh final : public CGameObject
|
|||||||
virtual void Update(_float fTimeDelta) override;
|
virtual void Update(_float fTimeDelta) override;
|
||||||
virtual void Late_Update(_float fTimeDelta) override;
|
virtual void Late_Update(_float fTimeDelta) override;
|
||||||
virtual HRESULT Render() override;
|
virtual HRESULT Render() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRigidBody* m_pRigidBody = { nullptr };
|
CModel* m_pModelCom = { nullptr };
|
||||||
const PSX::PxRigidDynamic* m_pActor = { nullptr };
|
CShader* m_pShaderCom = { nullptr };
|
||||||
//CModel* m_pModelCom = { nullptr };
|
|
||||||
//CShader* m_pShaderCom = { nullptr };
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual HRESULT Initialize_Prototype() override;
|
virtual HRESULT Initialize_Prototype() override;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Editor_Define.h"
|
||||||
|
#include "GameObject.h"
|
||||||
|
|
||||||
|
NS_BEGIN(Engine)
|
||||||
|
class CModel;
|
||||||
|
class CShader;
|
||||||
|
class CRigidBody;
|
||||||
|
NS_END
|
||||||
|
|
||||||
|
NS_BEGIN(Editor)
|
||||||
|
|
||||||
|
class CDummy_PhysXPlayable final : public CGameObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef struct tagBoxStartPos
|
||||||
|
{
|
||||||
|
_float3 vPos = {};
|
||||||
|
_float3 vRotRPY = {};
|
||||||
|
}BOXSTARTPOS_DESC;
|
||||||
|
private:
|
||||||
|
CDummy_PhysXPlayable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||||
|
CDummy_PhysXPlayable(const CDummy_PhysXPlayable& rhs);
|
||||||
|
virtual ~CDummy_PhysXPlayable() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void Priority_Update(_float fTimeDelta) override;
|
||||||
|
virtual void Update(_float fTimeDelta) override;
|
||||||
|
virtual void Late_Update(_float fTimeDelta) override;
|
||||||
|
virtual HRESULT Render() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CCharacter_Controller* m_pCharacter_Controller = { nullptr };
|
||||||
|
CModel* m_pModelCom = { nullptr };
|
||||||
|
CShader* m_pShaderCom = { nullptr };
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual HRESULT Initialize_Prototype() override;
|
||||||
|
virtual HRESULT Initialize(void* pArg) override;
|
||||||
|
virtual HRESULT Ready_Components(void* pArg) override;
|
||||||
|
virtual HRESULT Bind_ShaderResources() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CDummy_PhysXPlayable* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||||
|
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
|
||||||
|
virtual void Free() override;
|
||||||
|
void Describe_Entity() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_END
|
||||||
@@ -31,7 +31,7 @@ class CLoading_Panel final : public CPanelObject
|
|||||||
virtual HRESULT Initialize(void* pArg) override;
|
virtual HRESULT Initialize(void* pArg) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CTexture* m_pDiffuse_TextureCom = { nullptr };
|
CTexture* m_pTextureCom = { nullptr };
|
||||||
CShader* m_pShaderCom = { nullptr };
|
CShader* m_pShaderCom = { nullptr };
|
||||||
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
|
CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
|
||||||
CGameObject* m_pLoadingWidget = { nullptr };
|
CGameObject* m_pLoadingWidget = { nullptr };
|
||||||
|
|||||||
@@ -174,8 +174,8 @@
|
|||||||
<ClCompile Include="..\Private\Cell.cpp" />
|
<ClCompile Include="..\Private\Cell.cpp" />
|
||||||
<ClCompile Include="..\Private\Channel.cpp" />
|
<ClCompile Include="..\Private\Channel.cpp" />
|
||||||
<ClCompile Include="..\Private\Character_Controller.cpp">
|
<ClCompile Include="..\Private\Character_Controller.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\Private\Collider.cpp" />
|
<ClCompile Include="..\Private\Collider.cpp" />
|
||||||
<ClCompile Include="..\Private\Collider_Manager.cpp" />
|
<ClCompile Include="..\Private\Collider_Manager.cpp" />
|
||||||
@@ -389,8 +389,8 @@
|
|||||||
<ClInclude Include="..\Public\Cell.h" />
|
<ClInclude Include="..\Public\Cell.h" />
|
||||||
<ClInclude Include="..\Public\Channel.h" />
|
<ClInclude Include="..\Public\Channel.h" />
|
||||||
<ClInclude Include="..\Public\Character_Controller.h">
|
<ClInclude Include="..\Public\Character_Controller.h">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\Public\Collider.h" />
|
<ClInclude Include="..\Public\Collider.h" />
|
||||||
<ClInclude Include="..\Public\Collider_Manager.h" />
|
<ClInclude Include="..\Public\Collider_Manager.h" />
|
||||||
|
|||||||
@@ -2,37 +2,261 @@
|
|||||||
#include "Character_Controller.h"
|
#include "Character_Controller.h"
|
||||||
#include "GameInstance.h"
|
#include "GameInstance.h"
|
||||||
|
|
||||||
CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :
|
CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||||
m_pDevice(pDevice),
|
: CComponent{ pDevice, pContext }
|
||||||
m_pContext(pContext),
|
|
||||||
m_pGameInstance(CGameInstance::GetInstance())
|
|
||||||
{
|
{
|
||||||
SAFE_ADDREF(m_pDevice);
|
|
||||||
SAFE_ADDREF(m_pContext);
|
|
||||||
SAFE_ADDREF(m_pGameInstance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharacter_Controller* CCharacter_Controller::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, PSX::PxScene* pScene)
|
CCharacter_Controller::CCharacter_Controller(const CCharacter_Controller& rhs)
|
||||||
|
: CComponent(rhs)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacter_Controller::Modify_Volume(_float3 fVolume)
|
||||||
|
{
|
||||||
|
switch (m_eBodyType)
|
||||||
|
{
|
||||||
|
case Engine::ACTOR::BOX:
|
||||||
|
{
|
||||||
|
PSX::PxBoxController* pBox = static_cast<PSX::PxBoxController*>(m_pController);
|
||||||
|
if (0 != fVolume.x) {
|
||||||
|
pBox->setHalfSideExtent(fVolume.x);
|
||||||
|
}
|
||||||
|
if (0 != fVolume.y) {
|
||||||
|
pBox->setHalfHeight(fVolume.y);
|
||||||
|
}
|
||||||
|
if (0 != fVolume.z) {
|
||||||
|
pBox->setHalfForwardExtent(fVolume.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Engine::ACTOR::CAPSULE:
|
||||||
|
{
|
||||||
|
PSX::PxCapsuleController* pCapsule = static_cast<PSX::PxCapsuleController*>(m_pController);
|
||||||
|
if (0 != fVolume.x) {
|
||||||
|
pCapsule->setRadius(fVolume.x);
|
||||||
|
}
|
||||||
|
if (0 != fVolume.y) {
|
||||||
|
pCapsule->setHeight(fVolume.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Overlap();
|
||||||
|
}
|
||||||
|
|
||||||
|
_float3 CCharacter_Controller::Get_Volume()
|
||||||
|
{
|
||||||
|
switch (m_eBodyType)
|
||||||
|
{
|
||||||
|
case Engine::ACTOR::BOX:
|
||||||
|
{
|
||||||
|
PSX::PxBoxController* pBox = static_cast<PSX::PxBoxController*>(m_pController);
|
||||||
|
return {
|
||||||
|
pBox->getHalfSideExtent(),
|
||||||
|
pBox->getHalfHeight(),
|
||||||
|
pBox->getHalfForwardExtent()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Engine::ACTOR::CAPSULE:
|
||||||
|
{
|
||||||
|
PSX::PxCapsuleController* pCapsule = static_cast<PSX::PxCapsuleController*>(m_pController);
|
||||||
|
return {
|
||||||
|
pCapsule->getRadius(),
|
||||||
|
pCapsule->getHeight(),
|
||||||
|
0.f
|
||||||
|
};
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return { -1.f, -1.f, -1.f };
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacter_Controller::Move(_float fTimeDelta)
|
||||||
|
{
|
||||||
|
PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
|
||||||
|
_float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
|
||||||
|
_vector vMomentum = m_pTransform->Get_CurrentMomentum();
|
||||||
|
XMStoreFloat3((_float3*)&pxVecMomentum, vMomentum);
|
||||||
|
|
||||||
|
PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
|
||||||
|
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||||
|
|
||||||
|
|
||||||
|
// eCOLLISION_SIDES = (1 << 0), //!< Character is colliding to the sides.
|
||||||
|
// eCOLLISION_UP = (1 << 1), //!< Character has collision above.
|
||||||
|
// eCOLLISION_DOWN = (1 << 2) //!< Character has collision below.
|
||||||
|
m_eBeforeCollisionFlags = m_pController->move(pxVecMomentum, fMinimumDistant, fTimeDelta, pxFilter, pPxObstacles);
|
||||||
|
|
||||||
|
|
||||||
|
//PSX::PxUserControllerHitReport* pHitCallBack = { nullptr };
|
||||||
|
//PSX::PxControllerShapeHit ShapeHit = {};
|
||||||
|
//ShapeHit.
|
||||||
|
//pHitCallBack->onShapeHit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacter_Controller::Set_Position(_fvector vNewPos)
|
||||||
|
{
|
||||||
|
PSX::PxExtendedVec3 pxLVec3NewPos = {};
|
||||||
|
pxLVec3NewPos.x = vNewPos.m128_f32[0];
|
||||||
|
pxLVec3NewPos.y = vNewPos.m128_f32[1];
|
||||||
|
pxLVec3NewPos.z = vNewPos.m128_f32[2];
|
||||||
|
m_pController->setPosition(pxLVec3NewPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
_float3 CCharacter_Controller::Get_FootPosition()
|
||||||
|
{
|
||||||
|
PSX::PxExtendedVec3 pxLVecfootPos = m_pController->getFootPosition();
|
||||||
|
return { (_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z };
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacter_Controller::Resize_Volume(_float fHeight)
|
||||||
|
{
|
||||||
|
m_pController->resize(fHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CCharacter_Controller::Initialize_Prototype()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||||
|
{
|
||||||
|
Character_Controller_DESC* pDesc = static_cast<Character_Controller_DESC*>(pArg);
|
||||||
|
m_eBodyType = pDesc->eBodyType;
|
||||||
|
m_bAutoStepping = pDesc->bAutoStepping;
|
||||||
|
m_pTransform = pDesc->pTransform;
|
||||||
|
|
||||||
|
switch (m_eBodyType)
|
||||||
|
{
|
||||||
|
case Engine::ACTOR::BOX:
|
||||||
|
{
|
||||||
|
PSX::PxBoxControllerDesc Desc{};
|
||||||
|
Desc.halfHeight = {};
|
||||||
|
Desc.halfSideExtent = {};
|
||||||
|
Desc.halfForwardExtent = {};
|
||||||
|
Desc.contactOffset = pDesc->fContactOffset;
|
||||||
|
Desc.material = m_pGameInstance->Get_Material(pDesc->fMaterial);
|
||||||
|
m_pController = m_pGameInstance->Add_BoxController(Desc);
|
||||||
|
} break;
|
||||||
|
case Engine::ACTOR::CAPSULE:
|
||||||
|
{
|
||||||
|
PSX::PxCapsuleControllerDesc Desc{};
|
||||||
|
Desc.radius = pDesc->tCapsuleInfo.fRadius;
|
||||||
|
Desc.height = pDesc->tCapsuleInfo.fHeight;
|
||||||
|
Desc.climbingMode = pDesc->tCapsuleInfo.eClimbingMode; // 기본 eEASY
|
||||||
|
Desc.contactOffset = pDesc->fContactOffset;
|
||||||
|
Desc.material = m_pGameInstance->Get_Material(pDesc->fMaterial);
|
||||||
|
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
assert(false); // PhysX에서 불가능
|
||||||
|
return E_FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (nullptr == m_pController) {
|
||||||
|
assert(false);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
m_pController->setSlopeLimit(m_fSlopeLimit);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
_bool CCharacter_Controller::Check_Overlap()
|
||||||
|
{
|
||||||
|
return _bool();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharacter_Controller* CCharacter_Controller::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||||
{
|
{
|
||||||
CCharacter_Controller* pInstance = new CCharacter_Controller(pDevice, pContext);
|
CCharacter_Controller* pInstance = new CCharacter_Controller(pDevice, pContext);
|
||||||
if (FAILED(pInstance->Initialize(pScene))) {
|
|
||||||
|
if (FAILED(pInstance->Initialize_Prototype()))
|
||||||
|
{
|
||||||
|
MSG_BOX("Failed to Created : CCharacter_Controller");
|
||||||
SAFE_RELEASE(pInstance);
|
SAFE_RELEASE(pInstance);
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pInstance;
|
return pInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CCharacter_Controller::Initialize(PSX::PxScene* pScene)
|
CComponent* CCharacter_Controller::Clone(void* pArg, class CGameObject* pOwner)
|
||||||
{
|
{
|
||||||
m_pScene = pScene;
|
CCharacter_Controller* pInstance = new CCharacter_Controller(*this);
|
||||||
return S_OK;
|
pInstance->m_pOwner = pOwner;
|
||||||
|
if (FAILED(pInstance->Initialize(pArg)))
|
||||||
|
{
|
||||||
|
MSG_BOX("Failed to Cloned : CCharacter_Controller");
|
||||||
|
SAFE_RELEASE(pInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacter_Controller::Free()
|
void CCharacter_Controller::Free()
|
||||||
{
|
{
|
||||||
__super::Free();
|
__super::Free();
|
||||||
|
}
|
||||||
SAFE_RELEASE(m_pDevice);
|
|
||||||
SAFE_RELEASE(m_pContext);
|
void CCharacter_Controller::Describe_Entity()
|
||||||
SAFE_RELEASE(m_pGameInstance);
|
{
|
||||||
|
GUI::Begin("Character_Controller");
|
||||||
|
m_pTransform->Describe_Entity();
|
||||||
|
GUI::TextLinkOpenURL("More details here", "https://dev-treadmill.tistory.com/158");
|
||||||
|
_float fContact = m_pController->getContactOffset();
|
||||||
|
PSX::PxVec3 vUpDirection = m_pController->getUpDirection();
|
||||||
|
PSX::PxExtendedVec3 vCenterPosition = m_pController->getPosition();
|
||||||
|
PSX::PxExtendedVec3 vFootPosition = m_pController->getFootPosition();
|
||||||
|
_float3 vVolume = Get_Volume();
|
||||||
|
_float fStepOffset = m_pController->getStepOffset();
|
||||||
|
|
||||||
|
GUI::Text("eBodyType $d", (_uint)m_eBodyType); GUIHelpMarker("Body: only box and capsule available");
|
||||||
|
|
||||||
|
if (GUI::SliderFloat3("UpDirection", (_float*)&vUpDirection, -1.f, 1.f)) {
|
||||||
|
m_pController->setUpDirection(vUpDirection.getNormalized());
|
||||||
|
} GUIHelpMarker("Up vector in PhysX");
|
||||||
|
GUI::Text("vCenterPosition %lf, %lf, %lf", vCenterPosition.x, vCenterPosition.y, vCenterPosition.z); GUIHelpMarker("Exact center of the rigid body owned by the controller");
|
||||||
|
GUI::Text("vFootPosition %lf, %lf, %lf", vFootPosition.x, vFootPosition.y, vFootPosition.z); GUIHelpMarker("Foot position including step offset from the body center to the ground");
|
||||||
|
|
||||||
|
if (GUI::SliderFloat("ContactOffset", &fContact, 0.01f, 10.f, "%.2f")) {
|
||||||
|
m_pController->setContactOffset(fContact);
|
||||||
|
} GUIHelpMarker("Actual contact offset in PhysX; increasing it may make the controller appear to hover");
|
||||||
|
if (GUI::SliderFloat("StepOffset", &fStepOffset, 0.f, 3.f, "%.2f")) {
|
||||||
|
m_pController->setStepOffset(fStepOffset);
|
||||||
|
} GUIHelpMarker("In stepped regions, the tolerance height the controller can climb.\n Capsule behaves slightly differently.");
|
||||||
|
if (ACTOR::CAPSULE == m_eBodyType) {
|
||||||
|
PSX::PxCapsuleController* pController = (PSX::PxCapsuleController*)m_pController;
|
||||||
|
|
||||||
|
if (0.f != fStepOffset) {
|
||||||
|
switch (pController->getClimbingMode())
|
||||||
|
{
|
||||||
|
case PSX::PxCapsuleClimbingMode::eEASY:
|
||||||
|
if (GUI::Button("ClimbingMode : eEasy")) {
|
||||||
|
pController->setClimbingMode(PSX::PxCapsuleClimbingMode::eCONSTRAINED);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PSX::PxCapsuleClimbingMode::eCONSTRAINED:
|
||||||
|
if (GUI::Button("ClimbingMode : eConstrained")) {
|
||||||
|
pController->setClimbingMode(PSX::PxCapsuleClimbingMode::eEASY);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
GUIHelpMarker("A capsule is affected by its lower sphere and tends to generate an up vector on steps.\nIn eEASY, the up vector is combined with the step offset, allowing easier climbing; in eCONSTRAINED, the up vector is removed during step detection and only the step offset is used.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GUI::SliderFloat3("Volume", (_float*)&vVolume, 0.1f, 10.f, "%.2f")) {
|
||||||
|
Modify_Volume(vVolume);
|
||||||
|
}GUIHelpMarker("Box uses vSize; Capsule uses x->fRadius, y->fHeight.\nThe capsule's fHeight is likely the distance from the lower sphere center to the upper sphere center.");
|
||||||
|
|
||||||
|
GUI::End();
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ void CGameInstance::Present_TimeCost() const
|
|||||||
GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x);
|
GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x);
|
||||||
GUI::Text("Timer_Occupancy %d", int(m_fTimer_Present / fTotal * 100.f));
|
GUI::Text("Timer_Occupancy %d", int(m_fTimer_Present / fTotal * 100.f));
|
||||||
}
|
}
|
||||||
|
GUI::Text("GameInstance RefCNT : %d", m_iRefCnt);
|
||||||
static float values[60] = {};
|
static float values[60] = {};
|
||||||
static int values_offset = 0;
|
static int values_offset = 0;
|
||||||
static double refresh_time = 0.0;
|
static double refresh_time = 0.0;
|
||||||
@@ -541,10 +541,12 @@ PSX::PxMaterial* CGameInstance::Get_Material(_float3& vMatInfo)
|
|||||||
{
|
{
|
||||||
return m_pPhysX_Manager->Get_Material(vMatInfo);
|
return m_pPhysX_Manager->Get_Material(vMatInfo);
|
||||||
}
|
}
|
||||||
HRESULT CGameInstance::Create_TriangleMesh(const _wstring& wstrMeshKey, CMesh* pMesh)
|
|
||||||
|
void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh)
|
||||||
{
|
{
|
||||||
return m_pPhysX_Manager->Create_TriangleMesh(wstrMeshKey, pMesh);
|
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSX::PxShape* CGameInstance::Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag)
|
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);
|
return m_pPhysX_Manager->Create_Shape(eType, vhalfGeometryInfo, pxMaterial, bExclusive, ePxShapeFlag);
|
||||||
@@ -557,6 +559,34 @@ const PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
|
|||||||
{
|
{
|
||||||
return m_pPhysX_Manager->Add_StaticActor(RigidBody);
|
return m_pPhysX_Manager->Add_StaticActor(RigidBody);
|
||||||
}
|
}
|
||||||
|
PSX::PxController* CGameInstance::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->Add_CapsuleController(Desc);
|
||||||
|
}
|
||||||
|
PSX::PxController* CGameInstance::Add_BoxController(PSX::PxBoxControllerDesc& Desc)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->Add_BoxController(Desc);
|
||||||
|
}
|
||||||
|
PSX::PxController* CGameInstance::Get_Controller(_uint iControllerIndex)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->Get_Controller(iControllerIndex);
|
||||||
|
}
|
||||||
|
void CGameInstance::ReleaseController(_uint iControllerIndex)
|
||||||
|
{
|
||||||
|
m_pPhysX_Manager->ReleaseController(iControllerIndex);
|
||||||
|
}
|
||||||
|
HRESULT CGameInstance::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->ConvertToTriMeshes(Meshes, pxTriMeshes, WorldMatrix);
|
||||||
|
}
|
||||||
|
HRESULT CGameInstance::SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->SaveTriMeshes(pPath, TriMeshes);
|
||||||
|
}
|
||||||
|
HRESULT CGameInstance::LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||||
|
{
|
||||||
|
return m_pPhysX_Manager->LoadTriMeshes(pPath, TriMeshes);
|
||||||
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
bool CGameInstance::Key_Pressing(int _iKey)
|
bool CGameInstance::Key_Pressing(int _iKey)
|
||||||
|
|||||||
@@ -106,5 +106,5 @@ void CLight_Manager::Free()
|
|||||||
}
|
}
|
||||||
Safe_Delete(pairLight.second);
|
Safe_Delete(pairLight.second);
|
||||||
} m_pLights[i].clear();
|
} m_pLights[i].clear();
|
||||||
}
|
} Safe_Delete_Array(m_pLights);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,14 +90,16 @@ HRESULT CMesh::Initialize_Prototype(MODEL eType, vector<class CBone*>& Bones, co
|
|||||||
_uint* pIndices = new _uint[m_iNumIndices];
|
_uint* pIndices = new _uint[m_iNumIndices];
|
||||||
ZeroMemory(pIndices, sizeof(_uint) * m_iNumIndices);
|
ZeroMemory(pIndices, sizeof(_uint) * m_iNumIndices);
|
||||||
|
|
||||||
|
m_pIndices = new _uint[m_iNumIndices];
|
||||||
|
ZeroMemory(m_pIndices, sizeof(_uint) * m_iNumIndices);
|
||||||
|
|
||||||
_uint iNumIndices = {};
|
_uint iNumIndices = {};
|
||||||
|
|
||||||
for (size_t i = 0; i < pAIMesh->mNumFaces; i++)
|
for (size_t i = 0; i < pAIMesh->mNumFaces; i++)
|
||||||
{
|
{
|
||||||
|
pIndices[iNumIndices++] = m_pIndices[iNumIndices] = pAIMesh->mFaces[i].mIndices[0];
|
||||||
pIndices[iNumIndices++] = pAIMesh->mFaces[i].mIndices[0];
|
pIndices[iNumIndices++] = m_pIndices[iNumIndices] = pAIMesh->mFaces[i].mIndices[1];
|
||||||
pIndices[iNumIndices++] = pAIMesh->mFaces[i].mIndices[1];
|
pIndices[iNumIndices++] = m_pIndices[iNumIndices] = pAIMesh->mFaces[i].mIndices[2];
|
||||||
pIndices[iNumIndices++] = pAIMesh->mFaces[i].mIndices[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -352,7 +354,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(HANDLE hFile, DWORD& dwByte)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CMesh::Ready_VertexBuffer_For_NonAnim(SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix)
|
HRESULT CMesh::Ready_VertexBuffer_For_NonAnim(SaveMesh* SaveMesh, _fmatrix PreTransformMatrix)
|
||||||
{
|
{
|
||||||
m_iVertexStride = sizeof(VTXMESH);
|
m_iVertexStride = sizeof(VTXMESH);
|
||||||
D3D11_BUFFER_DESC VBDesc{};
|
D3D11_BUFFER_DESC VBDesc{};
|
||||||
@@ -371,23 +373,23 @@ HRESULT CMesh::Ready_VertexBuffer_For_NonAnim(SaveMesh* _SaveMesh, _fmatrix PreT
|
|||||||
|
|
||||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||||
{
|
{
|
||||||
memcpy(&pVertices[i].vPosition, &_SaveMesh->Vertices[i].Pos, sizeof(_float3));
|
memcpy(&pVertices[i].vPosition, &SaveMesh->Vertices[i].Pos, sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vPosition,
|
XMStoreFloat3(&pVertices[i].vPosition,
|
||||||
XMVector3TransformCoord(XMLoadFloat3(&pVertices[i].vPosition), PreTransformMatrix));
|
XMVector3TransformCoord(XMLoadFloat3(&pVertices[i].vPosition), PreTransformMatrix));
|
||||||
|
|
||||||
memcpy(&pVertices[i].vNormal, &_SaveMesh->Vertices[i].Normal, sizeof(_float3));
|
memcpy(&pVertices[i].vNormal, &SaveMesh->Vertices[i].Normal, sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vNormal,
|
XMStoreFloat3(&pVertices[i].vNormal,
|
||||||
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vNormal), PreTransformMatrix)));
|
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vNormal), PreTransformMatrix)));
|
||||||
|
|
||||||
memcpy(&pVertices[i].vTangent, &_SaveMesh->Vertices[i].Tan, sizeof(_float3));
|
memcpy(&pVertices[i].vTangent, &SaveMesh->Vertices[i].Tan, sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vTangent,
|
XMStoreFloat3(&pVertices[i].vTangent,
|
||||||
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vTangent), PreTransformMatrix)));
|
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vTangent), PreTransformMatrix)));
|
||||||
|
|
||||||
memcpy(&pVertices[i].vBinormal, &_SaveMesh->Vertices[i].BiNoraml, sizeof(_float3));
|
memcpy(&pVertices[i].vBinormal, &SaveMesh->Vertices[i].BiNoraml, sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vBinormal,
|
XMStoreFloat3(&pVertices[i].vBinormal,
|
||||||
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vBinormal), PreTransformMatrix)));
|
XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vBinormal), PreTransformMatrix)));
|
||||||
|
|
||||||
pVertices[i].vTexcoord = _SaveMesh->Vertices[i].UV;
|
pVertices[i].vTexcoord = SaveMesh->Vertices[i].UV;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_SUBRESOURCE_DATA InitialVBData{};
|
D3D11_SUBRESOURCE_DATA InitialVBData{};
|
||||||
@@ -420,6 +422,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
|||||||
|
|
||||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||||
{
|
{
|
||||||
|
memcpy(&m_pVertexPositions[i], &_SaveMesh->Vertices[i].Pos, sizeof(_float3));
|
||||||
memcpy(&pVertices[i].vPosition, &_SaveMesh->Vertices[i].Pos, sizeof(_float3));
|
memcpy(&pVertices[i].vPosition, &_SaveMesh->Vertices[i].Pos, sizeof(_float3));
|
||||||
if (_SaveMesh->Vertices[i].bHasNormal)
|
if (_SaveMesh->Vertices[i].bHasNormal)
|
||||||
memcpy(&pVertices[i].vNormal, &_SaveMesh->Vertices[i].Normal, sizeof(_float3));
|
memcpy(&pVertices[i].vNormal, &_SaveMesh->Vertices[i].Normal, sizeof(_float3));
|
||||||
@@ -604,26 +607,42 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam)
|
PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _fmatrix WorldMatrix)
|
||||||
{
|
{
|
||||||
PSX::PxTriangleMeshDesc Desc;
|
PSX::PxTriangleMeshDesc tMeshDesc = {};
|
||||||
vector<PSX::PxVec3> Vertices;
|
vector<PSX::PxVec3> Vertices = {};
|
||||||
vector<PSX::PxU32> Triangles;
|
vector<PSX::PxU32> Triangles = {};
|
||||||
{
|
{
|
||||||
Desc.points.count = m_iNumVertices;
|
tMeshDesc.points.count = m_iNumVertices;
|
||||||
Desc.points.stride = sizeof(PSX::PxVec3);
|
tMeshDesc.points.stride = sizeof(PSX::PxVec3);
|
||||||
Vertices.resize(m_iNumVertices);
|
Vertices.resize(m_iNumVertices);
|
||||||
memcpy_s(Vertices.data(), sizeof(PSX::PxVec3) * m_iNumVertices, m_pVertexPositions, sizeof(_float3) * m_iNumVertices);
|
XMVector3TransformCoordStream(reinterpret_cast<_float3*>(Vertices.data()), sizeof(PSX::PxVec3), (_float3*)m_pVertexPositions, sizeof(_float3), m_iNumVertices, WorldMatrix);
|
||||||
Desc.points.data = Vertices.data();
|
tMeshDesc.points.data = Vertices.data();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Desc.triangles.count = m_iNumIndices / 3;
|
tMeshDesc.triangles.count = m_iNumIndices / 3;
|
||||||
Desc.triangles.stride = sizeof(PSX::PxU32) * 3;
|
tMeshDesc.triangles.stride = sizeof(PSX::PxU32) * 3;
|
||||||
Triangles.resize(m_iNumIndices);
|
Triangles.resize(m_iNumIndices);
|
||||||
memcpy_s(Triangles.data(), sizeof(PSX::PxU32) * m_iNumIndices, m_pIndices, sizeof(PSX::PxU32) * m_iNumIndices);
|
memcpy_s(Triangles.data(), sizeof(PSX::PxU32) * m_iNumIndices, m_pIndices, sizeof(PSX::PxU32) * m_iNumIndices);
|
||||||
Desc.triangles.data = Triangles.data();
|
tMeshDesc.triangles.data = Triangles.data();
|
||||||
}
|
}
|
||||||
PSX::PxTriangleMesh* pTriangleMesh = PxCreateTriangleMesh(*pParam, Desc);
|
PSX::PxDefaultMemoryOutputStream streamWriteBuffer = {};
|
||||||
|
PSX::PxTriangleMeshCookingResult::Enum eCookResult = {};
|
||||||
|
const _bool bCooked = PxCookTriangleMesh(*pParam, tMeshDesc, streamWriteBuffer, &eCookResult);
|
||||||
|
if (false == bCooked) {
|
||||||
|
assert(false);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
PSX::PxDefaultMemoryInputData readBuff(streamWriteBuffer.getData(), streamWriteBuffer.getSize());
|
||||||
|
PSX::PxTriangleMesh* pTriangleMesh = pPhysX->createTriangleMesh(readBuff);
|
||||||
|
PX_ASSERT(pTriangleMesh);
|
||||||
|
PX_ASSERT(pTriangleMesh->getReferenceCount() == 1);
|
||||||
|
if (nullptr == pTriangleMesh) {
|
||||||
|
assert(false);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return pTriangleMesh;
|
return pTriangleMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,6 +666,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_NonAnim(const aiMesh* pAIMesh, _fmatrix Pr
|
|||||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||||
{
|
{
|
||||||
memcpy(&pVertices[i].vPosition, &pAIMesh->mVertices[i], sizeof(_float3));
|
memcpy(&pVertices[i].vPosition, &pAIMesh->mVertices[i], sizeof(_float3));
|
||||||
|
memcpy(&m_pVertexPositions[i], &pAIMesh->mVertices[i], sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vPosition, XMVector3TransformCoord(XMLoadFloat3(&pVertices[i].vPosition), PreTransformMatrix));
|
XMStoreFloat3(&pVertices[i].vPosition, XMVector3TransformCoord(XMLoadFloat3(&pVertices[i].vPosition), PreTransformMatrix));
|
||||||
memcpy(&pVertices[i].vNormal, &pAIMesh->mNormals[i], sizeof(_float3));
|
memcpy(&pVertices[i].vNormal, &pAIMesh->mNormals[i], sizeof(_float3));
|
||||||
XMStoreFloat3(&pVertices[i].vNormal, XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vNormal), PreTransformMatrix)));
|
XMStoreFloat3(&pVertices[i].vNormal, XMVector3Normalize(XMVector3TransformNormal(XMLoadFloat3(&pVertices[i].vNormal), PreTransformMatrix)));
|
||||||
@@ -688,6 +708,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(vector<class CBone*>& Bones, const ai
|
|||||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||||
{
|
{
|
||||||
memcpy(&pVertices[i].vPosition, &pAIMesh->mVertices[i], sizeof(_float3));
|
memcpy(&pVertices[i].vPosition, &pAIMesh->mVertices[i], sizeof(_float3));
|
||||||
|
memcpy(&m_pVertexPositions[i], &pAIMesh->mVertices[i], sizeof(_float3));
|
||||||
memcpy(&pVertices[i].vNormal, &pAIMesh->mNormals[i], sizeof(_float3));
|
memcpy(&pVertices[i].vNormal, &pAIMesh->mNormals[i], sizeof(_float3));
|
||||||
memcpy(&pVertices[i].vTangent, &pAIMesh->mTangents[i], sizeof(_float3));
|
memcpy(&pVertices[i].vTangent, &pAIMesh->mTangents[i], sizeof(_float3));
|
||||||
memcpy(&pVertices[i].vBinormal, &pAIMesh->mBitangents[i], sizeof(_float3));
|
memcpy(&pVertices[i].vBinormal, &pAIMesh->mBitangents[i], sizeof(_float3));
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ _bool CModel::Play_Animation(_float fTimeDelta)
|
|||||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta);
|
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < m_Bones.size(); ++i)
|
for (_int i = 0; i < m_Bones.size(); ++i)
|
||||||
{
|
{
|
||||||
m_Bones[i]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
m_Bones[i]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ _float CModel::Get_AnimProgressRatio()
|
|||||||
{
|
{
|
||||||
return m_Animations[m_iCurrentAnimIndex]->Get_AnimProgressRatio();
|
return m_Animations[m_iCurrentAnimIndex]->Get_AnimProgressRatio();
|
||||||
}
|
}
|
||||||
_int CModel::Get_AnimProgressPostion(const char* pAnimChannelName)
|
_int CModel::Get_AnimProgressPostion(const _char* pAnimChannelName)
|
||||||
{
|
{
|
||||||
return m_Animations[m_iCurrentAnimIndex]->Get_AnimProgressPostion(pAnimChannelName);
|
return m_Animations[m_iCurrentAnimIndex]->Get_AnimProgressPostion(pAnimChannelName);
|
||||||
}
|
}
|
||||||
@@ -262,6 +262,11 @@ const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName) const
|
|||||||
return (*iter)->Get_CombinedTransformationMatrixPtr();
|
return (*iter)->Get_CombinedTransformationMatrixPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _char* CModel::Get_MeshName(_uint iIndex)
|
||||||
|
{
|
||||||
|
return m_Meshes[iIndex]->Get_Name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_matrix CModel::Get_BoneMatrix(_uint iBoneIndex)
|
_matrix CModel::Get_BoneMatrix(_uint iBoneIndex)
|
||||||
{
|
{
|
||||||
@@ -340,6 +345,28 @@ HRESULT CModel::Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& Pre
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CModel::Ready_PhysXMeshes()
|
||||||
|
{
|
||||||
|
m_iNumPhysXMeshes = m_iNumMeshes;
|
||||||
|
|
||||||
|
m_TriMeshes.reserve(m_iNumMeshes);
|
||||||
|
|
||||||
|
m_pGameInstance->ConvertToTriMeshes(m_Meshes, m_TriMeshes, m_pTransform->Get_XMWorldMatrix());
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CModel::Save_PhysXTriMeshes(const _char* pModelFilePath)
|
||||||
|
{
|
||||||
|
if (FAILED(Ready_PhysXMeshes())) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
for (_uint i = 0; i < m_iNumMeshes; ++i) {
|
||||||
|
m_pGameInstance->RegistTriMesh(m_Meshes[i]->Get_Name(), m_TriMeshes[i]);
|
||||||
|
}
|
||||||
|
return m_pGameInstance->SaveTriMeshes(pModelFilePath, m_TriMeshes);
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CModel::Ready_Materials(const aiScene* pAIScene, const _char* pModelFilePath)
|
HRESULT CModel::Ready_Materials(const aiScene* pAIScene, const _char* pModelFilePath)
|
||||||
{
|
{
|
||||||
m_iNumMaterials = pAIScene->mNumMaterials;
|
m_iNumMaterials = pAIScene->mNumMaterials;
|
||||||
@@ -462,7 +489,7 @@ HRESULT CModel::Ready_Bones(const aiNode* pAINode, _int iParentIndex)
|
|||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
bool CModel::SaveAssimpModel(const _char* filename)
|
_bool CModel::SaveAssimpModel(const _char* filename)
|
||||||
{
|
{
|
||||||
if (!m_pAIScene) return false;
|
if (!m_pAIScene) return false;
|
||||||
|
|
||||||
@@ -477,7 +504,7 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
modelData.MeshCount = m_pAIScene->mNumMeshes;
|
modelData.MeshCount = m_pAIScene->mNumMeshes;
|
||||||
modelData.MaterialCount = m_pAIScene->mNumMaterials;
|
modelData.MaterialCount = m_pAIScene->mNumMaterials;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_pAIScene->mNumMeshes; i++)
|
for (_uint i = 0; i < m_pAIScene->mNumMeshes; i++)
|
||||||
{
|
{
|
||||||
aiMesh* mesh = m_pAIScene->mMeshes[i];
|
aiMesh* mesh = m_pAIScene->mMeshes[i];
|
||||||
SaveMesh saveMesh{};
|
SaveMesh saveMesh{};
|
||||||
@@ -487,7 +514,7 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
saveMesh.MaterialIndex = mesh->mMaterialIndex;
|
saveMesh.MaterialIndex = mesh->mMaterialIndex;
|
||||||
|
|
||||||
saveMesh.Vertices.resize(saveMesh.VertexCount);
|
saveMesh.Vertices.resize(saveMesh.VertexCount);
|
||||||
for (unsigned int i = 0; i < mesh->mNumVertices; i++)
|
for (_uint i = 0; i < mesh->mNumVertices; i++)
|
||||||
{
|
{
|
||||||
saveMesh.Vertices[i].Pos = XMFLOAT3{ mesh->mVertices[i].x , mesh->mVertices[i].y,mesh->mVertices[i].z };
|
saveMesh.Vertices[i].Pos = XMFLOAT3{ mesh->mVertices[i].x , mesh->mVertices[i].y,mesh->mVertices[i].z };
|
||||||
|
|
||||||
@@ -561,10 +588,10 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveMesh.Indices.reserve(saveMesh.IndexCount);
|
saveMesh.Indices.reserve(saveMesh.IndexCount);
|
||||||
for (unsigned int i = 0; i < mesh->mNumFaces; i++)
|
for (_uint i = 0; i < mesh->mNumFaces; i++)
|
||||||
{
|
{
|
||||||
aiFace& face = mesh->mFaces[i];
|
aiFace& face = mesh->mFaces[i];
|
||||||
for (unsigned int idx = 0; idx < face.mNumIndices; idx++)
|
for (_uint idx = 0; idx < face.mNumIndices; idx++)
|
||||||
saveMesh.Indices.push_back(face.mIndices[idx]);
|
saveMesh.Indices.push_back(face.mIndices[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +607,7 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
SaveNodeRecursive(m_pAIScene->mRootNode, allNodes, -1);
|
SaveNodeRecursive(m_pAIScene->mRootNode, allNodes, -1);
|
||||||
|
|
||||||
modelData.AnimationCount = m_pAIScene->mNumAnimations;
|
modelData.AnimationCount = m_pAIScene->mNumAnimations;
|
||||||
for (unsigned int i = 0; i < modelData.AnimationCount; i++)
|
for (_uint i = 0; i < modelData.AnimationCount; i++)
|
||||||
{
|
{
|
||||||
aiAnimation* Anim = m_pAIScene->mAnimations[i];
|
aiAnimation* Anim = m_pAIScene->mAnimations[i];
|
||||||
SaveAnimation saveAnim{};
|
SaveAnimation saveAnim{};
|
||||||
@@ -661,7 +688,7 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
for (auto& Weights : bone.Weights)
|
for (auto& Weights : bone.Weights)
|
||||||
{
|
{
|
||||||
fwrite(&Weights.VertexId, sizeof(_uint), 1, fp);
|
fwrite(&Weights.VertexId, sizeof(_uint), 1, fp);
|
||||||
fwrite(&Weights.Weight, sizeof(float), 1, fp);
|
fwrite(&Weights.Weight, sizeof(_float), 1, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,13 +697,13 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
for (auto& node : allNodes)
|
for (auto& node : allNodes)
|
||||||
{
|
{
|
||||||
fwrite(node.Name, sizeof(node.Name), 1, fp);
|
fwrite(node.Name, sizeof(node.Name), 1, fp);
|
||||||
fwrite(&node.ParentIndex, sizeof(int), 1, fp);
|
fwrite(&node.ParentIndex, sizeof(_int), 1, fp);
|
||||||
fwrite(&node.Transformation, sizeof(XMFLOAT4X4), 1, fp);
|
fwrite(&node.Transformation, sizeof(XMFLOAT4X4), 1, fp);
|
||||||
fwrite(&node.ChildrenCount, sizeof(_uint), 1, fp);
|
fwrite(&node.ChildrenCount, sizeof(_uint), 1, fp);
|
||||||
|
|
||||||
for (auto child : node.ChildrenIndices)
|
for (auto child : node.ChildrenIndices)
|
||||||
{
|
{
|
||||||
fwrite(&child, sizeof(int), 1, fp);
|
fwrite(&child, sizeof(_int), 1, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +738,7 @@ bool CModel::SaveAssimpModel(const _char* filename)
|
|||||||
{
|
{
|
||||||
_uint len = static_cast<_uint>(path.size());
|
_uint len = static_cast<_uint>(path.size());
|
||||||
fwrite(&len, sizeof(_uint), 1, fp);
|
fwrite(&len, sizeof(_uint), 1, fp);
|
||||||
fwrite(path.c_str(), sizeof(char), len, fp);
|
fwrite(path.c_str(), sizeof(_char), len, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -739,30 +766,17 @@ _int CModel::SaveNodeRecursive(const aiNode* pAINode, std::vector<SaveNode>& out
|
|||||||
node.ChildrenCount = pAINode->mNumChildren;
|
node.ChildrenCount = pAINode->mNumChildren;
|
||||||
node.ChildrenIndices.resize(node.ChildrenCount);
|
node.ChildrenIndices.resize(node.ChildrenCount);
|
||||||
|
|
||||||
int currentIndex = static_cast<int>(outNodes.size());
|
_int currentIndex = static_cast<_int>(outNodes.size());
|
||||||
outNodes.push_back(node);
|
outNodes.push_back(node);
|
||||||
|
|
||||||
for (size_t i = 0; i < pAINode->mNumChildren; i++)
|
for (size_t i = 0; i < pAINode->mNumChildren; i++)
|
||||||
{
|
{
|
||||||
int childIndex = SaveNodeRecursive(pAINode->mChildren[i], outNodes, currentIndex);
|
_int childIndex = SaveNodeRecursive(pAINode->mChildren[i], outNodes, currentIndex);
|
||||||
outNodes[currentIndex].ChildrenIndices[i] = childIndex;
|
outNodes[currentIndex].ChildrenIndices[i] = childIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentIndex;
|
return currentIndex;
|
||||||
}
|
}
|
||||||
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
|
||||||
{
|
|
||||||
CModel* pInstance = new CModel(pDevice, pContext);
|
|
||||||
|
|
||||||
if (FAILED(pInstance->Initialize_Prototype(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex)))
|
|
||||||
{
|
|
||||||
MSG_BOX("Failed to Created : CModel");
|
|
||||||
SAFE_RELEASE(pInstance);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||||
{
|
{
|
||||||
_uint iFlag = {};
|
_uint iFlag = {};
|
||||||
@@ -791,9 +805,17 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
|
|||||||
#pragma region Material
|
#pragma region Material
|
||||||
if (MODEL::ENVIROMENT == eType)
|
if (MODEL::ENVIROMENT == eType)
|
||||||
{
|
{
|
||||||
|
#ifdef 扁公府
|
||||||
|
if (FAILED(Ready_Materials(m_pAIScene, pModelFilePath))) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
#endif // 扁公府
|
||||||
|
#ifndef 扁公府
|
||||||
if (FAILED(Ready_Materials_FromFile(m_pAIScene, pModelFilePath))) {
|
if (FAILED(Ready_Materials_FromFile(m_pAIScene, pModelFilePath))) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
#endif // !扁公府
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -815,19 +837,11 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CModel::Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
|
||||||
{
|
|
||||||
return Assimp_Model_Load(pModelFilePath, eType, PreTransformMatrix, iRootBoneIndex);
|
|
||||||
}
|
|
||||||
#endif // EDITOR_PROJECT
|
#endif // EDITOR_PROJECT
|
||||||
|
|
||||||
HRESULT CModel::Initialize_Prototype()
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix)
|
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix)
|
||||||
{
|
{
|
||||||
|
m_eType = eType;
|
||||||
_char szTextureFileName[MAX_PATH] = {};
|
_char szTextureFileName[MAX_PATH] = {};
|
||||||
_char szDir[MAX_PATH] = {};
|
_char szDir[MAX_PATH] = {};
|
||||||
_char szName[MAX_PATH] = {};
|
_char szName[MAX_PATH] = {};
|
||||||
@@ -851,28 +865,37 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
|
|||||||
}
|
}
|
||||||
m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath);
|
m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath);
|
||||||
|
|
||||||
m_eType = eType;
|
|
||||||
XMStoreFloat4x4(&m_PreTransformMatrix, PreTransformMatrix);
|
XMStoreFloat4x4(&m_PreTransformMatrix, PreTransformMatrix);
|
||||||
|
|
||||||
Ready_Bones(m_pSaveModel->Nodes, 0, -1);
|
Ready_Bones(m_pSaveModel->Nodes, 0, -1);
|
||||||
|
|
||||||
if (FAILED(Ready_Meshes()))
|
if (FAILED(Ready_Meshes())){
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(Ready_Materials(pModelFilePath)))
|
if (FAILED(Ready_Materials(pModelFilePath))){
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(Ready_Animations()))
|
if (FAILED(Ready_Animations())){
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (MODEL::ENVIROMENT == m_eType) {
|
||||||
|
m_pGameInstance->LoadTriMeshes(pModelFilePath, m_TriMeshes);
|
||||||
|
for (_uint i = 0; i < m_iNumMeshes; ++i) {
|
||||||
|
m_pGameInstance->RegistTriMesh(m_Meshes[i]->Get_Name(), m_TriMeshes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CModel::LoadData(const _char* filename)
|
_bool CModel::LoadData(const _char* filename)
|
||||||
{
|
{
|
||||||
FILE* fp = nullptr;
|
FILE* fp = nullptr;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
@@ -920,13 +943,13 @@ bool CModel::LoadData(const _char* filename)
|
|||||||
for (size_t i = 0; i < NewModel.NodeCount; i++)
|
for (size_t i = 0; i < NewModel.NodeCount; i++)
|
||||||
{
|
{
|
||||||
fread(NewModel.Nodes[i].Name, sizeof(NewModel.Nodes[i].Name), 1, fp);
|
fread(NewModel.Nodes[i].Name, sizeof(NewModel.Nodes[i].Name), 1, fp);
|
||||||
fread(&NewModel.Nodes[i].ParentIndex, sizeof(int), 1, fp);
|
fread(&NewModel.Nodes[i].ParentIndex, sizeof(_int), 1, fp);
|
||||||
fread(&NewModel.Nodes[i].Transformation, sizeof(XMFLOAT4X4), 1, fp);
|
fread(&NewModel.Nodes[i].Transformation, sizeof(XMFLOAT4X4), 1, fp);
|
||||||
fread(&NewModel.Nodes[i].ChildrenCount, sizeof(_uint), 1, fp);
|
fread(&NewModel.Nodes[i].ChildrenCount, sizeof(_uint), 1, fp);
|
||||||
NewModel.Nodes[i].ChildrenIndices.resize(NewModel.Nodes[i].ChildrenCount);
|
NewModel.Nodes[i].ChildrenIndices.resize(NewModel.Nodes[i].ChildrenCount);
|
||||||
for (size_t j = 0; j < NewModel.Nodes[i].ChildrenCount; j++)
|
for (size_t j = 0; j < NewModel.Nodes[i].ChildrenCount; j++)
|
||||||
{
|
{
|
||||||
fread(&NewModel.Nodes[i].ChildrenIndices[j], sizeof(int), 1, fp);
|
fread(&NewModel.Nodes[i].ChildrenIndices[j], sizeof(_int), 1, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,7 +996,7 @@ bool CModel::LoadData(const _char* filename)
|
|||||||
fread(&len, sizeof(_uint), 1, fp);
|
fread(&len, sizeof(_uint), 1, fp);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
temp.resize(len);
|
temp.resize(len);
|
||||||
fread(&temp[0], sizeof(char), len, fp);
|
fread(&temp[0], sizeof(_char), len, fp);
|
||||||
mat.Path[k][j] = temp;
|
mat.Path[k][j] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1070,19 +1093,6 @@ HRESULT CModel::Ready_Animations()
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
|
||||||
{
|
|
||||||
CModel* pInstance = new CModel(pDevice, pContext);
|
|
||||||
|
|
||||||
if (FAILED(pInstance->Initialize_Prototype()))
|
|
||||||
{
|
|
||||||
MSG_BOX("Failed to Created : CModel");
|
|
||||||
SAFE_RELEASE(pInstance);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath,_fmatrix PreTransformMatrix)
|
CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath,_fmatrix PreTransformMatrix)
|
||||||
{
|
{
|
||||||
CModel* pInstance = new CModel(pDevice, pContext);
|
CModel* pInstance = new CModel(pDevice, pContext);
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
|
|||||||
pPxMeshGeometry = iter->second;
|
pPxMeshGeometry = iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
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, *RigidBody.Get_PxMaterial());
|
||||||
|
|
||||||
@@ -122,21 +121,139 @@ PSX::PxShape* CPhysX_Manager::Create_Shape(ACTOR eType, _float3& vhalfGeometryIn
|
|||||||
return pShape;
|
return pShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CPhysX_Manager::Create_TriangleMesh(const _wstring& wstrMeshKey, CMesh* pMesh)
|
void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh) {
|
||||||
{
|
m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh);
|
||||||
|
|
||||||
PSX::PxTriangleMesh* pTriangleMesh = pMesh->ConvertToPxMesh(m_pCookingParam);
|
PSX::PxTriangleMeshGeometry* pGeometry = new PSX::PxTriangleMeshGeometry(pPxTriMesh);
|
||||||
if (nullptr != pTriangleMesh) {
|
pGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
|
||||||
m_TriangleMeshes.emplace(wstrMeshKey, pTriangleMesh);
|
m_TriangleMeshGeometry.emplace(CMyTools::ToWstring(pName), pGeometry);
|
||||||
|
|
||||||
PSX::PxTriangleMeshGeometry* pGeometry = new PSX::PxTriangleMeshGeometry(pTriangleMesh);
|
|
||||||
pGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
|
|
||||||
m_TriangleMeshGeometry.emplace(wstrMeshKey, pGeometry);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CPhysX_Manager::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < Meshes.size(); ++i)
|
||||||
|
{
|
||||||
|
PSX::PxTriangleMesh* pTriangleMesh = Meshes[i]->ConvertToPxMesh(m_pCookingParam, m_pPhysics, WorldMatrix);
|
||||||
|
PX_ASSERT(pTriangleMesh);
|
||||||
|
PX_ASSERT(pTriangleMesh->getReferenceCount() == 1);
|
||||||
|
if (nullptr == pTriangleMesh) {
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
pxTriMeshes.push_back(pTriangleMesh);
|
||||||
|
}
|
||||||
|
pxTriMeshes.shrink_to_fit();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CPhysX_Manager::SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||||
|
{
|
||||||
|
filesystem::path pathPhysX = pPath;
|
||||||
|
pathPhysX.replace_extension(".Pxml");
|
||||||
|
if (TriMeshes.empty()){
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
filesystem::create_directories(pathPhysX.parent_path());
|
||||||
|
|
||||||
|
PSX::PxSerializationRegistry* pSerializationRegistry = PSX::PxSerialization::createSerializationRegistry(*m_pPhysics);
|
||||||
|
PSX::PxCollection* pCollections = PxCreateCollection();
|
||||||
|
if (nullptr == pCollections) {
|
||||||
|
pSerializationRegistry->release();
|
||||||
|
assert(pCollections);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PSX::PxTriangleMesh* pTriMesh : TriMeshes) {
|
||||||
|
pCollections->add(*pTriMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
PSX::PxSerialization::complete(*pCollections, *pSerializationRegistry);
|
||||||
|
PSX::PxDefaultFileOutputStream out(pathPhysX.string().c_str());
|
||||||
|
PSX::PxCollection* extRefs = PxCreateCollection();
|
||||||
|
const _bool ok = PSX::PxSerialization::serializeCollectionToXml(out, *pCollections, *pSerializationRegistry, m_pCookingParam, extRefs);
|
||||||
|
|
||||||
|
extRefs->release();
|
||||||
|
pCollections->release();
|
||||||
|
pSerializationRegistry->release();
|
||||||
|
assert(ok);
|
||||||
|
return (ok ? S_OK : E_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CPhysX_Manager::LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||||
|
{
|
||||||
|
filesystem::path pathPhysX = pPath;
|
||||||
|
pathPhysX.replace_extension(".Pxml");
|
||||||
|
|
||||||
|
PSX::PxSerializationRegistry* pSerializationRegistry = PSX::PxSerialization::createSerializationRegistry(*m_pPhysics);
|
||||||
|
|
||||||
|
PSX::PxDefaultFileInputData InputData(pathPhysX.string().c_str());
|
||||||
|
PSX::PxCollection* extRefs = PxCreateCollection();
|
||||||
|
|
||||||
|
PSX::PxCollection* pCollections = PSX::PxSerialization::createCollectionFromXml(InputData, *m_pCookingParam, *pSerializationRegistry, extRefs);
|
||||||
|
if (nullptr == pCollections) {
|
||||||
|
extRefs->release();
|
||||||
|
pSerializationRegistry->release();
|
||||||
|
assert(pCollections);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PSX::PxU32 iNumTriMeshes = pCollections->getNbObjects();
|
||||||
|
TriMeshes.reserve(iNumTriMeshes);
|
||||||
|
for (PSX::PxU32 i = 0; i < iNumTriMeshes; ++i) {
|
||||||
|
PSX::PxBase& pObject = pCollections->getObject(i);
|
||||||
|
|
||||||
|
if (pObject.getConcreteType() == PSX::PxConcreteType::eTRIANGLE_MESH_BVH34) {
|
||||||
|
PSX::PxTriangleMesh* pTriMesh = static_cast<PSX::PxTriangleMesh*>(&pObject);
|
||||||
|
pTriMesh->acquireReference();
|
||||||
|
TriMeshes.push_back(pTriMesh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extRefs->release();
|
||||||
|
pCollections->release();
|
||||||
|
pSerializationRegistry->release();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 바이너리 로드에는 128B 정렬된 메모리 포인터를 넘겨야 함. InputData 그대로 넘기면 안됨
|
||||||
|
// 심지어 바이너리로 불러온 블럭은 피직스의 모든 메시들을 릴리즈 한 뒤에 해제 해야 함
|
||||||
|
//_bool CPhysX_Manager::LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||||
|
//{
|
||||||
|
// filesystem::path pathPhysX = pPath;
|
||||||
|
// pathPhysX.replace_extension(".bmap");
|
||||||
|
//
|
||||||
|
// PSX::PxSerializationRegistry* pSerializationRegistry = PSX::PxSerialization::createSerializationRegistry(*m_pPhysics);
|
||||||
|
//
|
||||||
|
// PSX::PxDefaultFileInputData InputData(pathPhysX.string().c_str());
|
||||||
|
// PSX::PxCollection* extRefs = PxCreateCollection();
|
||||||
|
//
|
||||||
|
// PSX::PxCollection* pCollections = PSX::PxSerialization::createCollectionFromBinary(&InputData, *pSerializationRegistry, extRefs);
|
||||||
|
// if (nullptr == pCollections) {
|
||||||
|
// extRefs->release();
|
||||||
|
// pSerializationRegistry->release();
|
||||||
|
// assert(pCollections);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// const PSX::PxU32 iNumTriMeshes = pCollections->getNbObjects();
|
||||||
|
// TriMeshes.reserve(iNumTriMeshes);
|
||||||
|
// for (PSX::PxU32 i = 0; i < iNumTriMeshes; ++i) {
|
||||||
|
// PSX::PxBase& pObject = pCollections->getObject(i);
|
||||||
|
//
|
||||||
|
// if (pObject.getConcreteType() == PSX::PxConcreteType::eTRIANGLE_MESH_BVH34) {
|
||||||
|
// PSX::PxTriangleMesh* pTriMesh = static_cast<PSX::PxTriangleMesh*>(&pObject);
|
||||||
|
// pTriMesh->acquireReference();
|
||||||
|
// TriMeshes.push_back(pTriMesh);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// extRefs->release();
|
||||||
|
// pCollections->release();
|
||||||
|
// pSerializationRegistry->release();
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _wstring& wstrMeshKey)
|
PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _wstring& wstrMeshKey)
|
||||||
{
|
{
|
||||||
map<_wstring, PSX::PxTriangleMesh*>::iterator iter = m_TriangleMeshes.find(wstrMeshKey);
|
map<_wstring, PSX::PxTriangleMesh*>::iterator iter = m_TriangleMeshes.find(wstrMeshKey);
|
||||||
@@ -279,6 +396,7 @@ HRESULT CPhysX_Manager::Initialize()
|
|||||||
m_pPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *m_pFoundation, m_ToleranceScale, true, m_pPvd);
|
m_pPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *m_pFoundation, m_ToleranceScale, true, m_pPvd);
|
||||||
|
|
||||||
m_pCookingParam = new PSX::PxCookingParams(m_pPhysics->getTolerancesScale());
|
m_pCookingParam = new PSX::PxCookingParams(m_pPhysics->getTolerancesScale());
|
||||||
|
m_pCookingParam->meshPreprocessParams |= PSX::PxMeshPreprocessingFlag::eWELD_VERTICES;
|
||||||
PSX::PxSceneDesc sceneDesc = { m_pPhysics->getTolerancesScale() };
|
PSX::PxSceneDesc sceneDesc = { m_pPhysics->getTolerancesScale() };
|
||||||
|
|
||||||
sceneDesc.gravity = PSX::PxVec3(0.f, -GRAVITY, 0.f);
|
sceneDesc.gravity = PSX::PxVec3(0.f, -GRAVITY, 0.f);
|
||||||
@@ -299,7 +417,7 @@ HRESULT CPhysX_Manager::Initialize()
|
|||||||
}
|
}
|
||||||
m_pScene = m_pPhysics->createScene(sceneDesc);
|
m_pScene = m_pPhysics->createScene(sceneDesc);
|
||||||
m_pCCTManager = PxCreateControllerManager(*m_pScene);
|
m_pCCTManager = PxCreateControllerManager(*m_pScene);
|
||||||
|
m_pCCTManager->setOverlapRecoveryModule(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// µð¹ö±×¼¹öÀÇ Å¬¶ó ¼¼ÆÃ
|
// µð¹ö±×¼¹öÀÇ Å¬¶ó ¼¼ÆÃ
|
||||||
@@ -310,15 +428,17 @@ HRESULT CPhysX_Manager::Initialize()
|
|||||||
pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true);
|
pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//physx::PxMaterial* pMaterial = m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f);
|
// m_pScene->overlap();??????
|
||||||
//physx::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *pMaterial);
|
|
||||||
|
#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_pScene->addActor(*pGroundPlane);
|
||||||
|
|
||||||
//{
|
//{
|
||||||
|
|
||||||
// float halfExtent = .5f;
|
// float halfExtent = .5f;
|
||||||
// physx::PxShape* shape = m_pPhysics->createShape(physx::PxSphereGeometry(halfExtent), *pMaterial);
|
// physx::PxShape* shape = m_pPhysics->createShape(physx::PxSphereGeometry(halfExtent), *pMaterial);
|
||||||
// physx::PxU32 size = 100;
|
// physx::PxU32 size = 30;
|
||||||
// physx::PxTransform pxTransform(physx::PxVec3(0));
|
// physx::PxTransform pxTransform(physx::PxVec3(0));
|
||||||
|
|
||||||
// for (physx::PxU32 i = 0; i < size; i++) {
|
// for (physx::PxU32 i = 0; i < size; i++) {
|
||||||
@@ -331,6 +451,9 @@ HRESULT CPhysX_Manager::Initialize()
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
#endif // 기무리
|
||||||
|
pMaterial->release();
|
||||||
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@@ -381,6 +504,10 @@ void CPhysX_Manager::Free()
|
|||||||
if (nullptr != m_pCookingParam) {
|
if (nullptr != m_pCookingParam) {
|
||||||
Safe_Delete(m_pCookingParam);
|
Safe_Delete(m_pCookingParam);
|
||||||
}
|
}
|
||||||
|
if (nullptr != m_pCCTManager) {
|
||||||
|
m_pCCTManager->release();
|
||||||
|
m_pCCTManager = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (nullptr != m_pScene) {
|
if (nullptr != m_pScene) {
|
||||||
m_pScene->release(); m_pScene = nullptr;
|
m_pScene->release(); m_pScene = nullptr;
|
||||||
@@ -395,6 +522,7 @@ void CPhysX_Manager::Free()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != m_pPvd) {
|
if (nullptr != m_pPvd) {
|
||||||
|
m_pPvd->disconnect();
|
||||||
m_pPvd->release(); m_pPvd = nullptr;
|
m_pPvd->release(); m_pPvd = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ CRigidBody::CRigidBody(const CRigidBody& rhs):
|
|||||||
m_eActorType(rhs.m_eActorType),
|
m_eActorType(rhs.m_eActorType),
|
||||||
m_vhalfGeometryInfo(rhs.m_vhalfGeometryInfo),
|
m_vhalfGeometryInfo(rhs.m_vhalfGeometryInfo),
|
||||||
m_pShape(rhs.m_pShape),
|
m_pShape(rhs.m_pShape),
|
||||||
m_pMeshKey(rhs.m_pMeshKey),
|
m_wstrMeshKey(rhs.m_wstrMeshKey),
|
||||||
m_bExclusive(rhs.m_bExclusive),
|
m_bExclusive(rhs.m_bExclusive),
|
||||||
m_bKinematic(rhs.m_bKinematic)
|
m_bKinematic(rhs.m_bKinematic)
|
||||||
{
|
{
|
||||||
@@ -44,9 +44,8 @@ HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
|
|||||||
break;
|
break;
|
||||||
case ACTOR::TRIANGLEMESH:
|
case ACTOR::TRIANGLEMESH:
|
||||||
{
|
{
|
||||||
m_pGameInstance->Create_TriangleMesh(Desc.tRigidStaticDesc.pMeshKey, Desc.tRigidStaticDesc.pMesh);
|
|
||||||
m_pMaterial = m_pGameInstance->Get_Material(Desc.tRigidDynamicDesc.vMatInfo);
|
m_pMaterial = m_pGameInstance->Get_Material(Desc.tRigidDynamicDesc.vMatInfo);
|
||||||
m_pMeshKey = Desc.tRigidStaticDesc.pMeshKey;
|
m_wstrMeshKey = CMyTools::ToWstring(Desc.tRigidStaticDesc.szMeshName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTOR::HEIGHTFIELD:
|
case ACTOR::HEIGHTFIELD:
|
||||||
@@ -54,6 +53,7 @@ HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return S_OK;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -306,13 +306,13 @@ void CTransform::Free()
|
|||||||
|
|
||||||
void CTransform::Describe_Entity()
|
void CTransform::Describe_Entity()
|
||||||
{
|
{
|
||||||
//if (GUI::TreeNode("Transform")) {
|
if (GUI::TreeNode("Transform")) {
|
||||||
// GUI::DragFloat4("Right", (_float*)(&m_WorldMatrix._11), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
GUI::DragFloat4("Right", (_float*)(&m_WorldMatrix._11), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
||||||
// GUI::DragFloat4("Up", (_float*)(&m_WorldMatrix._21), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
GUI::DragFloat4("Up", (_float*)(&m_WorldMatrix._21), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
||||||
// GUI::DragFloat4("Look", (_float*)(&m_WorldMatrix._31), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
GUI::DragFloat4("Look", (_float*)(&m_WorldMatrix._31), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
||||||
// GUI::DragFloat4("Pos", (_float*)(&m_WorldMatrix._41), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
GUI::DragFloat4("Pos", (_float*)(&m_WorldMatrix._41), 1.f, 0.f, 0.f, "%.3f", ImGuiSliderFlags_NoInput);
|
||||||
|
|
||||||
// GUI::TreePop();
|
GUI::TreePop();
|
||||||
// GUI::Spacing();
|
GUI::Spacing();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ENGINE_DLL CBase abstract
|
|||||||
_uint AddRef();
|
_uint AddRef();
|
||||||
_uint Release();
|
_uint Release();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
_uint m_iRefCnt = {};
|
_uint m_iRefCnt = {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,27 +1,81 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Base.h"
|
#include "Component.h"
|
||||||
|
|
||||||
NS_BEGIN(Engine)
|
NS_BEGIN(Engine)
|
||||||
|
class CTransform;
|
||||||
class CCharacter_Controller final : public CBase
|
class ENGINE_DLL CCharacter_Controller final :
|
||||||
|
public CComponent
|
||||||
{
|
{
|
||||||
|
/* dev-treadmill.tistory.com/158 */
|
||||||
|
/* dev-treadmill.tistory.com/159 */
|
||||||
|
public:
|
||||||
|
#pragma region STRUCT
|
||||||
|
struct CapsuleInfo
|
||||||
|
{
|
||||||
|
_float fRadius;
|
||||||
|
_float fHeight;
|
||||||
|
PSX::PxCapsuleClimbingMode::Enum eClimbingMode; // 기본 (eEASY, stepOffset 값이 무제한), (eCONSTRAINED, stepOffset 값이 제대로 먹음)
|
||||||
|
};
|
||||||
|
typedef struct tagCharacter_ControllerDesc
|
||||||
|
{
|
||||||
|
CTransform* pTransform = { nullptr };
|
||||||
|
ACTOR eBodyType = { ACTOR::END };
|
||||||
|
_float fContactOffset = { 0.f };
|
||||||
|
_float3 fMaterial = { 0.5f, 0.5f, 0.6f };
|
||||||
|
_bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
|
||||||
|
_float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
|
||||||
|
|
||||||
|
function<void()> funcHitCallback = { nullptr };
|
||||||
|
function<void()> funcBehaviorCallback = { nullptr };
|
||||||
|
|
||||||
|
// 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨
|
||||||
|
// _float fSlopeLimit = { 코사인각도 };
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
_float3 vBoxSize; // 박스는 AABB임
|
||||||
|
CapsuleInfo tCapsuleInfo;
|
||||||
|
};
|
||||||
|
}Character_Controller_DESC;
|
||||||
|
#pragma endregion
|
||||||
private:
|
private:
|
||||||
CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||||
|
CCharacter_Controller(const CCharacter_Controller& rhs);
|
||||||
virtual ~CCharacter_Controller() = default;
|
virtual ~CCharacter_Controller() = default;
|
||||||
|
public:
|
||||||
|
_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); // 순간이동
|
||||||
|
_float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 더 아래에 위치한다는 뜻 )
|
||||||
|
|
||||||
|
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||||
|
void Modify_Volume(_float3 fVolume);
|
||||||
|
_float3 Get_Volume();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CGameInstance* m_pGameInstance = { nullptr };
|
ACTOR m_eBodyType = { ACTOR::END };
|
||||||
ID3D11Device* m_pDevice = { nullptr };
|
PSX::PxController* m_pController = { nullptr };
|
||||||
ID3D11DeviceContext* m_pContext = { nullptr };
|
CTransform* m_pTransform = { nullptr };
|
||||||
|
_bool m_bAutoStepping = { false };
|
||||||
|
_float m_fSlopeLimit = { 0.f }; // cosf
|
||||||
|
|
||||||
PSX::PxScene* m_pScene = { nullptr };
|
|
||||||
|
function<void()> m_funcHitCallback = { nullptr };
|
||||||
|
function<void()> m_funcBehaviorCallback = { nullptr };
|
||||||
|
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};;
|
||||||
private:
|
private:
|
||||||
HRESULT Initialize(PSX::PxScene* pScene);
|
virtual HRESULT Initialize_Prototype() override;
|
||||||
|
virtual HRESULT Initialize(void* pArg) override;
|
||||||
|
|
||||||
|
_bool Check_Overlap();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CCharacter_Controller* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, PSX::PxScene* pScene);
|
static CCharacter_Controller* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||||
|
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||||
virtual void Free() override;
|
virtual void Free() override;
|
||||||
|
virtual void Describe_Entity() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_END
|
NS_END
|
||||||
@@ -69,4 +69,12 @@ enum aiTextureType {
|
|||||||
};
|
};
|
||||||
#endif // !EDITOR_PROJECT
|
#endif // !EDITOR_PROJECT
|
||||||
|
|
||||||
|
enum class PHYSX_KIND {
|
||||||
|
NOT_DEFINED = 0,
|
||||||
|
CCTActor = 1,
|
||||||
|
OBSTACLEActor = 2,
|
||||||
|
BODY_STATIC = 3,
|
||||||
|
BODY_DYNAMIC = 4,
|
||||||
|
};
|
||||||
|
|
||||||
NS_END
|
NS_END
|
||||||
@@ -47,4 +47,17 @@ unsigned long Safe_Release(T& pInstance)
|
|||||||
return dwRefCnt;
|
return dwRefCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GUIHelpMarker(const char* desc)
|
||||||
|
{
|
||||||
|
GUI::SameLine();
|
||||||
|
GUI::TextDisabled("(?)");
|
||||||
|
if (GUI::BeginItemTooltip())
|
||||||
|
{
|
||||||
|
GUI::PushTextWrapPos(GUI::GetFontSize() * 35.0f);
|
||||||
|
GUI::TextUnformatted((_string("u8") + desc).c_str());
|
||||||
|
GUI::PopTextWrapPos();
|
||||||
|
GUI::EndTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_END
|
NS_END
|
||||||
@@ -91,6 +91,7 @@ constexpr unsigned int g_iMaxShadowHeight = 9216;
|
|||||||
#endif // !AI_TEXTURE_TYPE_MAX
|
#endif // !AI_TEXTURE_TYPE_MAX
|
||||||
|
|
||||||
#define ENUM_CLASS(ENUM) static_cast<unsigned int>(ENUM)
|
#define ENUM_CLASS(ENUM) static_cast<unsigned int>(ENUM)
|
||||||
|
#define KR_CSTR(str) reinterpret_cast<const char*>(u8##str)
|
||||||
|
|
||||||
#ifndef MSG_BOX
|
#ifndef MSG_BOX
|
||||||
#define MSG_BOX(_message) MessageBox(NULL, TEXT(_message), L"System Message", MB_OK)
|
#define MSG_BOX(_message) MessageBox(NULL, TEXT(_message), L"System Message", MB_OK)
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ NS_BEGIN(Engine)
|
|||||||
|
|
||||||
typedef struct tagEngineDesc
|
typedef struct tagEngineDesc
|
||||||
{
|
{
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance = {};
|
||||||
HWND hWnd;
|
HWND hWnd = {};
|
||||||
_uint iNumLevels;
|
_uint iNumLevels = {};
|
||||||
_uint iNumCollidableGroup;
|
_uint iNumCollidableGroup = {};
|
||||||
_uint iStaticLevel;
|
_uint iStaticLevel = {};
|
||||||
_uint iWinSizeX, iWinSizeY;
|
_uint iWinSizeX, iWinSizeY = {};
|
||||||
}ENGINE_DESC;
|
}ENGINE_DESC;
|
||||||
|
|
||||||
typedef struct tagModelDesc {
|
typedef struct tagModelDesc {
|
||||||
@@ -24,157 +24,159 @@ typedef struct tagModelDesc {
|
|||||||
|
|
||||||
typedef struct tagKeyFrame
|
typedef struct tagKeyFrame
|
||||||
{
|
{
|
||||||
XMFLOAT3 vScale;
|
XMFLOAT3 vScale = {};
|
||||||
XMFLOAT4 vRotation;
|
XMFLOAT4 vRotation = {};
|
||||||
XMFLOAT3 vTranslation;
|
XMFLOAT3 vTranslation = {};
|
||||||
float fTrackPosition;
|
_float fTrackPosition = {};
|
||||||
|
|
||||||
}KEYFRAME;
|
}KEYFRAME;
|
||||||
|
|
||||||
struct LERPDESC {
|
struct LERPDESC {
|
||||||
_int iSlot;
|
_int iSlot = {};
|
||||||
tagKeyFrame tagKeyFrame;
|
tagKeyFrame tagKeyFrame = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct tagLightDesc
|
typedef struct tagLightDesc
|
||||||
{
|
{
|
||||||
LIGHT eType;
|
LIGHT eType = {};
|
||||||
_float4 vDiffuse;
|
_float4 vDiffuse = {};
|
||||||
_float4 vAmbient;
|
_float4 vAmbient = {};
|
||||||
_float4 vSpecular;
|
_float4 vSpecular = {};
|
||||||
|
|
||||||
_float4 vDirection;
|
_float4 vDirection = {};
|
||||||
_float4 vPosition;
|
_float4 vPosition = {};
|
||||||
_float fRange;
|
_float fRange = {};
|
||||||
_float2 vSpotAngles;
|
_float2 vSpotAngles = {};
|
||||||
}LIGHT_DESC;
|
}LIGHT_DESC;
|
||||||
|
|
||||||
typedef struct tagShadowLight
|
typedef struct tagShadowLight
|
||||||
{
|
{
|
||||||
_float4 vEye, vAt;
|
_float4 vEye{}, vAt{};
|
||||||
_float fWidth, fHeight, fNear, fFar;
|
_float fWidth{}, fHeight{}, fNear{}, fFar{};
|
||||||
}SHADOW_LIGHT_DESC;
|
}SHADOW_LIGHT_DESC;
|
||||||
|
|
||||||
struct SaveVertex
|
typedef struct tagSaveVertex
|
||||||
{
|
{
|
||||||
XMFLOAT3 Pos;
|
XMFLOAT3 Pos = {};
|
||||||
XMFLOAT3 Normal;
|
XMFLOAT3 Normal = {};
|
||||||
XMFLOAT3 Tan;
|
XMFLOAT3 Tan = {};
|
||||||
XMFLOAT3 BiNoraml;
|
XMFLOAT3 BiNoraml = {};
|
||||||
XMFLOAT2 UV;
|
XMFLOAT2 UV = {};
|
||||||
|
|
||||||
bool bHasNormal;
|
_bool bHasNormal = {};
|
||||||
bool bHasTan;
|
_bool bHasTan = {};
|
||||||
bool bHasUV;
|
_bool bHasUV = {};
|
||||||
|
|
||||||
XMUINT4 BlendIndex;
|
XMUINT4 BlendIndex = {};
|
||||||
XMFLOAT4 BlendWeight;
|
XMFLOAT4 BlendWeight = {};
|
||||||
};
|
}SaveVertex;
|
||||||
|
|
||||||
struct SaveBoneWeight
|
typedef struct tagSaveBoneWeight
|
||||||
{
|
{
|
||||||
unsigned int VertexId;
|
_uint VertexId = {};
|
||||||
float Weight;
|
_float Weight = {};
|
||||||
};
|
}SaveBoneWeight;
|
||||||
|
|
||||||
struct SaveBone
|
typedef struct tagSaveBone
|
||||||
{
|
{
|
||||||
char Name[64];
|
_char Name[64] = {};
|
||||||
XMFLOAT4X4 OffsetMatrix;
|
XMFLOAT4X4 OffsetMatrix = {};
|
||||||
int BoneIndex;
|
_int BoneIndex = {};
|
||||||
unsigned int WeightsCount;
|
_uint WeightsCount = {};
|
||||||
vector<SaveBoneWeight>Weights;
|
vector<SaveBoneWeight>Weights = {};
|
||||||
};
|
}SaveBone;
|
||||||
|
|
||||||
struct SaveNode
|
typedef struct tagSaveNode
|
||||||
{
|
{
|
||||||
char Name[64];
|
_char Name[64] = {};
|
||||||
int ParentIndex;
|
_int ParentIndex = {};
|
||||||
unsigned int ChildrenCount;
|
_uint ChildrenCount = {};
|
||||||
XMFLOAT4X4 Transformation;
|
XMFLOAT4X4 Transformation = {};
|
||||||
vector<int> ChildrenIndices;
|
vector<_int> ChildrenIndices = {};
|
||||||
};
|
}SaveNode;
|
||||||
|
|
||||||
struct SaveMesh
|
typedef struct tagSaveMesh
|
||||||
{
|
{
|
||||||
char Name[64];
|
_char Name[64] = {};
|
||||||
unsigned int VertexCount;
|
_uint VertexCount = {};
|
||||||
unsigned int IndexCount;
|
_uint IndexCount = {};
|
||||||
unsigned int MaterialIndex;
|
_uint MaterialIndex = {};
|
||||||
unsigned int BoneCount;
|
_uint BoneCount = {};
|
||||||
|
|
||||||
vector<SaveVertex> Vertices;
|
vector<SaveVertex> Vertices = {};
|
||||||
vector<unsigned int> Indices;
|
vector<_uint> Indices = {};
|
||||||
|
|
||||||
vector<SaveBone> Bones;
|
vector<SaveBone> Bones = {};
|
||||||
};
|
}SaveMesh;
|
||||||
|
|
||||||
struct SaveMaterial
|
typedef struct tagSaveMaterial
|
||||||
{
|
{
|
||||||
vector<string> Path[27];
|
vector<string> Path[27] = {};
|
||||||
|
|
||||||
};
|
}SaveMaterial;
|
||||||
|
|
||||||
struct SaveKeyFrameVec
|
typedef struct tagSaveKeyFrameVec
|
||||||
{
|
{
|
||||||
float Time;
|
_float Time = {};
|
||||||
XMFLOAT3 Value;
|
XMFLOAT3 Value = {};
|
||||||
};
|
}SaveKeyFrameVec;
|
||||||
|
|
||||||
struct SaveKeyFrameRotation
|
typedef struct tagSaveKeyFrameRotation
|
||||||
{
|
{
|
||||||
float Time;
|
_float Time = {};
|
||||||
XMFLOAT4 Value;
|
XMFLOAT4 Value = {};
|
||||||
};
|
}SaveKeyFrameRotation;
|
||||||
|
|
||||||
struct SaveChannel
|
typedef struct tagSaveChannel
|
||||||
{
|
{
|
||||||
char Name[64] = { };
|
_char Name[64] = { };
|
||||||
unsigned int ScalingKeyCount = { };
|
_uint ScalingKeyCount = { };
|
||||||
unsigned int RotationKeyCount = { };
|
_uint RotationKeyCount = { };
|
||||||
unsigned int PositionKeyCount = { };
|
_uint PositionKeyCount = { };
|
||||||
|
|
||||||
vector<SaveKeyFrameVec> ScalingKeys;
|
vector<SaveKeyFrameVec> ScalingKeys = {};
|
||||||
vector<SaveKeyFrameRotation> RotationKeys;
|
vector<SaveKeyFrameRotation> RotationKeys = {};
|
||||||
vector<SaveKeyFrameVec> PositionKeys;
|
vector<SaveKeyFrameVec> PositionKeys = {};
|
||||||
};
|
}SaveChannel;
|
||||||
|
|
||||||
struct SaveAnimation
|
typedef struct tagSaveAnimation
|
||||||
{
|
{
|
||||||
char Name[128];
|
_char Name[128] = {};
|
||||||
float mDuration;
|
_float mDuration = {};
|
||||||
float mTicksPerSecond;
|
_float mTicksPerSecond = {};
|
||||||
unsigned int ChannelCount;
|
_uint ChannelCount = {};
|
||||||
vector<SaveChannel> Channels;
|
vector<SaveChannel> Channels = {};
|
||||||
};
|
}SaveAnimation;
|
||||||
|
|
||||||
struct SaveModel
|
typedef struct tagSaveModel
|
||||||
{
|
{
|
||||||
unsigned int MeshCount;
|
_uint MeshCount = {};
|
||||||
unsigned int MaterialCount;
|
_uint MaterialCount = {};
|
||||||
unsigned int AnimationCount;
|
_uint AnimationCount = {};
|
||||||
unsigned int NodeCount;
|
_uint NodeCount = {};
|
||||||
vector<SaveMesh> Meshes;
|
vector<SaveMesh> Meshes = {};
|
||||||
vector<SaveMaterial> Materials;
|
vector<SaveMaterial> Materials = {};
|
||||||
vector<SaveAnimation> Animations;
|
vector<SaveAnimation> Animations = {};
|
||||||
vector<SaveNode>Nodes;
|
vector<SaveNode>Nodes = {};
|
||||||
};
|
}SaveModel;
|
||||||
|
|
||||||
|
#pragma region VTX
|
||||||
|
|
||||||
typedef struct tagVertexInstance_Particle
|
typedef struct tagVertexInstance_Particle
|
||||||
{
|
{
|
||||||
_float4 vRight;
|
_float4 vRight = {};
|
||||||
_float4 vUp;
|
_float4 vUp = {};
|
||||||
_float4 vLook;
|
_float4 vLook = {};
|
||||||
_float4 vTranslation;
|
_float4 vTranslation = {};
|
||||||
|
|
||||||
_float2 vLifeTime;
|
_float2 vLifeTime = {};
|
||||||
}VTX_INSTANCE_PARTICLE;
|
}VTX_INSTANCE_PARTICLE;
|
||||||
|
|
||||||
typedef struct tagVertexBlock
|
typedef struct tagVertexBlock
|
||||||
{
|
{
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
_float3 vNormal;
|
_float3 vNormal = {};
|
||||||
_float3 vTexcoord;
|
_float3 vTexcoord = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 3 };
|
static constexpr _uint iNumElements = { 3 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -186,7 +188,7 @@ typedef struct tagVertexBlock
|
|||||||
}VTXBLOCK;
|
}VTXBLOCK;
|
||||||
|
|
||||||
typedef struct tagVertexPosition {
|
typedef struct tagVertexPosition {
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 1 };
|
static constexpr _uint iNumElements = { 1 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -196,8 +198,8 @@ typedef struct tagVertexPosition {
|
|||||||
}VTXPOS;
|
}VTXPOS;
|
||||||
|
|
||||||
typedef struct tagVertexPositionTexcoord {
|
typedef struct tagVertexPositionTexcoord {
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
_float2 vTexcoord;
|
_float2 vTexcoord = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 2 };
|
static constexpr _uint iNumElements = { 2 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -208,9 +210,9 @@ typedef struct tagVertexPositionTexcoord {
|
|||||||
}VTXPOSTEX;
|
}VTXPOSTEX;
|
||||||
|
|
||||||
typedef struct tagVertexPositionNormalTexcoord {
|
typedef struct tagVertexPositionNormalTexcoord {
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
_float3 vNormal;
|
_float3 vNormal = {};
|
||||||
_float2 vTexcoord;
|
_float2 vTexcoord = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 3 };
|
static constexpr _uint iNumElements = { 3 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -223,11 +225,11 @@ typedef struct tagVertexPositionNormalTexcoord {
|
|||||||
|
|
||||||
typedef struct tagVertexMesh
|
typedef struct tagVertexMesh
|
||||||
{
|
{
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
_float3 vNormal;
|
_float3 vNormal = {};
|
||||||
_float3 vTangent;
|
_float3 vTangent = {};
|
||||||
_float3 vBinormal;
|
_float3 vBinormal = {};
|
||||||
_float2 vTexcoord;
|
_float2 vTexcoord = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 5 };
|
static constexpr _uint iNumElements = { 5 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -241,14 +243,14 @@ typedef struct tagVertexMesh
|
|||||||
|
|
||||||
typedef struct tagVertexAnimationMesh
|
typedef struct tagVertexAnimationMesh
|
||||||
{
|
{
|
||||||
_float3 vPosition;
|
_float3 vPosition = {};
|
||||||
_float3 vNormal;
|
_float3 vNormal = {};
|
||||||
_float3 vTangent;
|
_float3 vTangent = {};
|
||||||
_float3 vBinormal;
|
_float3 vBinormal = {};
|
||||||
_float2 vTexcoord;
|
_float2 vTexcoord = {};
|
||||||
|
|
||||||
XMUINT4 vBlendIndex;
|
XMUINT4 vBlendIndex = {};
|
||||||
_float4 vBlendWeight;
|
_float4 vBlendWeight = {};
|
||||||
|
|
||||||
static constexpr _uint iNumElements = { 7 };
|
static constexpr _uint iNumElements = { 7 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
@@ -264,7 +266,7 @@ typedef struct tagVertexAnimationMesh
|
|||||||
|
|
||||||
typedef struct tagVertexPosInstanceParticleDesc
|
typedef struct tagVertexPosInstanceParticleDesc
|
||||||
{
|
{
|
||||||
static constexpr unsigned int iNumElements = { 6 };
|
static constexpr _uint iNumElements = { 6 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
|
|
||||||
@@ -279,7 +281,7 @@ typedef struct tagVertexPosInstanceParticleDesc
|
|||||||
|
|
||||||
typedef struct tagVertexModelInstanceParticleDesc
|
typedef struct tagVertexModelInstanceParticleDesc
|
||||||
{
|
{
|
||||||
static constexpr unsigned int iNumElements = { 10 };
|
static constexpr _uint iNumElements = { 10 };
|
||||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||||
{ "POSITION" , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{ "POSITION" , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
{ "NORMAL" , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{ "NORMAL" , 0 , DXGI_FORMAT_R32G32B32_FLOAT , 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
@@ -295,4 +297,18 @@ typedef struct tagVertexModelInstanceParticleDesc
|
|||||||
};
|
};
|
||||||
}VTX_MODEL_INSTANCE_PARTICLE;
|
}VTX_MODEL_INSTANCE_PARTICLE;
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tagPhsXUserData {
|
||||||
|
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||||
|
class CGameObject* pOwner = { nullptr };
|
||||||
|
_float4x4 m_BeforeMatrix = { };
|
||||||
|
union {
|
||||||
|
class CRigidBody* pBody;
|
||||||
|
class CCharacter_Controller* pCharacter;
|
||||||
|
class CObstacle_Controller* pObstacle = { nullptr };
|
||||||
|
};
|
||||||
|
}PhsXUserData;
|
||||||
|
|
||||||
NS_END
|
NS_END
|
||||||
@@ -178,10 +178,20 @@ class ENGINE_DLL CGameInstance final : public CBase
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
#pragma region PhysX_Manager
|
#pragma region PhysX_Manager
|
||||||
PSX::PxMaterial* Get_Material(_float3& vMatInfo);
|
PSX::PxMaterial* Get_Material(_float3& vMatInfo);
|
||||||
HRESULT Create_TriangleMesh(const _wstring& wstrMeshKey, CMesh* pMesh);
|
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);
|
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::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||||
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||||
|
|
||||||
|
|
||||||
|
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
|
||||||
|
PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc);
|
||||||
|
PSX::PxController* Get_Controller(_uint iControllerIndex);
|
||||||
|
void ReleaseController(_uint iControllerIndex);
|
||||||
|
|
||||||
|
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix);
|
||||||
|
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||||
|
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
|||||||
return m_iMaterialIndex;
|
return m_iMaterialIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _char* Get_Name() const { return m_szName; }
|
||||||
HRESULT Bind_BoneMatrices(const vector<class CBone*>& Bones, class CShader* pShader, const _char* pConstantName);
|
HRESULT Bind_BoneMatrices(const vector<class CBone*>& Bones, class CShader* pShader, const _char* pConstantName);
|
||||||
HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName);
|
HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName);
|
||||||
HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||||
@@ -27,7 +28,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
|||||||
public:
|
public:
|
||||||
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
||||||
HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
|
HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
|
||||||
PSX::PxTriangleMesh* ConvertToPxMesh(const PSX::PxCookingParams* pParam);
|
PSX::PxTriangleMesh* ConvertToPxMesh(const PSX::PxCookingParams* pParam, PSX::PxPhysics* pPhysX, _fmatrix WorldMatrix);
|
||||||
#endif // EDITOR_PROJECT
|
#endif // EDITOR_PROJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class ENGINE_DLL CModel final : public CComponent
|
|||||||
_int Get_RootBoneIndex() const { return m_iRootBoneIndex; }
|
_int Get_RootBoneIndex() const { return m_iRootBoneIndex; }
|
||||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||||
|
const _char* Get_MeshName(_uint iIndex);
|
||||||
MODEL Get_Type() const { return m_eType; }
|
MODEL Get_Type() const { return m_eType; }
|
||||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||||
|
|
||||||
@@ -56,16 +57,16 @@ class ENGINE_DLL CModel final : public CComponent
|
|||||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||||
|
|
||||||
#ifdef EDITOR_PROJECT
|
#ifdef EDITOR_PROJECT
|
||||||
HRESULT Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
|
||||||
static CModel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
|
||||||
HRESULT Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
HRESULT Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex);
|
||||||
HRESULT Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& PreTransformMatrix);
|
HRESULT Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fmatrix& PreTransformMatrix);
|
||||||
|
HRESULT Ready_PhysXMeshes();
|
||||||
|
HRESULT Save_PhysXTriMeshes(const _char* pModelFilePath);
|
||||||
HRESULT Ready_Materials(const aiScene* pAIScene, const _char* pModelFilePath);
|
HRESULT Ready_Materials(const aiScene* pAIScene, const _char* pModelFilePath);
|
||||||
HRESULT Ready_Materials_FromFile(const aiScene* pAIScene, const _char* pModelFilePath);
|
HRESULT Ready_Materials_FromFile(const aiScene* pAIScene, const _char* pModelFilePath);
|
||||||
HRESULT Ready_Animations(const aiScene* pAIScene);
|
HRESULT Ready_Animations(const aiScene* pAIScene);
|
||||||
HRESULT Ready_Bones(const aiNode* pAINode, _int iParentIndex);
|
HRESULT Ready_Bones(const aiNode* pAINode, _int iParentIndex);
|
||||||
// 바이너리
|
// 바이너리
|
||||||
bool SaveAssimpModel(const _char* filename);
|
_bool SaveAssimpModel(const _char* filename);
|
||||||
_int SaveNodeRecursive(const aiNode* pAINode, std::vector<SaveNode>& outNodes, _int parentIndex);
|
_int SaveNodeRecursive(const aiNode* pAINode, std::vector<SaveNode>& outNodes, _int parentIndex);
|
||||||
//
|
//
|
||||||
#endif // EDITOR_PROJECT
|
#endif // EDITOR_PROJECT
|
||||||
@@ -83,6 +84,8 @@ class ENGINE_DLL CModel final : public CComponent
|
|||||||
|
|
||||||
_uint m_iNumMeshes = {}; // 메쉬의 갯수
|
_uint m_iNumMeshes = {}; // 메쉬의 갯수
|
||||||
vector<class CMesh*> m_Meshes; // 메쉬의 벡터
|
vector<class CMesh*> m_Meshes; // 메쉬의 벡터
|
||||||
|
_uint m_iNumPhysXMeshes = {}; // 피직스 메쉬의 갯수
|
||||||
|
vector<PSX::PxTriangleMesh*> m_TriMeshes = {}; // 피직스 메쉬의 갯수
|
||||||
|
|
||||||
_uint m_iNumMaterials = {}; // 머테리얼의 갯수
|
_uint m_iNumMaterials = {}; // 머테리얼의 갯수
|
||||||
vector<class CMaterial*> m_Materials; // 머테리얼의 벡터
|
vector<class CMaterial*> m_Materials; // 머테리얼의 벡터
|
||||||
@@ -111,7 +114,6 @@ class ENGINE_DLL CModel final : public CComponent
|
|||||||
//
|
//
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual HRESULT Initialize_Prototype() override;
|
|
||||||
// 바이너리
|
// 바이너리
|
||||||
virtual HRESULT Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix);
|
virtual HRESULT Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix);
|
||||||
bool LoadData(const _char* filename);
|
bool LoadData(const _char* filename);
|
||||||
@@ -127,7 +129,6 @@ class ENGINE_DLL CModel final : public CComponent
|
|||||||
//
|
//
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CModel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
|
||||||
// 바이너리
|
// 바이너리
|
||||||
static CModel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix = XMMatrixIdentity());
|
static CModel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix = XMMatrixIdentity());
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -23,10 +23,14 @@ class CPhysX_Manager final : public CBase
|
|||||||
const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||||
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||||
|
|
||||||
|
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||||
PSX::PxMaterial* Get_Material(_float3& vMatInfo);
|
PSX::PxMaterial* Get_Material(_float3& vMatInfo);
|
||||||
PSX::PxShape* Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag);
|
PSX::PxShape* Create_Shape(ACTOR eType, _float3& vhalfGeometryInfo, PSX::PxMaterial& pxMaterial, _bool bExclusive, PSX::PxShapeFlags ePxShapeFlag);
|
||||||
|
|
||||||
HRESULT Create_TriangleMesh(const _wstring& wstrMeshKey, CMesh* pMesh);
|
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix);
|
||||||
|
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||||
|
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||||
|
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||||
PSX::PxTriangleMesh* Find_TriangleMesh(const _wstring& wstrMeshKey);
|
PSX::PxTriangleMesh* Find_TriangleMesh(const _wstring& wstrMeshKey);
|
||||||
|
|
||||||
void Update(_float fTimeDelta);
|
void Update(_float fTimeDelta);
|
||||||
@@ -35,7 +39,7 @@ class CPhysX_Manager final : public CBase
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region CHARACTER_CONTROLLER
|
#pragma region CHARACTER_CONTROLLER
|
||||||
/* https://dev-treadmill.tistory.com/158 */
|
/* dev-treadmill.tistory.com/158 */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
|
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
|
#include "Character_Controller.h"
|
||||||
#include "Instance_Model.h"
|
#include "Instance_Model.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
|||||||
typedef struct tagRigidStatic_PrototypeDesc
|
typedef struct tagRigidStatic_PrototypeDesc
|
||||||
{
|
{
|
||||||
_float3 vMatInfo;
|
_float3 vMatInfo;
|
||||||
const _tchar* pMeshKey = { nullptr };
|
const _char* szMeshName = { } ;
|
||||||
CMesh* pMesh = { nullptr };
|
|
||||||
}RIGID_STATIC_PROTOTYPEDESC;
|
}RIGID_STATIC_PROTOTYPEDESC;
|
||||||
typedef struct tagRigidDynamic_PrototypeDesc
|
typedef struct tagRigidDynamic_PrototypeDesc
|
||||||
{
|
{
|
||||||
@@ -37,7 +36,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
|||||||
};
|
};
|
||||||
}RIGIDBODY_PROTOTYPEDESC;
|
}RIGIDBODY_PROTOTYPEDESC;
|
||||||
typedef struct tagRigidStatic_Desc {
|
typedef struct tagRigidStatic_Desc {
|
||||||
const _tchar* pMeshKey = { nullptr };
|
const _char* szMeshName = { };
|
||||||
}RIGID_STATIC_DESC;
|
}RIGID_STATIC_DESC;
|
||||||
typedef struct tagRigidDynamic_Desc {
|
typedef struct tagRigidDynamic_Desc {
|
||||||
_float fDensity = { 1000.f };
|
_float fDensity = { 1000.f };
|
||||||
@@ -68,7 +67,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
|||||||
public:
|
public:
|
||||||
PSX::PxShape* Get_ShapePtr() const { return m_pShape; }
|
PSX::PxShape* Get_ShapePtr() const { return m_pShape; }
|
||||||
CTransform* Get_PxTransformPtr() const { return m_pTransform; }
|
CTransform* Get_PxTransformPtr() const { return m_pTransform; }
|
||||||
const _tchar* Get_PxMeshKey() const { return m_pMeshKey; }
|
const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
|
||||||
const PSX::PxMaterial* Get_PxMaterial() const { return m_pMaterial; }
|
const PSX::PxMaterial* Get_PxMaterial() const { return m_pMaterial; }
|
||||||
|
|
||||||
_float Get_Density() const { return m_fDensity; }
|
_float Get_Density() const { return m_fDensity; }
|
||||||
@@ -84,7 +83,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
|||||||
_bool m_bKinematic = { false };
|
_bool m_bKinematic = { false };
|
||||||
_bool m_bExclusive = { false };
|
_bool m_bExclusive = { false };
|
||||||
_float m_fDensity = { 1000.f };
|
_float m_fDensity = { 1000.f };
|
||||||
const _tchar* m_pMeshKey = { nullptr };
|
_wstring m_wstrMeshKey = { };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
|
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
|
||||||
|
|||||||
Reference in New Issue
Block a user