[add] InstanceProp RigidBody_Static 추가

[add] VIBuffer_Model_Instance 피직스 함수, 변수 추가
This commit is contained in:
Chanbin Kim
2026-01-04 18:15:30 +09:00
parent 4acc5751cf
commit 079d91aa78
29 changed files with 482 additions and 128 deletions
+26
View File
@@ -196,6 +196,32 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
g_hWnd = hWnd;
#ifndef _DEBUG
//int screenX = GetSystemMetrics(SM_CXSCREEN);
//int screenY = GetSystemMetrics(SM_CYSCREEN);
//HWND hWnd = CreateWindowW(
// szWindowClass,
// szTitle,
// WS_POPUP,
// 0, 0,
// screenX, screenY,
// nullptr,
// nullptr,
// hInstance,
// nullptr
//);
//if (!hWnd)
// return FALSE;
//g_hWnd = hWnd;
//ShowWindow(hWnd, SW_SHOW);
//UpdateWindow(hWnd);
#endif // !_DEBUG
return TRUE;
}
@@ -89,9 +89,6 @@ HRESULT CInstancedProp::Initialize(void* pArg)
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh();
return S_OK;
}
@@ -107,8 +104,16 @@ HRESULT CInstancedProp::Ready_Components(void* pArg)
reinterpret_cast<CComponent**>(&m_pVIBufferInstanceCom))))
return E_FAIL;
m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh();
if(pDesc->bEnableRigidbody)
{
if (FAILED(ReadyForPhysX()))
return E_FAIL;
}
/* Laod Instance Data */
if(FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str())))
if(FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str(), pDesc)))
return E_FAIL;
m_isShake = pDesc->isShake;
@@ -143,7 +148,16 @@ HRESULT CInstancedProp::Bind_ShaderResources()
return S_OK;
}
HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath)
HRESULT CInstancedProp::ReadyForPhysX()
{
if (FAILED(m_pVIBufferInstanceCom->Ready_PhysXMeshes(NEXT_LEVEL))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath, INSTANCE_PROP_DESC* pDesc)
{
ifstream FileIn(pFilePath, ios::binary);
@@ -155,19 +169,52 @@ HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath)
vector<_float4x4> WorldMatrices = {};
_uint iNumWorldMatrix = 0;
m_iNumInstacne = 0;
FileIn.read(reinterpret_cast<char*>(&iNumWorldMatrix), sizeof(_uint));
WorldMatrices.reserve(iNumWorldMatrix);
FileIn.read(reinterpret_cast<char*>(&m_iNumInstacne), sizeof(_uint));
WorldMatrices.reserve(m_iNumInstacne);
m_RigidBody.reserve(m_iNumInstacne);
_float4x4 WorldMatrix = {};
for (_uint i = 0; i < iNumWorldMatrix; ++i)
#pragma region FOR RIGIDBODY
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
vector<_wstring> RigidBodyTags;
for (_uint i = 0; i < m_iNumMesh; ++i)
{
RigidBodyTags.push_back(CMyTools::ToWstring(m_pVIBufferInstanceCom->Get_MeshName(i)) + to_wstring(i));
}
#pragma endregion
for (_uint i = 0; i < m_iNumInstacne; ++i)
{
FileIn.read(reinterpret_cast<char*>(&WorldMatrix), sizeof(_float4x4));
WorldMatrices.push_back(WorldMatrix);
if(pDesc->bEnableRigidbody)
{
for (_uint i = 0; i < m_iNumMesh; ++i)
{
CRigidBody_Static* pRigidBody = { nullptr };
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {};
Desc.pMeshName = RigidBodyTags[i].c_str();
Desc.pWorldMatrix = &WorldMatrix;
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, RigidBodyTags[i], (CComponent**)&pRigidBody, &Desc))) {
return E_FAIL;
}
m_RigidBody.push_back(pRigidBody);
}
}
}
FileIn.close();
if (FAILED(m_pVIBufferInstanceCom->Load_WorldData(WorldMatrices)))
@@ -209,6 +256,11 @@ void CInstancedProp::Free()
{
__super::Free();
for (auto& pRigidBody : m_RigidBody)
{
SAFE_RELEASE(pRigidBody);
}
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pVIBufferInstanceCom);
}
@@ -111,16 +111,22 @@ HRESULT CInstancedProp_Light::Initialize(void* pArg)
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
m_bEnableRigidbody = pDesc->bEnableRigidbody;
m_iGlassMeshIndex = pDesc->iGlassMeshIndex;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
Load_InstancedProp(pDesc->strInstanceDataPath.c_str());
m_iNumMesh = m_pVIBufferInstanceCom->Get_NumMesh();
if(m_bEnableRigidbody)
{
if (FAILED(ReadyForPhysX()))
return E_FAIL;
}
if (FAILED(Load_InstancedProp(pDesc->strInstanceDataPath.c_str())))
return E_FAIL;
return S_OK;
}
@@ -133,7 +139,7 @@ HRESULT CInstancedProp_Light::Ready_Components(void* pArg)
INSTANCE_PROP_LIGHT_DESC* pDesc = static_cast<INSTANCE_PROP_LIGHT_DESC*>(pArg);
/* Com_VIBuffer_Instance_Model */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pDesc->strPrototypeTag,
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, pDesc->strPrototypeTag,
reinterpret_cast<CComponent**>(&m_pVIBufferInstanceCom))))
return E_FAIL;
@@ -180,6 +186,15 @@ HRESULT CInstancedProp_Light::Bind_ShaderResources()
return S_OK;
}
HRESULT CInstancedProp_Light::ReadyForPhysX()
{
if (FAILED(m_pVIBufferInstanceCom->Ready_PhysXMeshes(NEXT_LEVEL))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CInstancedProp_Light::Load_InstancedProp(const _char* pFilePath)
{
ifstream FileIn(pFilePath, ios::binary);
@@ -192,18 +207,47 @@ HRESULT CInstancedProp_Light::Load_InstancedProp(const _char* pFilePath)
vector<_float4x4> WorldMatrices = {};
_uint iNumWorldMatrix = 0;
#pragma region FOR RIGIDBODY
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
FileIn.read(reinterpret_cast<char*>(&iNumWorldMatrix), sizeof(_uint));
WorldMatrices.reserve(iNumWorldMatrix);
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
vector<_wstring> RigidBodyTags;
for (_uint i = 0; i < m_iNumMesh; ++i)
{
RigidBodyTags.push_back(CMyTools::ToWstring(m_pVIBufferInstanceCom->Get_MeshName(i)) + to_wstring(i));
}
#pragma endregion
FileIn.read(reinterpret_cast<char*>(&m_iNumInstacne), sizeof(_uint));
WorldMatrices.reserve(m_iNumInstacne);
_float4x4 WorldMatrix = {};
for (_uint i = 0; i < iNumWorldMatrix; ++i)
for (_uint i = 0; i < m_iNumInstacne; ++i)
{
FileIn.read(reinterpret_cast<char*>(&WorldMatrix), sizeof(_float4x4));
WorldMatrices.push_back(WorldMatrix);
if (m_bEnableRigidbody)
{
for (_uint i = 0; i < m_iNumMesh; ++i)
{
CRigidBody_Static* pRigidBody = { nullptr };
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {};
Desc.pMeshName = RigidBodyTags[i].c_str();
Desc.pWorldMatrix = &WorldMatrix;
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, RigidBodyTags[i], (CComponent**)&pRigidBody, &Desc))) {
return E_FAIL;
}
m_RigidBody.push_back(pRigidBody);
}
}
}
FileIn.close();
@@ -246,6 +290,11 @@ void CInstancedProp_Light::Free()
{
__super::Free();
for (auto& pRigidBody : m_RigidBody)
{
SAFE_RELEASE(pRigidBody);
}
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pVIBufferInstanceCom);
SAFE_RELEASE(m_pGlassTextureCom);
@@ -449,7 +449,8 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* InstanceProp Oak_Tree*/
Desc.isShake = true;
Desc.vRadius = _float2(0.015f, 0.04f);
Desc.bEnableRigidbody = true;
Desc.vRadius = _float2(0.015f, 0.02f);
Desc.vSpeed = _float2(0.3f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/OakTree_MedA.bin";
@@ -459,6 +460,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* BearBerry */
Desc.isShake = true;
Desc.bEnableRigidbody = false;
Desc.vRadius = _float2(0.015f, 0.02f);
Desc.vSpeed = _float2(0.6f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A";
@@ -469,6 +471,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* SM_HM_OwlPost_Window_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_OwlPost_Window_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/OwlPost_Window.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -476,6 +479,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
///* WA_Rectangle_Double_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Rectangle_Double_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Rectangle_Double_A.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -483,6 +487,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
///* WC_Retangle_Double_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Retangle_Double_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Retangle_Double_A.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -490,6 +495,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
///* WA_Square_Double_C */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WA_Square_Double_C";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WA_Square_Double_C.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -497,6 +503,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* Quid_Window_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Quid_Window_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Quid_Window_A.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -504,6 +511,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* Ollivanders_Box_Window */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Ollivanders_Box_Window";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Ollivanders_Box.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -511,6 +519,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* WC_L_DoubleS_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_L_DoubleS_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_L_DoubleS_A.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -518,6 +527,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* WC_Round_Double_A */
Desc.isShake = false;
Desc.bEnableRigidbody = false;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_WC_Round_Double_A";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/WC_Round_Double_A.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -525,6 +535,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* SM_HM_Door1a */
Desc.isShake = false;
Desc.bEnableRigidbody = true;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door1a.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -532,6 +543,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* SM_HM_Door2b */
Desc.isShake = false;
Desc.bEnableRigidbody = true;
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b";
Desc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Door2b.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp>(g_iStaticLevel, NEXT_LEVEL, LAYER_HOGSMEADE, &Desc)))
@@ -539,6 +551,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* OakTree_TallA */
Desc.isShake = false;
Desc.bEnableRigidbody = true;
Desc.vRadius = _float2(0.015f, 0.016f);
Desc.vSpeed = _float2(0.01f, 0.1f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA";
@@ -548,6 +561,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* Shrub_B */
Desc.isShake = true;
Desc.bEnableRigidbody = false;
Desc.vRadius = _float2(0.015f, 0.04f);
Desc.vSpeed = _float2(0.3f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Shrub_B";
@@ -557,6 +571,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* BogMyrtle_A */
Desc.isShake = true;
Desc.bEnableRigidbody = false;
Desc.vRadius = _float2(0.015f, 0.04f);
Desc.vSpeed = _float2(0.3f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_BogMyrtle_A";
@@ -566,6 +581,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* Dogwood_B */
Desc.isShake = true;
Desc.bEnableRigidbody = true;
Desc.vRadius = _float2(0.015f, 0.02f);
Desc.vSpeed = _float2(0.3f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B";
@@ -575,6 +591,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* ScotsPine_LargeA */
Desc.isShake = false;
Desc.bEnableRigidbody = true;
Desc.vRadius = _float2(0.015f, 0.02f);
Desc.vSpeed = _float2(0.3f, 1.f);
Desc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA";
@@ -587,6 +604,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* LightPost */
LightDesc.isShake = false;
LightDesc.bEnableRigidbody = true;
LightDesc.iGlassMeshIndex = 0;
LightDesc.vRadius = _float2(0.f, 0.f);
LightDesc.vSpeed = _float2(0.f, 0.f);
@@ -597,6 +615,7 @@ HRESULT CLevel_GamePlay::Ready_IntstanceProp()
/* LightPost_Floating */
LightDesc.isShake = false;
LightDesc.bEnableRigidbody = true;
LightDesc.iGlassMeshIndex = 1;
LightDesc.vRadius = _float2(0.f, 0.f);
LightDesc.vSpeed = _float2(0.f, 0.f);
+115 -33
View File
@@ -2861,12 +2861,21 @@ HRESULT CLoader::Loading_For_GamePlay()
}
#pragma region MAP_INSTANCE
_string strMaterailPath = "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml";
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin",
"../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_OakTree_MedA.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_BearBerry_A"),
@@ -2924,22 +2933,43 @@ HRESULT CLoader::Loading_For_GamePlay()
return E_FAIL;
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Door1a.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Door1a.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door1a"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Door2b.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Door2b.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_HM_Door2b"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_OakTree_TallA.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_OakTree_TallA.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_OakTree_TallA"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_Shrub_B*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Shrub_B"),
@@ -2954,28 +2984,56 @@ HRESULT CLoader::Loading_For_GamePlay()
return E_FAIL;
/* For.Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_Dogwood_B.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_Dogwood_B.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Dogwood_B"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA*/
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_ScotsPine_LargeA_Master.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_ScotsPine_LargeA_Master.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_ScotsPine_LargeA"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_LightPost */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_LightPost"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_LightPost.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_LightPost.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_LightPost"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
/* For.Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"),
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Light_Post_Floating.bin", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
return E_FAIL;
{
CVIBuffer_Model_Instance* pModel_Instance = CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
"../Bin/Resources/Models/InstanceProp/SM_HM_Light_Post_Floating.bin", strMaterailPath.c_str());
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, TEXT("Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating"),
pModel_Instance)))
return E_FAIL;
if (FAILED(Ready_RigidBody_Static(pModel_Instance)))
return E_FAIL;
}
#pragma endregion
/* For.Prototype_Component_South_Hogwart_Land_LOD1 */
@@ -3599,6 +3657,30 @@ void CLoader::Ready_MapModels(vector<future<vector<FOLDER_LOAD*>*>>& jobMapModel
}
HRESULT CLoader::Ready_RigidBody_Static(CVIBuffer_Model_Instance* pModel_Instance)
{
_uint iNumMesh = pModel_Instance->Get_NumMesh();
for (_uint i = 0; i < iNumMesh; ++i)
{
CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{}; //
{
Desc.eType = ACTOR::TRIANGLEMESH;
Desc.ePxRigidBodyFlags = {};
Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
Desc.ePxMaterialTypes = PXMATERIAL::DEFAULT;
Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
Desc.fContactOffset = 0.001f;
}
CRigidBody_Static* pRigid = CRigidBody_Static::Create(m_pDevice, m_pContext, Desc);
if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, CMyTools::ToWstring(pModel_Instance->Get_MeshName(i) + to_string(i)), pRigid))) {
return E_FAIL;
}
}
return S_OK;
}
CLoader* CLoader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eNextLevelID)
{
CLoader* pInstance = new CLoader(pDevice, pContext);
@@ -181,6 +181,7 @@ void CMapElement_Static::ConvertToPhysX()
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
Desc.pMeshName = wstrName.c_str();
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) {
assert(false);
}
@@ -188,6 +188,7 @@ void CMapObject_Collision::ConvertToPhysX()
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
Desc.pMeshName = wstrName.c_str();
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) {
assert(false);
}
@@ -187,6 +187,7 @@ void CMapObject_Render::ConvertToPhysX()
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc = {};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
Desc.pMeshName = wstrName.c_str();
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
if (FAILED(__super::Add_Asset_Component(NEXT_LEVEL, wstrName, (CComponent**)&pRigidBody, &Desc))) {
assert(false);
}
@@ -39,6 +39,7 @@ HRESULT CTerrain::Initialize(void* pArg)
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
Desc.pMeshName = pDesc->strRigidBody_MeshName.c_str();
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
/* Com_RigidBody */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pDesc->strRigidBody_ComponentTag,
reinterpret_cast<CComponent**>(&m_pRigidBody), &Desc))) {
+11 -6
View File
@@ -16,11 +16,12 @@ class CInstancedProp final : public CGameObject
public:
typedef struct tagInstancedPropDesc
{
_bool isShake;
_float2 vRadius;
_float2 vSpeed;
_wstring strPrototypeTag;
_string strInstanceDataPath;
_bool isShake;
_bool bEnableRigidbody;
_float2 vRadius;
_float2 vSpeed;
_wstring strPrototypeTag;
_string strInstanceDataPath;
}INSTANCE_PROP_DESC;
private:
CInstancedProp(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
@@ -37,7 +38,9 @@ class CInstancedProp final : public CGameObject
private:
_bool m_isShake = {};
_uint m_iNumMesh = {};
_uint m_iNumInstacne = {};
vector<CRigidBody_Static*> m_RigidBody = { nullptr };
CVIBuffer_Model_Instance* m_pVIBufferInstanceCom = { nullptr };
CShader* m_pShaderCom = { nullptr };
@@ -47,12 +50,14 @@ class CInstancedProp final : public CGameObject
virtual HRESULT Ready_Components(void* pArg) override;
virtual HRESULT Bind_ShaderResources() override;
HRESULT Load_InstancedProp(const _char* pFilePath);
HRESULT ReadyForPhysX();
HRESULT Load_InstancedProp(const _char* pFilePath, INSTANCE_PROP_DESC* pDesc);
public:
static CInstancedProp* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#endif // _DEBUG
@@ -17,12 +17,14 @@ class CInstancedProp_Light final : public CGameObject
typedef struct tagInstancedPropLightDesc
{
_bool isShake;
_bool bEnableRigidbody;
_uint iGlassMeshIndex{};
_float2 vRadius;
_float2 vSpeed;
_wstring strPrototypeTag;
_string strInstanceDataPath;
_string strInstanceDataPath;
}INSTANCE_PROP_LIGHT_DESC;
private:
CInstancedProp_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CInstancedProp_Light(const CInstancedProp_Light& rhs);
@@ -35,23 +37,25 @@ class CInstancedProp_Light final : public CGameObject
virtual HRESULT Render() override;
virtual HRESULT Render_Bloom() override;
private:
_bool m_bLightOn = { true };
_bool m_bEnableRigidbody = { };
_uint m_iNumMesh = {};
_uint m_iNumInstacne = {};
_uint m_iGlassMeshIndex = {};
_float m_fGlassRatio = { 0.5f };
_float m_fBloomStrength = { 15.f };
CVIBuffer_Model_Instance* m_pVIBufferInstanceCom = { nullptr };
CShader* m_pShaderCom = { nullptr };
CTexture* m_pGlassTextureCom = { nullptr };
CTexture* m_pMaskTextureCom = { nullptr };
CTexture* m_pEmissiveTextureCom = { nullptr };
_uint m_iNumMesh = {};
_uint m_iGlassMeshIndex = {};
_float m_fGlassRatio = { 0.5f };
_float m_fBloomStrength = { 15.f };
vector<CRigidBody_Static*> m_RigidBody = { nullptr };
private:
virtual HRESULT Initialize_Prototype() override;
@@ -59,12 +63,14 @@ class CInstancedProp_Light final : public CGameObject
virtual HRESULT Ready_Components(void* pArg) override;
virtual HRESULT Bind_ShaderResources() override;
HRESULT ReadyForPhysX();
HRESULT Load_InstancedProp(const _char* pFilePath);
public:
static CInstancedProp_Light* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#endif // _DEBUG
+2
View File
@@ -6,6 +6,7 @@
NS_BEGIN(Engine)
class CGameInstance;
class CModel;
class CVIBuffer_Model_Instance;
NS_END
NS_BEGIN(Client)
@@ -43,6 +44,7 @@ class CLoader final : public CBase
future<vector<FOLDER_LOAD*>*> Deferred_FolderLoad(const _char* pDirectoryPath, const _char* pFileExt, _bool bUseTag);
future<pair<_wstring, CModel*>*> Deferred_ModelLoad(MODEL eType, const _char* pDirectoryPath, _fmatrix PreTransform, const _tchar* pPrototypeTag);
void Ready_MapModels(vector<future<vector<FOLDER_LOAD*>*>>& jobMapModels);
HRESULT Ready_RigidBody_Static(CVIBuffer_Model_Instance* pModel_Instance);
public:
static CLoader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eNextLevelID);
@@ -127,8 +127,6 @@ HRESULT CInstancedProp::Ready_Components(void* pArg)
reinterpret_cast<CComponent**>(&m_pVIBufferInstanceCom))))
return E_FAIL;
/* Com_Shader */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_INSTANCE_PROP_MODEL,
reinterpret_cast<CComponent**>(&m_pShaderCom))))
@@ -68,9 +68,9 @@ HRESULT CLevel_MapViewer::Initialize()
return E_FAIL;
}
/*if (FAILED(Ready_Layer_InstanceProp(TEXT("Layer_InstanceProp")))) {
if (FAILED(Ready_Layer_InstanceProp(TEXT("Layer_InstanceProp")))) {
return E_FAIL;
}*/
}
//if (FAILED(Ready_Layer_BuildingContainer(TEXT("Layer_Building")))) {
// return E_FAIL;
@@ -148,7 +148,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag)
CTerrain::TERRAIN_DESC Desc = {};
///* Hogsmeade */
Desc.isEdit = false;
Desc.isEdit = true;
Desc.iAlphaSizeX = 2048;
Desc.iAlphaSizeY = 2048;
Desc.vPosition = _float3(-194, 18.5f, -153.f);
@@ -427,27 +427,27 @@ HRESULT CLevel_MapViewer::Ready_Layer_InstanceProp(const _wstring& strLayerTag)
CInstancedProp_Light::INSTANCE_PROP_LIGHT_DESC LightDesc = {};
///* LightPost */
//LightDesc.bEditMode = false;
//LightDesc.isShake = false;
//LightDesc.iGlassMeshIndex = 0;
//LightDesc.vRadius = _float2(0.f, 0.f);
//LightDesc.vSpeed = _float2(0.f, 0.f);
//LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_LightPost";
//LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Light_Post_Floating.bin";
//if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp_Light>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc)))
// return E_FAIL;
/* LightPost */
LightDesc.bEditMode = false;
LightDesc.isShake = false;
LightDesc.iGlassMeshIndex = 0;
LightDesc.vRadius = _float2(0.f, 0.f);
LightDesc.vSpeed = _float2(0.f, 0.f);
LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_LightPost";
LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/LightPost.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp_Light>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc)))
return E_FAIL;
///* LightPost_Floating */
//LightDesc.bEditMode = false;
//LightDesc.isShake = false;
//LightDesc.iGlassMeshIndex = 1;
//LightDesc.vRadius = _float2(0.f, 0.f);
//LightDesc.vSpeed = _float2(0.f, 0.f);
//LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating";
//LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/LightPost.bin";
//if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp_Light>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc)))
// return E_FAIL;
/* LightPost_Floating */
LightDesc.bEditMode = false;
LightDesc.isShake = false;
LightDesc.iGlassMeshIndex = 1;
LightDesc.vRadius = _float2(0.f, 0.f);
LightDesc.vSpeed = _float2(0.f, 0.f);
LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_Light_Post_Floating";
LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/Light_Post_Floating.bin";
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CInstancedProp_Light>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &LightDesc)))
return E_FAIL;
return S_OK;
}
+2 -2
View File
@@ -2952,7 +2952,7 @@ HRESULT CLoader::Loading_For_MapViewer()
#pragma endregion
_bool bLoadHogsmeade = false;
_bool bLoadHogsmeade = true;
if (bLoadHogsmeade)
{
#pragma region HOGSMEADE_OBJECT
@@ -3342,7 +3342,7 @@ vector<future<void>> jobFutures;
_uint iLoadCount = 44;
vector<vector<FOLDER_LOAD*>*> Contents(iLoadCount);
_bool isLoad_Map = { false };
_bool isLoad_Map = { true };
if(isLoad_Map)
{
{ /* Terrain */
@@ -407,7 +407,7 @@ void CMapObject_LOD::Describe_Entity()
_wstring dest = CMyTools::ToWstring(m_pModelComs[iModelIndex]->Get_MeshName(iMeshIndex) + to_string(iMeshIndex)).c_str();
Desc.pMeshName = dest.c_str();
Desc.iSubKind = 998;
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
if (FAILED(Add_Asset_Component(g_iStaticLevel, Desc.pMeshName, nullptr, &Desc))) {
assert(false);
}
@@ -65,9 +65,9 @@ HRESULT CMapObject_Manager::Initialize(void* pArg)
m_iContainerObjectIndex = 99;
/*if (FAILED(Load_MapData("Hogsmeade_MapContainer_Data", LAYER_HOGSMEADE)))
if (FAILED(Load_MapData("Hogsmeade_MapContainer_Data", LAYER_HOGSMEADE)))
return E_FAIL;
*/
//m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object<CBuildingContainer>();
+23 -23
View File
@@ -64,6 +64,7 @@ HRESULT CTerrain::Initialize(void* pArg)
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
Desc.pMeshName = TEXT("Hogsmeade_HeightMap");
Desc.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN);
Desc.pWorldMatrix = m_pTransformCom->Get_WorldMatrixPtr();
/* Com_RigidBody */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"),
reinterpret_cast<CComponent**>(&m_pRigidBody), &Desc))) {
@@ -305,36 +306,35 @@ void CTerrain::Describe_Entity()
GUI::Begin("Terrain");
#pragma region ALPHA_MAP
GUI::InputInt("Color", &m_iColorIndex);
m_iColorIndex = max(0, min(4, m_iColorIndex));
//GUI::InputInt("Color", &m_iColorIndex);
//m_iColorIndex = max(0, min(4, m_iColorIndex));
GUI::InputInt("Rnage", (_int*)(&m_iMaskRange));
GUI::DragFloat("Value", &m_fMaskValue, 0.01f, -1.0f, 1.f);
if (GUI::Button("Save", ImVec2(100.f, 30.f)))
{
m_pAlphaMap->Save_ToFile("Hogwart_AlphaMap.bin");
}
if (GUI::Button("Load", ImVec2(100.f, 30.f)))
{
m_pAlphaMap->Load_ToFile("Hogwart_AlphaMap.bin");
}
//GUI::DragFloat("Value", &m_fMaskValue, 0.01f, -1.0f, 1.f);
//if (GUI::Button("Save", ImVec2(100.f, 30.f)))
//{
// m_pAlphaMap->Save_ToFile("Hogwart_AlphaMap.bin");
//}
//if (GUI::Button("Load", ImVec2(100.f, 30.f)))
//{
// m_pAlphaMap->Load_ToFile("Hogwart_AlphaMap.bin");
//}
m_iMaskRange = max(1, m_iMaskRange);
GUI::DragFloat("Up", &m_fUpValue, 0.01f, -1.0f, 1.f);
m_iMaskRange = max(0, m_iMaskRange);
GUI::InputFloat("Up Value", &m_fUpValue, 0.001f, 0.1f);
if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON))
{
if (m_pGameInstance->isPicking(&m_vPickingPosition))
{
//if (m_pGameInstance->Key_Pressing(DIK_PERIOD))
// m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue, m_vPickingPosition, m_iMaskRange);
//if (m_pGameInstance->Key_Pressing(DIK_COMMA))
// m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue * -1.f, m_vPickingPosition, m_iMaskRange);
if (m_pGameInstance->Key_Pressing(DIK_PERIOD))
m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue, m_vPickingPosition, m_iMaskRange);
if (m_pGameInstance->Key_Pressing(DIK_COMMA))
m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_fUpValue * -1.f, m_vPickingPosition, m_iMaskRange);
XMStoreFloat3(&m_vPickingPosition, XMVector3TransformCoord(XMLoadFloat3(&m_vPickingPosition), m_pTransformCom->Get_WorldMatrixInv()));
if(m_pGameInstance->Key_Pressing(DIK_M))
m_pAlphaMap->Update(m_vPickingPosition, m_iColorIndex, m_fMaskValue, m_iMaskRange);
//XMStoreFloat3(&m_vPickingPosition, XMVector3TransformCoord(XMLoadFloat3(&m_vPickingPosition), m_pTransformCom->Get_WorldMatrixInv()));
//if(m_pGameInstance->Key_Pressing(DIK_M))
// m_pAlphaMap->Update(m_vPickingPosition, m_iColorIndex, m_fMaskValue, m_iMaskRange);
}
}
@@ -343,9 +343,9 @@ void CTerrain::Describe_Entity()
#pragma region HEIGHT MAP
HRESULT hr = {};
if(GUI::Button("Save HeightMap"))
hr = m_pVIBufferCom->Save_HeightMap("Hogwart_HeightMap.bin");
hr = m_pVIBufferCom->Save_HeightMap("Hogsmeade_HeightMap.bin");
if(GUI::Button("Load HeightMap"))
hr = m_pVIBufferCom->Load_HeightMap("Hogwart_HeightMap.bin");
hr = m_pVIBufferCom->Load_HeightMap("Hogsmeade_HeightMap.bin");
#pragma endregion
_float4 vPos = {};
@@ -17,6 +17,7 @@ class CInstancedProp final : public CGameObject
typedef struct tagInstancedPropDesc
{
_bool bEditMode{};
_bool isAddCollider{};
_bool isShake;
_float2 vRadius;
_float2 vSpeed;
@@ -1065,6 +1065,10 @@ PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody,
{
return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel);
}
PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix)
{
return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel, pWorldMatrix);
}
PSX::PxJoint* CGameInstance::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1)
{
return m_pPhysX_Manager->Create_PxJoint(eType, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
@@ -72,7 +72,6 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix);
// PxRigidStatic 씬의 정적 바디 인터페이스
PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix);
PSX::PxShape* pShape = { nullptr };
@@ -146,6 +145,85 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
return pActorStatic;
}
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix)
{
_matrix WorldMatrix = XMLoadFloat4x4(pWorldMatrix);
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix);
// PxRigidStatic 씬의 정적 바디 인터페이스
PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix);
PSX::PxShape* pShape = { nullptr };
PSX::PxGeometry* pGeometry = { nullptr };
switch (RigidBody.Get_Type())
{
case ACTOR::PLANE:
break;
case ACTOR::TRIANGLEMESH:
{ // SetUp Geometry
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey(), iLevel);
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
_vector vPos, vRotq, vScale;
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
vRotq = XMQuaternionNormalize(vRotq);
PSX::PxTransform out;
XMStoreFloat3((_float3*)&out.p, vPos);
XMStoreFloat4((_float4*)&out.q, vRotq);
PSX::PxMeshScale meshScale(
PSX::PxVec3(fabsf(vScale.m128_f32[0]), fabsf(vScale.m128_f32[1]), fabsf(vScale.m128_f32[2])),
PSX::PxQuat(PSX::PxIdentity) // 스케일 축은 로컬 기준
);
pPxMeshGeometry = new PSX::PxTriangleMeshGeometry(pPxMesh, meshScale);
// GeoFlag 중 더블사이드는 이제 지원 안함, 할거면 노말 뒤집어서 하라고 함
// pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
// 유효성 체크
PX_ASSERT(pPxMeshGeometry->isValid());
pGeometry = pPxMeshGeometry;
_bool bEmplaceSuccess = m_TriangleMeshGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry).second;
if (false == bEmplaceSuccess) {
Safe_Delete(pPxMeshGeometry);
pGeometry = (*m_TriangleMeshGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second;
}
}
break;
case ACTOR::HEIGHTFIELD:
{ // SetUp HeightField
PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey(), iLevel);
PSX::PxHeightFieldGeometry* pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField);
pPxHeightGeometry->heightScale = 0.01f/* 기본 정밀도 100배 0.01 -> 1cm, 1 -> 1m */;
// 유효성 체크
PX_ASSERT(pPxHeightGeometry->isValid());
pGeometry = pPxHeightGeometry;
_bool bEmplaceSuccess = m_HeightFieldGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxHeightGeometry).second;
if (false == bEmplaceSuccess) {
Safe_Delete(pPxHeightGeometry);
pGeometry = (*m_HeightFieldGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second;
}
}
break;
default:
assert(false);
break;
}
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorStatic, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
pShape->setFlags(RigidBody.Get_ShapeFlags());
pShape->setContactOffset(RigidBody.Get_ContactOffset());
pShape->setRestOffset(0.f);
m_pRestBodies[iLevel].insert(pActorStatic);
ApplyFilterData(pActorStatic);
Attach_Actor(*pActorStatic, iLevel);
return pActorStatic;
}
PSX::PxJoint* CPhysX_Manager::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1)
{
PSX::PxJoint* pOut = { nullptr };
@@ -588,10 +588,6 @@ void CRenderer::Render_Fog()
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
m_pShader->Bind_RawValue("g_fDepthPackExponent", m_pGameInstance->Get_DepthPackExponentPtr(), sizeof(_float));
//if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌
// assert(false);
//}
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
return;
}
@@ -32,12 +32,13 @@ HRESULT CRigidBody_Static::Initialize(void* pArg)
if (FAILED(__super::Initialize(pArg))) {
return E_FAIL;
}
RIGIDBODY_STATIC_DESC* pDesc = static_cast<RIGIDBODY_STATIC_DESC*>(pArg);
m_wstrMeshName = pDesc->pMeshName;
m_tagData.pOwner = m_pOwner;
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
m_tagData.pBody = this;
m_pRigidBody = m_pGameInstance->Add_StaticActor(*this, m_pGameInstance->Get_NextLevelID());
m_pRigidBody = m_pGameInstance->Add_StaticActor(*this, m_pGameInstance->Get_NextLevelID(), pDesc->pWorldMatrix);
m_pRigidBody->userData = &m_tagData;
m_pRigidBody->setName(CMyTools::ToString(m_wstrMeshName).c_str());
@@ -40,6 +40,28 @@ CVIBuffer_Model_Instance::CVIBuffer_Model_Instance(const CVIBuffer_Model_Instanc
}
}
const _char* CVIBuffer_Model_Instance::Get_MeshName(_uint iMeshIndex)
{
if (m_iNumMeshes <= iMeshIndex)
return nullptr;
return m_Meshes[iMeshIndex]->Get_Name();
}
HRESULT CVIBuffer_Model_Instance::Ready_PhysXMeshes(_uint iLevel)
{
m_iNumPhysXMeshes = m_iNumMeshes;
m_TriMeshes.reserve(m_iNumMeshes);
m_pGameInstance->ConvertToTriMeshes(m_Meshes, m_TriMeshes);
for (_uint i = 0; i < m_iNumMeshes; ++i) {
m_pGameInstance->RegistTriMesh((m_Meshes[i]->Get_Name() + to_string(i)).c_str(), m_TriMeshes[i], iLevel);
}
return S_OK;
}
HRESULT CVIBuffer_Model_Instance::Initialize_Prototype(const _char* pModelFilePath, const _char* pMatrialPath)
{
if (FAILED(Load_ModelData(pModelFilePath)))
@@ -218,6 +218,7 @@ class ENGINE_DLL CGameInstance final : public CBase
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel);
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel);
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel);
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix);
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
@@ -33,7 +33,8 @@ class CPhysX_Manager final : public CBase
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel);
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel);
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix);
// https://documentation.help/nvidia-physx-sdk-guide/Joints.html
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
PSX::PxD6Joint* Create_BasicPxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
@@ -16,7 +16,8 @@ class ENGINE_DLL CRigidBody_Static : public CRigidBody
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_DESC
{
const _tchar* pMeshName = { nullptr };
const _tchar* pMeshName = { nullptr };
const _float4x4* pWorldMatrix = { nullptr };
}RIGIDBODY_STATIC_DESC;
private:
@@ -27,6 +27,9 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance
public:
_uint Get_NumMesh() const { return m_iNumMeshes; }
const _char* Get_MeshName(_uint iMeshIndex);
HRESULT Ready_PhysXMeshes(_uint iLevel);
public:
virtual HRESULT Initialize_Prototype(const _char* pModelFilePath, const _char* pMatrialPath);
@@ -46,6 +49,8 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance
_uint m_iCurrentNumInstance = {};
_uint m_iMaxNumInstance = {};
_uint m_iNumPhysXMeshes = {};
_float m_fTimeAcc = {};
class CComputeShader* m_pComputeShader = { nullptr };
@@ -60,6 +65,7 @@ class ENGINE_DLL CVIBuffer_Model_Instance final : public CVIBuffer_Instance
vector<vector<string>> m_MeshMaterialPathes = {};
vector<PSX::PxTriangleMesh*> m_TriMeshes = {};
private:
HRESULT Reay_Instance_Buffer();
HRESULT Load_InstanceData(ifstream& in);