[merge commit]
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Body.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -75,7 +75,7 @@ CBody* CBody::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CBody");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -88,7 +88,7 @@ CGameObject* CBody::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CBody");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "DummyObject.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -129,7 +129,7 @@ CDummyObject* CDummyObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* p
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CDummyObject");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -142,7 +142,7 @@ CGameObject* CDummyObject::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CDummyObject");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -154,8 +154,8 @@ void CDummyObject::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CDummyObject::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Dummy_PhysXBox.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -155,8 +155,8 @@ void CDummy_PhysXBox::Free()
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pRigidBody);
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CDummy_PhysXBox::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Dummy_PhysXPlayable.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -117,9 +117,9 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
|
||||
Desc.fMaterial = { 0.5f, 0.5f, 0.6f };
|
||||
Desc.bAutoStepping = { false };
|
||||
Desc.fStepOffset = { 0.05f };
|
||||
Desc.tCapsuleInfo.fRadius = 0.5f;
|
||||
Desc.tCapsuleInfo.fHeight = 1.0f;
|
||||
Desc.tCapsuleInfo.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
|
||||
Desc.fRadius = 0.5f;
|
||||
Desc.fHeight = 1.0f;
|
||||
Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -188,8 +188,8 @@ void CDummy_PhysXPlayable::Free()
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pCharacter_Controller);
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CDummy_PhysXPlayable::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Effect_Editor.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -113,14 +113,14 @@ void CEffect_Editor::ReadMaterials(const char* pDirectoryName)
|
||||
|
||||
_string ext = file.path().extension().string();
|
||||
|
||||
if (strcmp(ext.c_str(), ".txt")) // 텍스트 파일 일때만 빌드함
|
||||
if (strcmp(ext.c_str(), ".txt")) // 텍스트 파일 일때만 빌드함
|
||||
continue;
|
||||
|
||||
_char szFilePath[MAX_PATH] = {};
|
||||
|
||||
strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str());
|
||||
|
||||
_wstring wstrFileName = file.path().stem().wstring(); // 파일명
|
||||
_wstring wstrFileName = file.path().stem().wstring(); // 파일명
|
||||
|
||||
|
||||
ReadMaterial(wstrFileName, szFilePath);
|
||||
@@ -138,35 +138,35 @@ void CEffect_Editor::ReadMaterial(_wstring wstrFileName, const char* pFilePath)
|
||||
|
||||
_wstring wstrFirstLine = {};
|
||||
|
||||
getline(wifs, wstrFirstLine); // 가장 위의 텍스트
|
||||
getline(wifs, wstrFirstLine); // 가장 위의 텍스트
|
||||
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
size_t iPos = wstrFirstLine.find(L" ");
|
||||
|
||||
_wstring wstrParent = {};
|
||||
|
||||
wstrParent = wstrFirstLine.substr(0, iPos); // " " 이전만 남김
|
||||
wstrParent = wstrFirstLine.substr(0, iPos); // " " 이전만 남김
|
||||
|
||||
if (wstrParent == L"Parent") // 부모 머테리얼이 있는 객체였다면
|
||||
if (wstrParent == L"Parent") // 부모 머테리얼이 있는 객체였다면
|
||||
{
|
||||
_wstring wstrMatPath = wstrFirstLine;
|
||||
|
||||
_wstring wstrKeyword = L"VFX";
|
||||
|
||||
size_t iPos = wstrMatPath.find(wstrKeyword); // VFX를 찾고 없을 시에 로드하지 않는다
|
||||
size_t iPos = wstrMatPath.find(wstrKeyword); // VFX를 찾고 없을 시에 로드하지 않는다
|
||||
|
||||
if (iPos != _wstring::npos) {
|
||||
|
||||
_wstring wstrResult = wstrMatPath.substr(iPos + wstrKeyword.length()); // "VTX이후만 남김"
|
||||
_wstring wstrResult = wstrMatPath.substr(iPos + wstrKeyword.length()); // "VTX이후만 남김"
|
||||
_wstring wstrMatName = {};
|
||||
|
||||
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
size_t iPos = wstrResult.find(L".");
|
||||
|
||||
wstrResult = wstrResult.substr(0, iPos); // ".이전만 남김"
|
||||
wstrResult = wstrResult.substr(0, iPos); // ".이전만 남김"
|
||||
|
||||
//파일이름 받아오기
|
||||
//파일이름 받아오기
|
||||
size_t iNamePos = wstrResult.rfind(L"/");
|
||||
wstrMatName = wstrResult.substr(iNamePos + 1);
|
||||
|
||||
@@ -175,18 +175,18 @@ void CEffect_Editor::ReadMaterial(_wstring wstrFileName, const char* pFilePath)
|
||||
ReadMaterial(wstrMatName, CMyTools::ToString(wstrResult).c_str());
|
||||
|
||||
|
||||
// 상위 머테리얼 파일에서 넣었던 파일을 다시 내 파일로 담는다
|
||||
// 상위 머테리얼 파일에서 넣었던 파일을 다시 내 파일로 담는다
|
||||
auto Superior_iter = m_MatFiles.find(wstrMatName);
|
||||
auto Recent_iter = m_MatFiles.find(wstrFileName);
|
||||
|
||||
|
||||
if (m_MatFiles.end() != Superior_iter) // 경로가 존재한다면
|
||||
if (m_MatFiles.end() != Superior_iter) // 경로가 존재한다면
|
||||
{
|
||||
for (auto& wstrPath : Superior_iter->second) // 상위 머테리얼 벡터를 순회하여 내 벡터에 넣자
|
||||
for (auto& wstrPath : Superior_iter->second) // 상위 머테리얼 벡터를 순회하여 내 벡터에 넣자
|
||||
{
|
||||
_bool isExist = { false };
|
||||
|
||||
for (auto TextureInfo : Recent_iter->second) //이미 존재한 경로였다면 추가하지 않는다
|
||||
for (auto TextureInfo : Recent_iter->second) //이미 존재한 경로였다면 추가하지 않는다
|
||||
{
|
||||
|
||||
if (TextureInfo.first == wstrPath.first)
|
||||
@@ -205,13 +205,13 @@ void CEffect_Editor::ReadMaterial(_wstring wstrFileName, const char* pFilePath)
|
||||
m_MatFiles.erase(Superior_iter);
|
||||
}
|
||||
|
||||
//벡터에 모두 넣었다면 상위 머테리얼을 지운다
|
||||
//벡터에 모두 넣었다면 상위 머테리얼을 지운다
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 텍스쳐를 불러오자
|
||||
// 텍스쳐를 불러오자
|
||||
_wstring wstrTextureLine = {};
|
||||
|
||||
while (getline(wifs, wstrTextureLine))
|
||||
@@ -219,34 +219,34 @@ void CEffect_Editor::ReadMaterial(_wstring wstrFileName, const char* pFilePath)
|
||||
|
||||
_wstring wstrKeyword = L"/VFX";
|
||||
|
||||
size_t iPos = wstrTextureLine.find(wstrKeyword); // VFX를 찾고 없을 시에 로드하지 않는다
|
||||
size_t iPos = wstrTextureLine.find(wstrKeyword); // VFX를 찾고 없을 시에 로드하지 않는다
|
||||
|
||||
if (iPos != _wstring::npos) {
|
||||
|
||||
_wstring wstrResult = wstrTextureLine.substr(iPos); // "VTX이후만 남김"
|
||||
_wstring wstrResult = wstrTextureLine.substr(iPos); // "VTX이후만 남김"
|
||||
_wstring wstrTextureName = {};
|
||||
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
//.기준으로 뒤에 이름을 지워야함
|
||||
size_t iPos = wstrResult.find(L".");
|
||||
|
||||
wstrResult = wstrResult.substr(0, iPos); // ".이전만 남김"
|
||||
wstrResult = wstrResult.substr(0, iPos); // ".이전만 남김"
|
||||
|
||||
// 이름 만들기
|
||||
// 이름 만들기
|
||||
size_t iNamePos = wstrResult.rfind(L"/");
|
||||
wstrTextureName = wstrResult.substr(iNamePos + 1);
|
||||
|
||||
wstrResult = L"../Bin/Resources" + wstrResult + L".png";
|
||||
|
||||
//경로를 담는다
|
||||
//경로를 담는다
|
||||
auto iter = m_MatFiles.find(wstrFileName);
|
||||
|
||||
if (m_MatFiles.end() != iter) // 경로가 존재한다면
|
||||
if (m_MatFiles.end() != iter) // 경로가 존재한다면
|
||||
{
|
||||
_bool isExist = { false };
|
||||
|
||||
for (auto TextureInfo : iter->second)
|
||||
{
|
||||
if (TextureInfo.first == wstrTextureName) // 이미 존재했었다면
|
||||
if (TextureInfo.first == wstrTextureName) // 이미 존재했었다면
|
||||
{
|
||||
isExist = true;
|
||||
break;
|
||||
@@ -279,7 +279,7 @@ void CEffect_Editor::Reference_Mat_For_EditEffect(CComponent** pTexture, CGameOb
|
||||
, pTexture
|
||||
, nullptr
|
||||
, pObject
|
||||
, wstrTextureInfo.first // 이름
|
||||
, wstrTextureInfo.first // 이름
|
||||
);
|
||||
};
|
||||
|
||||
@@ -395,7 +395,7 @@ void CEffect_Editor::Describe_Entity()
|
||||
if (ImGui::MenuItem("Delete Effect"))
|
||||
{
|
||||
auto iter = m_PartObjects.begin();
|
||||
advance(iter, iIndex); // 이터레이터를 증가시킨다
|
||||
advance(iter, iIndex); // 이터레이터를 증가시킨다
|
||||
|
||||
SAFE_RELEASE(pPartObject.second);
|
||||
m_PartObjects.erase(iter);
|
||||
@@ -411,7 +411,7 @@ void CEffect_Editor::Describe_Entity()
|
||||
|
||||
#pragma endregion
|
||||
|
||||
if (GUI::IsItemClicked()) // 선택창에 띄우기
|
||||
if (GUI::IsItemClicked()) // 선택창에 띄우기
|
||||
{
|
||||
CEditEffect* pSelectedEffectObject = dynamic_cast<CEditEffect*>(pPartObject.second);
|
||||
|
||||
@@ -432,11 +432,11 @@ void CEffect_Editor::Describe_Entity()
|
||||
|
||||
|
||||
|
||||
Safe_Release(m_pEditEffect);
|
||||
SAFE_RELEASE(m_pEditEffect);
|
||||
|
||||
m_pEditEffect = pSelectedEffectObject;
|
||||
|
||||
Safe_AddRef(pSelectedEffectObject);
|
||||
SAFE_ADDREF(pSelectedEffectObject);
|
||||
|
||||
m_strCurrentEffectName = strName;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Hair.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -136,7 +136,7 @@ CHair* CHair::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CHair");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -149,7 +149,7 @@ CGameObject* CHair::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CHair");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Head.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -75,7 +75,7 @@ CHead* CHead::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CHead");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -88,7 +88,7 @@ CGameObject* CHead::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CHead");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MapObject_LOD.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -222,10 +222,10 @@ void CMapObject_LOD::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
|
||||
for(auto& pModel : m_pModelComs)
|
||||
Safe_Release(pModel);
|
||||
SAFE_RELEASE(pModel);
|
||||
m_pModelComs.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1084,7 +1084,7 @@ CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11Devi
|
||||
if (FAILED(pInstance->Initialize_Prototype(ModelPrototypeTags, ModelPrototypePaths)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMapObject_Manager");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -1097,7 +1097,7 @@ CGameObject* CMapObject_Manager::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CMapObject_Manager");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MapObject_Static.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -192,8 +192,8 @@ void CMapObject_Static::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CMapObject_Static::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Body.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -138,8 +138,8 @@ void CModelParts::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CModelParts::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Monster.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -129,7 +129,7 @@ CMonster* CMonster::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMonster");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -142,7 +142,7 @@ CGameObject* CMonster::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CMonster");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -154,8 +154,8 @@ void CMonster::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CMonster::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "RootModelPart.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -171,7 +171,7 @@ CRootModelPart* CRootModelPart::Create(ID3D11Device* pDevice, ID3D11DeviceContex
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CRootModelPart");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -184,7 +184,7 @@ CGameObject* CRootModelPart::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CRootModelPart");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Terrain.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -126,7 +126,7 @@ CTerrain* CTerrain::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CTerrain");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -139,7 +139,7 @@ CGameObject* CTerrain::Clone(void* pArg, CGameObject* pOwner)
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CTerrain");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -149,9 +149,9 @@ void CTerrain::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pVIBufferCom);
|
||||
Safe_Release(m_pTextureCom);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
SAFE_RELEASE(m_pTextureCom);
|
||||
}
|
||||
|
||||
void CTerrain::Describe_Entity()
|
||||
|
||||
@@ -203,6 +203,7 @@ call Update_Lib.bat
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Collider.cpp" />
|
||||
<ClCompile Include="..\Private\Collider_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\Collision_Callback.cpp" />
|
||||
<ClCompile Include="..\Private\Component.cpp" />
|
||||
<ClCompile Include="..\Private\ComputeShader.cpp" />
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
@@ -418,6 +419,7 @@ call Update_Lib.bat
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Collider.h" />
|
||||
<ClInclude Include="..\Public\Collider_Manager.h" />
|
||||
<ClInclude Include="..\Public\Collision_Callback.h" />
|
||||
<ClInclude Include="..\Public\Component.h" />
|
||||
<ClInclude Include="..\Public\ComputeShader.h" />
|
||||
<ClInclude Include="..\Public\ContainerObject.h" />
|
||||
|
||||
@@ -244,6 +244,18 @@
|
||||
<Filter Include="01.Utility\06.Picking">
|
||||
<UniqueIdentifier>{a60a7ba5-a937-41d7-baac-db67f86f3ba1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\08.Character_Controller\Collision_Callback">
|
||||
<UniqueIdentifier>{05865481-fa20-4432-a5a7-945d4f8c7f3c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\10.Dynamic">
|
||||
<UniqueIdentifier>{bed0de44-4e62-4b5f-9767-65cfc8a933a3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\11.Kinematic">
|
||||
<UniqueIdentifier>{33ac85a2-be8e-4ad9-a179-1239d818dc9c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\00.Static">
|
||||
<UniqueIdentifier>{fda41884-634b-4dd4-8bd2-f6f7ad68ab1f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\09.Light">
|
||||
<UniqueIdentifier>{7c82051e-19af-4284-8156-16f504db30b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -465,6 +477,9 @@
|
||||
<ClCompile Include="..\Private\Light_Manager.cpp">
|
||||
<Filter>03.Management\03.Light_Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Collision_Callback.cpp">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\Collision_Callback</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1046,6 +1061,9 @@
|
||||
<ClInclude Include="..\Public\Light_Manager.h">
|
||||
<Filter>03.Management\03.Light_Manager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Collision_Callback.h">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\Collision_Callback</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
|
||||
#include "Animation.h"
|
||||
#include "Channel.h"
|
||||
@@ -34,7 +34,7 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
//m_fCurrentTrackPosition += m_TickPerSeconds[m_bPause] * fTimeDelta;
|
||||
m_fCurrentTrackPosition += m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
if (m_fCurrentTrackPosition >= m_fDuration) {
|
||||
m_fCurrentTrackPosition = 0.f; // ·çÇÁ
|
||||
m_fCurrentTrackPosition = 0.f; // 루프
|
||||
if (false == bIsLoop) {
|
||||
m_fCurrentTrackPosition = m_fDuration;
|
||||
return true;
|
||||
@@ -244,7 +244,7 @@ CAnimation* CAnimation::Create(const CModel* pModel, SaveAnimation* pSaveAnimati
|
||||
if (FAILED(pInstance->Initialize(pModel, pSaveAnimation)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CAnimation");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Bone.h"
|
||||
|
||||
CBone::CBone()
|
||||
@@ -76,7 +76,7 @@ CBone* CBone::Create(const SaveNode& _SaveNode, _int iParentIndex)
|
||||
if (FAILED(pInstance->Initialize(_SaveNode, iParentIndex)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CBone");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
|
||||
#include "Channel.h"
|
||||
#include "Model.h"
|
||||
@@ -267,7 +267,7 @@ CChannel* CChannel::Create(const CModel* pModel, SaveChannel* pSaveChannel)
|
||||
if (FAILED(pInstance->Initialize(pModel, pSaveChannel)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CChannel");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "Character_Controller.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Collision_Callback.h"
|
||||
|
||||
CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CComponent{ pDevice, pContext }
|
||||
@@ -62,6 +63,11 @@ HRESULT CCharacter_Controller::Render()
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
void CCharacter_Controller::Resize_Volume(_float fHeight)
|
||||
{
|
||||
m_pController->resize(fHeight);
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Modify_Volume(_float3 fVolume)
|
||||
{
|
||||
switch (m_eBodyType)
|
||||
@@ -129,18 +135,13 @@ _float3 CCharacter_Controller::Get_Volume()
|
||||
|
||||
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 }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
|
||||
_float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
|
||||
PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
|
||||
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
|
||||
XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum());
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
@@ -171,11 +172,6 @@ _float3 CCharacter_Controller::Get_FootPosition()
|
||||
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;
|
||||
@@ -184,55 +180,90 @@ HRESULT CCharacter_Controller::Initialize_Prototype()
|
||||
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;
|
||||
{ // Character_Controller_DESC
|
||||
m_eBodyType = pDesc->eBodyType;
|
||||
m_bAutoStepping = pDesc->bAutoStepping;
|
||||
m_pTransform = pDesc->pTransform;
|
||||
|
||||
}
|
||||
{ // PhsXUserData
|
||||
m_tagData.eKind = PHYSX_KIND::CCTActor;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pCharacter = this;
|
||||
}
|
||||
|
||||
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);
|
||||
#ifdef _DEBUG
|
||||
_float3 vVolume = Get_Volume();
|
||||
m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vVolume, false, false));
|
||||
#endif // _DEBUG
|
||||
Desc.halfHeight = pDesc->vBoxSize.y;
|
||||
Desc.halfSideExtent = pDesc->vBoxSize.x;
|
||||
Desc.halfForwardExtent = pDesc->vBoxSize.z;
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = static_cast<PSX::PxUserControllerHitReport*>(pDesc->pCallback);
|
||||
Desc.behaviorCallback = static_cast<PSX::PxControllerBehaviorCallback*>(pDesc->pCallback);
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_BoxController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
} 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);
|
||||
#ifdef _DEBUG
|
||||
_float3 vVolume = Get_Volume();
|
||||
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, vVolume.x, 10, false, false));
|
||||
m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, vVolume.y, vVolume.x, 10, false));
|
||||
#endif // _DEBUG
|
||||
Desc.radius = pDesc->fRadius;
|
||||
Desc.height = pDesc->fHeight;
|
||||
Desc.climbingMode = pDesc->eClimbingMode; // 기본 eEASY
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = static_cast<PSX::PxUserControllerHitReport*>(pDesc->pCallback);
|
||||
Desc.behaviorCallback = static_cast<PSX::PxControllerBehaviorCallback*>(pDesc->pCallback);
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
} break;
|
||||
default:
|
||||
assert(false); // PhysX에서 불가능
|
||||
return E_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (nullptr == m_pController) {
|
||||
assert(false);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pController->setSlopeLimit(m_fSlopeLimit);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(Debug_Initialize())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CCharacter_Controller::Debug_Initialize()
|
||||
{
|
||||
_float3 vVolume = Get_Volume();
|
||||
switch (m_eBodyType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vVolume, false, false));
|
||||
break;
|
||||
case ACTOR::CAPSULE:
|
||||
m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, vVolume.y, vVolume.x, 10, false));
|
||||
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, vVolume.x, 10, false, false));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
_bool CCharacter_Controller::Check_Overlap()
|
||||
{
|
||||
return _bool();
|
||||
@@ -295,6 +326,7 @@ void CCharacter_Controller::Describe_Entity()
|
||||
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;
|
||||
|
||||
@@ -317,6 +349,7 @@ void CCharacter_Controller::Describe_Entity()
|
||||
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.");
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
#include "pch.h"
|
||||
#include "Collision_Callback.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CCollision_Callback::CCollision_Callback()
|
||||
{
|
||||
}
|
||||
|
||||
void CCollision_Callback::onShapeHit(const PSX::PxControllerShapeHit& hit)
|
||||
{
|
||||
PSX::PxController* pController = hit.controller;
|
||||
PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
|
||||
PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
|
||||
PSX::PxVec3 vDir = hit.dir; // move 방향
|
||||
_float fLength = hit.length; // move 길이
|
||||
|
||||
PSX::PxShape* pShape = hit.shape;
|
||||
PSX::PxRigidActor* pActor = hit.actor;
|
||||
|
||||
|
||||
if (nullptr != pController && nullptr != pActor) {
|
||||
PhsXUserData* pActorData = static_cast<PhsXUserData*>(pActor->userData);
|
||||
assert(nullptr != pActor); // missing user data
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
// action
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
// action
|
||||
break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
assert(false);
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCollision_Callback::onControllerHit(const PSX::PxControllersHit& hit)
|
||||
{
|
||||
PSX::PxController* pController = hit.controller;
|
||||
PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
|
||||
PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
|
||||
PSX::PxVec3 vDir = hit.dir; // move 방향
|
||||
_float fLength = hit.length; // move 길이
|
||||
|
||||
PSX::PxController* pOtherController= hit.other; // 다른 컨트롤러
|
||||
|
||||
if (nullptr != pController && nullptr != pOtherController) {
|
||||
PhsXUserData* pActorData = static_cast<PhsXUserData*>(pOtherController->getActor()->userData);
|
||||
assert(nullptr != pOtherController); // missing user data
|
||||
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
assert(false);
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
assert(false);
|
||||
break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
// Action
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCollision_Callback::onObstacleHit(const PSX::PxControllerObstacleHit& hit)
|
||||
{
|
||||
PSX::PxController* pController = hit.controller;
|
||||
PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
|
||||
PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
|
||||
PSX::PxVec3 vDir = hit.dir; // move 방향
|
||||
_float fLength = hit.length; // move 길이
|
||||
|
||||
const void* pOtherController= hit.userData; // 장애물
|
||||
|
||||
//switch (pOtherController.member)
|
||||
//{
|
||||
//default:
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor)
|
||||
{
|
||||
//if (actor.userData.subKind == kMovingPlatformTag)
|
||||
// return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT
|
||||
// | PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
|
||||
|
||||
// 나머지는 아무 특별 동작 없음
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxController& controller)
|
||||
{
|
||||
// CCT끼리 부딪힐 때를 굳이 안 쓰면 0 리턴
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxObstacle& obstacle)
|
||||
{
|
||||
// Obstacle이 움직이는 발판이다?
|
||||
// 여기서 ride/slide 세팅
|
||||
//return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT;
|
||||
|
||||
return PSX::PxControllerBehaviorFlags();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "ComputeShader.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Instance_Model.h"
|
||||
@@ -8,9 +8,9 @@ CComputeShader::CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
|
||||
, m_pContext{ pContext }
|
||||
, m_pGameInstance{ CGameInstance::GetInstance() }
|
||||
{
|
||||
Safe_AddRef(m_pDevice);
|
||||
Safe_AddRef(m_pContext);
|
||||
Safe_AddRef(m_pGameInstance);
|
||||
SAFE_ADDREF(m_pDevice);
|
||||
SAFE_ADDREF(m_pContext);
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
|
||||
@@ -37,10 +37,10 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
{
|
||||
//VBBuffer-> dynamic , pConstantBuffer-> dynamic , m_pInputBuffer, m_pOutputBuffer-> default , m_pStagingBuffer-> Staging
|
||||
|
||||
//내 시작 버퍼 값을 채운다.
|
||||
//내 시작 버퍼 값을 채운다.
|
||||
|
||||
//다이나믹으로 생성된 버퍼를 바로 디폴트 버퍼로 때려박을 수 없음
|
||||
//따라서 스테이징 버퍼를 따로 선언하여 값을 복사받는다.
|
||||
//다이나믹으로 생성된 버퍼를 바로 디폴트 버퍼로 때려박을 수 없음
|
||||
//따라서 스테이징 버퍼를 따로 선언하여 값을 복사받는다.
|
||||
|
||||
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++)
|
||||
@@ -55,22 +55,22 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
|
||||
|
||||
|
||||
//컴퓨트 쉐이더 바인딩
|
||||
//컴퓨트 쉐이더 바인딩
|
||||
m_pContext->CSSetShader(m_pComputeShader, nullptr, 0);
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &pConstantBuffer);
|
||||
|
||||
//SRV, UAV 바인딩
|
||||
//SRV, UAV 바인딩
|
||||
Bind_SRV(iSRVIndex);
|
||||
Bind_UAV(iUAVIndex);
|
||||
|
||||
//컴퓨트 쉐이더 실행
|
||||
//컴퓨트 쉐이더 실행
|
||||
|
||||
//내 버퍼의 차원(1,2,3차원 배열)에 따른 그룹 카운트를 설정 << 정확히 모르겠음
|
||||
//내 버퍼의 차원(1,2,3차원 배열)에 따른 그룹 카운트를 설정 << 정확히 모르겠음
|
||||
m_pContext->Dispatch((_uint)vGroupCount.x, (_uint)vGroupCount.y, (_uint)vGroupCount.z);
|
||||
|
||||
|
||||
//디폴트-> 스테이징 버퍼는 복사가 가능함 (다이나믹은 cpu 기반이라 복사 안됨)
|
||||
//0번 스테이징 버퍼가 아우풋 스테이징 버퍼와 같음
|
||||
//디폴트-> 스테이징 버퍼는 복사가 가능함 (다이나믹은 cpu 기반이라 복사 안됨)
|
||||
//0번 스테이징 버퍼가 아우풋 스테이징 버퍼와 같음
|
||||
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> StagingSubResources = {};
|
||||
|
||||
@@ -78,7 +78,7 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
{
|
||||
m_pContext->CopyResource(m_pOutputStagingBuffer[i], m_pOutputBuffer[i]);
|
||||
|
||||
//스테이징 버퍼를 열어서 카피함
|
||||
//스테이징 버퍼를 열어서 카피함
|
||||
D3D11_MAPPED_SUBRESOURCE StagingSubResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pOutputStagingBuffer[i], 0, D3D11_MAP_READ, 0, &StagingSubResource)))
|
||||
@@ -99,9 +99,9 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
|
||||
void CComputeShader::Bind_SRV(_uint iIndex)
|
||||
{
|
||||
m_pContext->CSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
m_iNumInputBuffer, // 버퍼 개수
|
||||
&m_pInputSRV[0]); // 버퍼 시작 주소
|
||||
m_pContext->CSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
m_iNumInputBuffer, // 버퍼 개수
|
||||
&m_pInputSRV[0]); // 버퍼 시작 주소
|
||||
}
|
||||
|
||||
void CComputeShader::Bind_UAV(_uint iIndex)
|
||||
@@ -111,15 +111,15 @@ void CComputeShader::Bind_UAV(_uint iIndex)
|
||||
|
||||
void CComputeShader::Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex)
|
||||
{
|
||||
m_pContext->PSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
1, // 버퍼 개수
|
||||
&m_pOutputSRV[iBufferIndex]); // 버퍼 시작 주소
|
||||
m_pContext->PSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
1, // 버퍼 개수
|
||||
&m_pOutputSRV[iBufferIndex]); // 버퍼 시작 주소
|
||||
|
||||
}
|
||||
|
||||
void CComputeShader::Reset()
|
||||
{
|
||||
//다음 랜더링 패스에 연관되지 않도록 초기화
|
||||
//다음 랜더링 패스에 연관되지 않도록 초기화
|
||||
|
||||
vector<ID3D11ShaderResourceView*> pResetSRVs = {};
|
||||
vector<ID3D11UnorderedAccessView*> pResetUAVs = {};
|
||||
@@ -141,10 +141,10 @@ void CComputeShader::Reset()
|
||||
|
||||
HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride[], _uint iOuputStructStride[])
|
||||
{
|
||||
//인 아웃풋 버퍼
|
||||
//인 아웃풋 버퍼
|
||||
|
||||
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
{
|
||||
D3D11_BUFFER_DESC InputBufferdesc = {};
|
||||
|
||||
@@ -162,9 +162,9 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
|
||||
m_pInputBuffer.push_back(pInputBuffer);
|
||||
|
||||
//스테이징 버퍼 이름
|
||||
//스테이징 버퍼 이름
|
||||
D3D11_BUFFER_DESC StagingBufferDesc = {};
|
||||
StagingBufferDesc.Usage = D3D11_USAGE_STAGING; // 스테이징 버퍼
|
||||
StagingBufferDesc.Usage = D3D11_USAGE_STAGING; // 스테이징 버퍼
|
||||
StagingBufferDesc.ByteWidth = iInputStructStride[i] * iNumElement;
|
||||
StagingBufferDesc.StructureByteStride = iInputStructStride[i];
|
||||
StagingBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
|
||||
@@ -181,14 +181,14 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
// 아웃풋 버퍼
|
||||
// 아웃풋 버퍼
|
||||
|
||||
D3D11_BUFFER_DESC Bufferdesc = {};
|
||||
Bufferdesc.ByteWidth = iOuputStructStride[i] * iNumElement;
|
||||
Bufferdesc.StructureByteStride = iOuputStructStride[i];
|
||||
Bufferdesc.Usage = D3D11_USAGE_DEFAULT; // 인 아웃풋 버퍼는 디폴트로 설정해야함
|
||||
Bufferdesc.CPUAccessFlags = 0; // 디폴트 버퍼는 CPU에서 Read Write가 불가능하며
|
||||
//오직 Update_SubResource를 통해서만 갱신이 가능하다.
|
||||
Bufferdesc.Usage = D3D11_USAGE_DEFAULT; // 인 아웃풋 버퍼는 디폴트로 설정해야함
|
||||
Bufferdesc.CPUAccessFlags = 0; // 디폴트 버퍼는 CPU에서 Read Write가 불가능하며
|
||||
//오직 Update_SubResource를 통해서만 갱신이 가능하다.
|
||||
|
||||
Bufferdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
Bufferdesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
@@ -201,9 +201,9 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
|
||||
m_pOutputBuffer.push_back(pOutputBuffer);
|
||||
|
||||
//아웃풋 스테이징 버퍼
|
||||
//아웃풋 스테이징 버퍼
|
||||
D3D11_BUFFER_DESC OutPutStagingBufferDesc = {};
|
||||
OutPutStagingBufferDesc.Usage = D3D11_USAGE_STAGING; // 스테이징 버퍼
|
||||
OutPutStagingBufferDesc.Usage = D3D11_USAGE_STAGING; // 스테이징 버퍼
|
||||
OutPutStagingBufferDesc.ByteWidth = iOuputStructStride[i] * iNumElement;
|
||||
OutPutStagingBufferDesc.StructureByteStride = iOuputStructStride[i];
|
||||
OutPutStagingBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
|
||||
@@ -222,7 +222,7 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuffer)
|
||||
{
|
||||
// SRV
|
||||
for (_uint i = 0; i < iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
for (_uint i = 0; i < iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
{
|
||||
ID3D11ShaderResourceView* pSrv = {};
|
||||
|
||||
@@ -261,7 +261,7 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
//SRV
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN; // StructuredBuffer는 UNKNOWN
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN; // StructuredBuffer는 UNKNOWN
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
@@ -283,7 +283,7 @@ HRESULT CComputeShader::CreateComputeShader(const _tchar* pShaderFilePath, const
|
||||
{
|
||||
ID3DBlob* pCSBlob = nullptr;
|
||||
|
||||
// Debug 모드와 release 모드의 플레그를 다르게 줘야함
|
||||
// Debug 모드와 release 모드의 플레그를 다르게 줘야함
|
||||
UINT HLSLFlags = {};
|
||||
#ifdef _DEBUG
|
||||
HLSLFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
@@ -303,10 +303,10 @@ HRESULT CComputeShader::CreateComputeShader(const _tchar* pShaderFilePath, const
|
||||
|
||||
|
||||
if (FAILED(m_pDevice->CreateComputeShader(
|
||||
pCSBlob->GetBufferPointer(), // 컴파일된 쉐이더 코드
|
||||
pCSBlob->GetBufferSize(), // 코드 길이
|
||||
nullptr, // 클래스 인스턴스 (없음)
|
||||
&m_pComputeShader // 컴퓨트 쉐이더 객체
|
||||
pCSBlob->GetBufferPointer(), // 컴파일된 쉐이더 코드
|
||||
pCSBlob->GetBufferSize(), // 코드 길이
|
||||
nullptr, // 클래스 인스턴스 (없음)
|
||||
&m_pComputeShader // 컴퓨트 쉐이더 객체
|
||||
)))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -323,7 +323,7 @@ CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContex
|
||||
if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName, iNumElement, iNumInputBuffer, iNumOutputBuffer, iOutputStructStride, iInputStructStride)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CComputeShader Prototype");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
@@ -335,22 +335,22 @@ void CComputeShader::Free()
|
||||
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++)
|
||||
{
|
||||
Safe_Release(m_pInputSRV[i]);
|
||||
Safe_Release(m_pInputBuffer[i]);
|
||||
Safe_Release(m_pInputStagingBuffer[i]);
|
||||
SAFE_RELEASE(m_pInputSRV[i]);
|
||||
SAFE_RELEASE(m_pInputBuffer[i]);
|
||||
SAFE_RELEASE(m_pInputStagingBuffer[i]);
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
|
||||
{
|
||||
Safe_Release(m_pOutputUAV[i]);
|
||||
Safe_Release(m_pOutputBuffer[i]);
|
||||
Safe_Release(m_pOutputSRV[i]);
|
||||
Safe_Release(m_pOutputStagingBuffer[i]);
|
||||
SAFE_RELEASE(m_pOutputUAV[i]);
|
||||
SAFE_RELEASE(m_pOutputBuffer[i]);
|
||||
SAFE_RELEASE(m_pOutputSRV[i]);
|
||||
SAFE_RELEASE(m_pOutputStagingBuffer[i]);
|
||||
}
|
||||
|
||||
|
||||
Safe_Release(m_pComputeShader);
|
||||
Safe_Release(m_pDevice);
|
||||
Safe_Release(m_pContext);
|
||||
Safe_Release(m_pGameInstance);
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pDevice);
|
||||
SAFE_RELEASE(m_pContext);
|
||||
SAFE_RELEASE(m_pGameInstance);
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
|
||||
}
|
||||
|
||||
#pragma region PhysX_Manager
|
||||
PSX::PxMaterial* CGameInstance::Get_Material(_float3* vMatInfo)
|
||||
PSX::PxMaterial* CGameInstance::Create_Material(_float3* vMatInfo)
|
||||
{
|
||||
return m_pPhysX_Manager->Create_Material(vMatInfo);
|
||||
}
|
||||
@@ -581,11 +581,11 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
|
||||
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
|
||||
}
|
||||
|
||||
const PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
|
||||
}
|
||||
const PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_StaticActor(RigidBody);
|
||||
}
|
||||
@@ -605,6 +605,14 @@ void CGameInstance::ReleaseController(_uint iControllerIndex)
|
||||
{
|
||||
m_pPhysX_Manager->ReleaseController(iControllerIndex);
|
||||
}
|
||||
void CGameInstance::Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Attach_Actor(RigidBody, Actor);
|
||||
}
|
||||
void CGameInstance::Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor)
|
||||
{
|
||||
m_pPhysX_Manager->Detach_Actor(RigidBody, pActor);
|
||||
}
|
||||
HRESULT CGameInstance::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
{
|
||||
return m_pPhysX_Manager->ConvertToTriMeshes(Meshes, pxTriMeshes, WorldMatrix);
|
||||
@@ -726,7 +734,6 @@ void CGameInstance::Release_Engine()
|
||||
{
|
||||
DestroyInstance();
|
||||
|
||||
SAFE_RELEASE(m_pPhysX_Manager);
|
||||
SAFE_RELEASE(m_pPicking);
|
||||
SAFE_RELEASE(m_pCollider_Manager);
|
||||
SAFE_RELEASE(m_pShadow);
|
||||
@@ -738,6 +745,7 @@ void CGameInstance::Release_Engine()
|
||||
SAFE_RELEASE(m_pTimer_Manager);
|
||||
SAFE_RELEASE(m_pRenderer);
|
||||
SAFE_RELEASE(m_pObject_Manager);
|
||||
SAFE_RELEASE(m_pPhysX_Manager);
|
||||
SAFE_RELEASE(m_pLevel_Manager);
|
||||
SAFE_RELEASE(m_pPrototype_Manager);
|
||||
SAFE_RELEASE(m_pLight_Manager); // Light Manager´Â m_pObject_Manager º¸´Ù »¡¸® ºÒ·Á¾ßÇÔ
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
|
||||
#include "Instance_Model.h"
|
||||
#include "Mesh.h"
|
||||
@@ -23,7 +23,7 @@ CInstance_Model::CInstance_Model(const CInstance_Model& rhs)
|
||||
SAFE_ADDREF(pMesh);
|
||||
}
|
||||
|
||||
Safe_AddRef(m_pVBInstance);
|
||||
SAFE_ADDREF(m_pVBInstance);
|
||||
}
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT CInstance_Model::Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
|
||||
@@ -92,12 +92,12 @@ HRESULT CInstance_Model::Ready_Meshes(MODEL eType, const aiScene* pAIScene, _fma
|
||||
|
||||
HRESULT CInstance_Model::Change_NumInstance()
|
||||
{
|
||||
Safe_Release(m_pVBInstance);
|
||||
Safe_Release(m_pComputeShader);
|
||||
Safe_Release(m_pConstantBuffer);
|
||||
Safe_Release(m_pParticleValueBuffer);
|
||||
SAFE_RELEASE(m_pVBInstance);
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pParticleValueBuffer);
|
||||
|
||||
//모든 버퍼를 지우고 재 생성 해야함
|
||||
//모든 버퍼를 지우고 재 생성 해야함
|
||||
|
||||
if (FAILED(Create_Instance_Buffer(&m_InstanceDesc)))
|
||||
return E_FAIL;
|
||||
@@ -105,7 +105,7 @@ HRESULT CInstance_Model::Change_NumInstance()
|
||||
if (FAILED(Create_SubResource_Buffer()))
|
||||
return E_FAIL;
|
||||
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
Instane_Buffer_ReStruct();
|
||||
|
||||
_uint CS_InputStrides[] = {
|
||||
@@ -158,7 +158,7 @@ HRESULT CInstance_Model::Create_Instance_Buffer(const INSTANCE_DESC* pDesc)
|
||||
HRESULT CInstance_Model::Create_SubResource_Buffer()
|
||||
{
|
||||
|
||||
// 벨류 버퍼 생성하기
|
||||
// 벨류 버퍼 생성하기
|
||||
D3D11_BUFFER_DESC Particle_Buffer_Desc = {};
|
||||
Particle_Buffer_Desc.ByteWidth = sizeof(CS_PARTICLE_VALUE_DESC) * m_iNumInstance;
|
||||
Particle_Buffer_Desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
@@ -175,7 +175,7 @@ HRESULT CInstance_Model::Create_SubResource_Buffer()
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
//컨스턴트 버퍼 생성하기
|
||||
//컨스턴트 버퍼 생성하기
|
||||
|
||||
D3D11_BUFFER_DESC cbDesc = {};
|
||||
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
@@ -205,7 +205,7 @@ HRESULT CInstance_Model::Initialize(void* pArg)
|
||||
if (FAILED(Create_SubResource_Buffer()))
|
||||
return E_FAIL;
|
||||
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
//시작 시에 인스턴트 버퍼를 구성 해줌
|
||||
Instane_Buffer_ReStruct();
|
||||
|
||||
_uint CS_InputStrides[] = {
|
||||
@@ -262,7 +262,7 @@ void CInstance_Model::Drop(_float fTimeDelta)
|
||||
if (SUCCEEDED(m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_DISCARD, 0, &VBInstanceResource)))
|
||||
{
|
||||
|
||||
memcpy(VBInstanceResource.pData, OutSubResources[0].pData, m_iInstanceStride * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
memcpy(VBInstanceResource.pData, OutSubResources[0].pData, m_iInstanceStride * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
|
||||
m_pContext->Unmap(m_pVBInstance, 0);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ void CInstance_Model::Drop(_float fTimeDelta)
|
||||
{
|
||||
CS_PARTICLE_VALUE_DESC* pValueDesc = static_cast<CS_PARTICLE_VALUE_DESC*>(OutSubResources[1].pData);
|
||||
|
||||
memcpy(ParticleValueResource.pData, OutSubResources[1].pData, sizeof(CS_PARTICLE_VALUE_DESC) * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
memcpy(ParticleValueResource.pData, OutSubResources[1].pData, sizeof(CS_PARTICLE_VALUE_DESC) * m_InstanceDesc.iNumInstance); // 아웃풋 버퍼에 들어온 값들을 전부 복사한다.
|
||||
|
||||
m_pContext->Unmap(m_pParticleValueBuffer, 0);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
for (size_t i = 0; i < m_iNumInstance; i++)
|
||||
{
|
||||
|
||||
//스케일 설정
|
||||
//스케일 설정
|
||||
_float3 vScale = _float3(
|
||||
m_pGameInstance->Random_Float(m_InstanceDesc.vSizeMin.x, m_InstanceDesc.vSizeMax.x),
|
||||
m_pGameInstance->Random_Float(m_InstanceDesc.vSizeMin.y, m_InstanceDesc.vSizeMax.y),
|
||||
@@ -321,7 +321,7 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
|
||||
_matrix ScaleMatrix = XMMatrixScaling(vScale.x, vScale.y, vScale.z);
|
||||
|
||||
//로테이션 설정
|
||||
//로테이션 설정
|
||||
_float3 vRoataion = _float3(
|
||||
m_pGameInstance->Random_Float(m_InstanceDesc.vRotationAngleMin.x, m_InstanceDesc.vRotationAngleMax.x),
|
||||
m_pGameInstance->Random_Float(m_InstanceDesc.vRotationAngleMin.y, m_InstanceDesc.vRotationAngleMax.y),
|
||||
@@ -335,7 +335,7 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
);
|
||||
|
||||
|
||||
//위치 설정
|
||||
//위치 설정
|
||||
_float4x4 SRMatrix = {};
|
||||
|
||||
XMStoreFloat4x4(&SRMatrix, ScaleMatrix * RotationMatrix);
|
||||
@@ -351,7 +351,7 @@ void CInstance_Model::Instane_Buffer_ReStruct()
|
||||
m_pGameInstance->Random_Float(m_InstanceDesc.vCenter.z - m_InstanceDesc.vRange.z * 0.5f, m_InstanceDesc.vCenter.z + m_InstanceDesc.vRange.z * 0.5f),
|
||||
1.f);
|
||||
|
||||
//라이프 타임 설정
|
||||
//라이프 타임 설정
|
||||
pVertices[i].vLifeTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vLifeTime.x, m_InstanceDesc.vLifeTime.y));
|
||||
|
||||
pParticleValues[i].vAniTime = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vAniTime.x, m_InstanceDesc.vAniTime.y));
|
||||
@@ -423,17 +423,17 @@ void CInstance_Model::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pVBInstance);
|
||||
SAFE_RELEASE(m_pVBInstance);
|
||||
|
||||
for (auto& pMesh : m_Meshes)
|
||||
Safe_Release(pMesh);
|
||||
SAFE_RELEASE(pMesh);
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
Safe_Release(pBone);
|
||||
SAFE_RELEASE(pBone);
|
||||
|
||||
Safe_Release(m_pComputeShader);
|
||||
Safe_Release(m_pConstantBuffer);
|
||||
Safe_Release(m_pParticleValueBuffer);
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pParticleValueBuffer);
|
||||
}
|
||||
|
||||
void CInstance_Model::Describe_Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Material.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Shader.h"
|
||||
@@ -60,9 +60,9 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const aiMaterial* pAI
|
||||
strcat_s(szTextureFilePath, szTextureFileName);
|
||||
strcat_s(szTextureFilePath, ".dds");
|
||||
|
||||
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고
|
||||
hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고
|
||||
if (FAILED(hr)) {
|
||||
memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
|
||||
memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
|
||||
strcat_s(szTextureFilePath, szTextureFileName);
|
||||
strcat_s(szTextureFilePath, szEXT);
|
||||
|
||||
@@ -327,13 +327,13 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
|
||||
{
|
||||
size_t startPos = mapRePos + strSearchString.length();
|
||||
|
||||
// 'MapRe' 뒤에 오는 경로 건너뛰기
|
||||
// 'MapRe' 뒤에 오는 경로 건너뛰기
|
||||
if (startPos < strTexturePath.length() &&
|
||||
(strTexturePath[startPos] == '\\' || strTexturePath[startPos] == '/')) {
|
||||
startPos++;
|
||||
}
|
||||
|
||||
// 'MapRe' 이후의 나머지 경로를 추출
|
||||
// 'MapRe' 이후의 나머지 경로를 추출
|
||||
strResultPath = strPrefix + strTexturePath.substr(startPos);
|
||||
}
|
||||
else
|
||||
@@ -350,19 +350,19 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
|
||||
}
|
||||
HRESULT CMaterial::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
||||
{
|
||||
// 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
|
||||
// 대신 리소스를 공유해야함
|
||||
// 텍스쳐를 저장하지 않고
|
||||
// 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
|
||||
// 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
|
||||
// 대신 리소스를 공유해야함
|
||||
// 텍스쳐를 저장하지 않고
|
||||
// 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
|
||||
for (int i = 0; i < AI_TEXTURE_TYPE_MAX; ++i) {
|
||||
_uint iNumSrv = (_uint)m_strPath[i].size();
|
||||
WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
|
||||
WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
|
||||
WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
|
||||
WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
|
||||
for (_uint j = 0; j < iNumSrv; ++j) {
|
||||
m_strPath[i][j].shrink_to_fit();
|
||||
_uint strLength = (_uint)(sizeof(_char) * m_strPath[i][j].length());
|
||||
WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
|
||||
WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
|
||||
WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
|
||||
WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -452,7 +452,7 @@ CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
|
||||
if (FAILED(pInstance->Initialize(pModelFilePath, _SaveMaterial)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMaterial");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mesh.h"
|
||||
#include "Model.h"
|
||||
#include "Bone.h"
|
||||
@@ -154,7 +154,7 @@ HRESULT CMesh::Render_Instance(_uint iNumInstance)
|
||||
|
||||
HRESULT CMesh::Initialize_Prototype(HANDLE hFile, DWORD& dwByte)
|
||||
{
|
||||
{ // 멤버변수
|
||||
{ // 멤버변수
|
||||
if (!ReadFile(hFile, &m_iMaterialIndex, sizeof(_uint), &dwByte, nullptr)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -535,7 +535,7 @@ CMesh* CMesh::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL
|
||||
|
||||
HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
||||
{
|
||||
{ // 멤버변수
|
||||
{ // 멤버변수
|
||||
WriteFile(hFile, &m_iMaterialIndex, sizeof(_uint), &dwByte, nullptr);
|
||||
WriteFile(hFile, &m_iNumVertexBuffers, sizeof(_uint), &dwByte, nullptr);
|
||||
WriteFile(hFile, &m_iNumVertices, sizeof(_uint), &dwByte, nullptr);
|
||||
@@ -556,7 +556,7 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
||||
}
|
||||
{ // Vertex Buffer
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
m_pVB->GetDesc(&VBDesc); // 버퍼 디스크립션 저장
|
||||
m_pVB->GetDesc(&VBDesc); // 버퍼 디스크립션 저장
|
||||
WriteFile(hFile, &VBDesc, sizeof(D3D11_BUFFER_DESC), &dwByte, nullptr);
|
||||
|
||||
D3D11_BUFFER_DESC StagingDesc{};
|
||||
@@ -570,7 +570,7 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
|
||||
if (FAILED(m_pDevice->CreateBuffer(&StagingDesc, nullptr, &pStaging)) || nullptr == pStaging) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pContext->CopyResource(pStaging, m_pVB); // 버퍼 복사
|
||||
m_pContext->CopyResource(pStaging, m_pVB); // 버퍼 복사
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE mapped{};
|
||||
m_pContext->Map(pStaging, 0, D3D11_MAP_READ, 0, &mapped);
|
||||
@@ -799,7 +799,7 @@ CMesh* CMesh::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL
|
||||
if (FAILED(pInstance->Initialize_Prototype(eType, pModel, _SaveMesh, PreTransformMatrix)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMesh");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1113,7 +1113,7 @@ CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MOD
|
||||
if (FAILED(pInstance->Initialize_Prototype(eType, pModelFilePath, PreTransformMatrix)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CModel");
|
||||
Safe_Release(pInstance);
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "RigidBody.h"
|
||||
#include "GameInstance.h"
|
||||
#include "GameObject.h"
|
||||
@@ -53,6 +53,25 @@ HRESULT CRigidBody::Render()
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
void CRigidBody::Set_Kinematic(_bool bKinematic)
|
||||
{
|
||||
static_cast<PSX::PxRigidDynamic*>(m_pRigidBody)->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic);
|
||||
}
|
||||
|
||||
void CRigidBody::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType)
|
||||
{
|
||||
PSX::PxVec3 vPxForce = {};
|
||||
XMStoreFloat3((_float3*)&vPxForce, vForce);
|
||||
static_cast<PSX::PxRigidDynamic*>(m_pRigidBody)->addForce(vPxForce, eType);
|
||||
}
|
||||
|
||||
void CRigidBody::Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType)
|
||||
{
|
||||
PSX::PxVec3 vPxTorque = {};
|
||||
XMStoreFloat3((_float3*)&vPxTorque, vDirection);
|
||||
static_cast<PSX::PxRigidDynamic*>(m_pRigidBody)->addForce(vPxTorque, eType);
|
||||
}
|
||||
|
||||
HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
|
||||
{
|
||||
m_eActorType = Desc.eType;
|
||||
@@ -63,11 +82,6 @@ HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
|
||||
m_fContactOffset = Desc.fContactOffset;
|
||||
m_vhalfGeometryInfo = Desc.vhalfGeometryInfo;
|
||||
m_fDensity = Desc.fDensity;
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(Add_DebugShape())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -102,13 +116,62 @@ HRESULT CRigidBody::Initialize(void* pArg)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Initialize_UserData();
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
Add_DebugShape();
|
||||
if (FAILED(Add_DebugShape())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRigidBody::Initialize_UserData()
|
||||
{
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case Engine::ACTOR::BOX:
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
break;
|
||||
case Engine::ACTOR::CAPSULE:
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
break;
|
||||
case Engine::ACTOR::SPHERE:
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
break;
|
||||
case Engine::ACTOR::PLANE:
|
||||
break;
|
||||
case Engine::ACTOR::TRIANGLEMESH:
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
break;
|
||||
case Engine::ACTOR::HEIGHTFIELD:
|
||||
break;
|
||||
case Engine::ACTOR::END:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody::Add_DebugShape()
|
||||
{
|
||||
@@ -161,6 +224,9 @@ CComponent* CRigidBody::Clone(void* pArg, CGameObject* pOwner)
|
||||
|
||||
void CRigidBody::Free()
|
||||
{
|
||||
if (nullptr != m_pRigidBody) {
|
||||
m_pRigidBody = nullptr;
|
||||
}
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pTransform);
|
||||
|
||||
@@ -8,55 +8,57 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
{
|
||||
/* dev-treadmill.tistory.com/158 */
|
||||
/* dev-treadmill.tistory.com/159 */
|
||||
// 기본적으로 아무 힘도 받지 않는, 주지 않는 놈임
|
||||
// kinematic 기반임
|
||||
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 }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
|
||||
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 };
|
||||
void* pCallback = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 CCollision_Callback 을 구현해야함
|
||||
|
||||
// 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨
|
||||
// _float fSlopeLimit = { 코사인각도 };
|
||||
|
||||
union
|
||||
{
|
||||
_float3 vBoxSize; // 박스는 AABB임
|
||||
CapsuleInfo tCapsuleInfo;
|
||||
};
|
||||
|
||||
|
||||
// Box인 경우 채워넣기
|
||||
_float3 vBoxSize = { 0.5f, 0.5f, 0.5f }; // CCT박스는 회전없는 AABB임
|
||||
|
||||
// Capsule인 경우 채워넣기
|
||||
_float fRadius;
|
||||
_float fHeight;
|
||||
PSX::PxCapsuleClimbingMode::Enum eClimbingMode; // 기본 (eEASY, stepOffset 값이 무제한), (eCONSTRAINED, stepOffset 값이 제대로 먹음)
|
||||
}Character_Controller_DESC;
|
||||
#pragma endregion
|
||||
private:
|
||||
CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CCharacter_Controller(const CCharacter_Controller& rhs);
|
||||
virtual ~CCharacter_Controller() = default;
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render() override;
|
||||
#endif
|
||||
|
||||
_float Get_ContactOffset() const { return m_pController->getContactOffset(); }
|
||||
void Set_ContactOffset(_float fValue) const { return m_pController->setContactOffset((PSX::PxF32)fValue); }
|
||||
void Set_ContactOffset(_float fValue) { return m_pController->setContactOffset((PSX::PxF32)fValue); }
|
||||
|
||||
void Move(_float fTimeDelta); // 이동
|
||||
void Move(_float fTimeDelta); // 이동 // 충돌보정만 있음,
|
||||
void Set_Position(_fvector vNewPos); // 순간이동
|
||||
_vector Get_Position();
|
||||
_float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 더 아래에 위치한다는 뜻 )
|
||||
_float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
|
||||
|
||||
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||
void Modify_Volume(_float3 fVolume);
|
||||
_float3 Get_Volume();
|
||||
|
||||
@@ -65,12 +67,10 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
PSX::PxController* m_pController = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
_bool m_bAutoStepping = { false };
|
||||
_float m_fSlopeLimit = { 0.f }; // cosf
|
||||
_float m_fSlopeLimit = { 0.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
PhsXUserData m_tagData = {};
|
||||
|
||||
|
||||
function<void()> m_funcHitCallback = { nullptr };
|
||||
function<void()> m_funcBehaviorCallback = { nullptr };
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};;
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
@@ -79,6 +79,10 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Debug_Initialize();
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
_bool Check_Overlap();
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
class CCollision_Callback final : public PSX::PxUserControllerHitReport, PSX::PxControllerBehaviorCallback
|
||||
{
|
||||
// 구현 예시
|
||||
// CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
|
||||
//
|
||||
// PxUserControllerHitReport = "무엇과 부딪혔는지 알려줌(이벤트 알림)"
|
||||
// PxControllerBehaviorCallback = "부딪힌 것에 대해 어떤 행동 정책을 쓸지 물어봄(질의)"
|
||||
// PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
|
||||
|
||||
public:
|
||||
NO_COPY(CCollision_Callback)
|
||||
CCollision_Callback();
|
||||
~CCollision_Callback()=default;
|
||||
|
||||
public:
|
||||
// PxUserControllerHitReport을(를) 통해 상속됨
|
||||
// 충돌알림!!
|
||||
// 주인이 되는 CCT가 이 물체에 대해 어떻게 반응해야 할까?
|
||||
virtual void onShapeHit(const PSX::PxControllerShapeHit& hit) override; // statc, rigid 등과 부딪힌 경우
|
||||
|
||||
virtual void onControllerHit(const PSX::PxControllersHit& hit) override; // 다른 CCT와 부딪힌 경우
|
||||
|
||||
virtual void onObstacleHit(const PSX::PxControllerObstacleHit& hit) override; // 사용자 정의 장애물과 부딪힌 경우
|
||||
|
||||
|
||||
// PxControllerBehaviorCallback을(를) 통해 상속됨
|
||||
// 충돌알림이 아닌, 행동정책 정해주기. CCT vs CCT는 지원안함
|
||||
// slopeLimit로 미끄러져 갈 수 있는지 없는지 이분법적인 계산 대신, 원하는 물체에 대해서만 미끄러운 표면으로 정의해줌
|
||||
// 주인이 되는 CCT가 이 물체에 대해 이 물체를 어떻게 해야 할까? -> (타고 올라갈까? Ride?) (미끄러져갈까? Slide?) ( 직접 내가 구현할까? user defined ride? )
|
||||
virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor) override;
|
||||
|
||||
virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxController& controller) override;
|
||||
|
||||
virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxObstacle& obstacle) override;
|
||||
};
|
||||
|
||||
@@ -73,11 +73,11 @@ enum aiTextureType {
|
||||
#endif // !EDITOR_PROJECT
|
||||
|
||||
enum class PHYSX_KIND {
|
||||
NOT_DEFINED = 0,
|
||||
CCTActor = 1,
|
||||
OBSTACLEActor = 2,
|
||||
BODY_STATIC = 3,
|
||||
BODY_DYNAMIC = 4,
|
||||
NOT_DEFINED,
|
||||
BODY_STATIC,
|
||||
BODY_DYNAMIC,
|
||||
CCTActor,
|
||||
OBSTACLEActor,
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -24,7 +24,7 @@ void Safe_Delete_Array(T& Pointer)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned long Safe_AddRef(T& pInstance)
|
||||
unsigned long SAFE_ADDREF(T& pInstance)
|
||||
{
|
||||
unsigned long dwRefCnt = 0;
|
||||
|
||||
@@ -47,6 +47,19 @@ unsigned long Safe_Release(T& pInstance)
|
||||
return dwRefCnt;
|
||||
}
|
||||
|
||||
static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix)
|
||||
{
|
||||
_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);
|
||||
return out;
|
||||
}
|
||||
|
||||
static void GUIHelpMarker(const char* desc)
|
||||
{
|
||||
GUI::SameLine();
|
||||
@@ -60,4 +73,4 @@ static void GUIHelpMarker(const char* desc)
|
||||
}
|
||||
}
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -140,4 +140,4 @@ constexpr unsigned int g_iMaxShadowHeight = 9216;
|
||||
s_pInstance = nullptr; \
|
||||
} \
|
||||
return iRefCnt; \
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,14 +315,18 @@ typedef struct tagVertexModelInstanceParticleDesc
|
||||
|
||||
|
||||
typedef struct tagPhsXUserData {
|
||||
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||
|
||||
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||
_uint iSubKind = UINT_MAX;
|
||||
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
|
||||
|
||||
@@ -180,16 +180,18 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
_bool isPicking(_float3* pOut);
|
||||
#pragma endregion
|
||||
#pragma region PhysX_Manager
|
||||
PSX::PxMaterial* Get_Material(_float3* vMatInfo);
|
||||
PSX::PxMaterial* Create_Material(_float3* vMatInfo);
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
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);
|
||||
void Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor);
|
||||
void Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor);
|
||||
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -20,8 +20,8 @@ class CPhysX_Manager final : public CBase
|
||||
// HRESULT Update_RegionOfInterest(); ( 충돌 컬링, 필터링도 검색해야함 )
|
||||
// Aggregate ( 충돌 그룹, 이 그룹끼리는 서로 충돌검사를 하지 않음, 지형, 레그돌 등 )
|
||||
|
||||
const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
|
||||
@@ -34,7 +34,8 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
void Update(_float fTimeDelta);
|
||||
void ClearScene();
|
||||
|
||||
void Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor);
|
||||
void Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CHARACTER_CONTROLLER
|
||||
@@ -54,8 +55,8 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
private:
|
||||
class CGameInstance* m_pGameInstance = { nullptr };
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
ID3D11DeviceContext* m_pContext = { nullptr };
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
|
||||
PSX::PxDefaultAllocator m_AllocatorCallBack = { }; // 피직스 동적할당자
|
||||
PSX::PxDefaultErrorCallback m_ErrorCallBack = { }; // 피직스 오류처리자
|
||||
@@ -83,7 +84,7 @@ class CPhysX_Manager final : public CBase
|
||||
HRESULT Connect_DebugServer();
|
||||
void Update_Kinematic();
|
||||
void Update_Dynamic_ActiveActors();
|
||||
void Update_Dynamic_AllActors();
|
||||
//void Update_Dynamic_AllActors();
|
||||
|
||||
public:
|
||||
static CPhysX_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "Transform.h"
|
||||
#include "VIBuffer_Rect.h"
|
||||
#include "VIBuffer_Cube.h"
|
||||
@@ -68,8 +68,8 @@ class CPrototype_Manager final : public CBase
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
//특정 타입의 컴포넌트들의 이름을 통한 콤보박스 , 이미지는 이미지 클립을
|
||||
//만들고 선택할 시에 내 ppOut에 클론하는 기능을 담당
|
||||
//특정 타입의 컴포넌트들의 이름을 통한 콤보박스 , 이미지는 이미지 클립을
|
||||
//만들고 선택할 시에 내 ppOut에 클론하는 기능을 담당
|
||||
|
||||
template<typename T>
|
||||
void Asset_Description(_uint iLevel, const _char* pComponentName, Engine::CComponent** ppOut, void* pDesc, class CGameObject* pOwner = nullptr, _wstring wstrGroupName = L"")
|
||||
@@ -80,7 +80,7 @@ class CPrototype_Manager final : public CBase
|
||||
for (auto& Pair : m_pAssets[iLevel])
|
||||
{
|
||||
|
||||
if (typeid(*Pair.second) == typeid(T)) // 같은 타입의 컴포넌트 였다면
|
||||
if (typeid(*Pair.second) == typeid(T)) // 같은 타입의 컴포넌트 였다면
|
||||
{
|
||||
strNames.push_back(CMyTools::ToString(Pair.first));
|
||||
|
||||
@@ -89,7 +89,7 @@ class CPrototype_Manager final : public CBase
|
||||
}
|
||||
}
|
||||
|
||||
if (typeid(CTexture) == typeid(T)) // 텍스쳐일 경우 이미지로 띄우기
|
||||
if (typeid(CTexture) == typeid(T)) // 텍스쳐일 경우 이미지로 띄우기
|
||||
{
|
||||
_int iIndex = {};
|
||||
|
||||
@@ -108,13 +108,13 @@ class CPrototype_Manager final : public CBase
|
||||
if (pTexture == nullptr)
|
||||
continue;
|
||||
|
||||
if (pTexture->Compare_GroupName(wstrGroupName) == false) // 그룹네임을 비교해서 같은 것만 띄울 수 있도록 한다 , Default시 L""
|
||||
if (pTexture->Compare_GroupName(wstrGroupName) == false) // 그룹네임을 비교해서 같은 것만 띄울 수 있도록 한다 , Default시 L""
|
||||
continue;
|
||||
|
||||
if (GUI::ImageButton(strName.c_str(), pTexture->Get_SRV(0), ImVec2(48, 48)))
|
||||
{
|
||||
if (*ppOut != nullptr)
|
||||
Safe_Release(*ppOut);
|
||||
SAFE_RELEASE(*ppOut);
|
||||
|
||||
|
||||
*ppOut = iter->second->Clone(pDesc, pOwner);
|
||||
@@ -125,7 +125,7 @@ class CPrototype_Manager final : public CBase
|
||||
pTexture->HoverName();
|
||||
|
||||
if ((iIndex++ + 1) % 4 != 0)
|
||||
GUI::SameLine(); // 같은 줄에 이어서
|
||||
GUI::SameLine(); // 같은 줄에 이어서
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class CPrototype_Manager final : public CBase
|
||||
static _int s_iCurrentItem = 0;
|
||||
static ImGuiTextFilter filter;
|
||||
|
||||
// 다른 어셋일 경우 콤보로 띄우기
|
||||
// 다른 어셋일 경우 콤보로 띄우기
|
||||
|
||||
if(GUI::BeginCombo(pComponentName, (s_iCurrentItem >= 0 && s_iCurrentItem < pComponentNames.size())
|
||||
? pComponentNames[s_iCurrentItem] : "NONE"))
|
||||
@@ -188,7 +188,7 @@ class CPrototype_Manager final : public CBase
|
||||
}
|
||||
|
||||
if (*ppOut != nullptr)
|
||||
Safe_Release(*ppOut);
|
||||
SAFE_RELEASE(*ppOut);
|
||||
|
||||
*ppOut = iter->second->Clone(pDesc, pOwner);
|
||||
}
|
||||
|
||||
@@ -21,9 +21,11 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
PXMATERIAL ePxMaterialTypes = { PXMATERIAL::DEFAULT };
|
||||
_float3 vMatInfo = { 0.5f, 0.5f, 0.6f }; // 피직스 객체의 속성 등
|
||||
_float fContactOffset = { 0.05f }; // 접촉 유격 오프셋
|
||||
|
||||
#pragma region DYNAMIC
|
||||
_float3 vhalfGeometryInfo; // 박스는 vSize, 캡슐은 radius, height로 씀
|
||||
_float fDensity = { 1000.f }; // 밀도, 실제 무게는 부피에 따라 달라짐
|
||||
|
||||
#pragma endregion
|
||||
#pragma region STATIC
|
||||
#pragma endregion
|
||||
@@ -34,7 +36,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
#pragma region DYNAMIC
|
||||
#pragma endregion
|
||||
#pragma region STATIC
|
||||
const _char* szMeshName = { };
|
||||
const _char* szMeshName = { };
|
||||
#pragma endregion
|
||||
}RIGIDBODY_DESC;
|
||||
|
||||
@@ -42,6 +44,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
CRigidBody(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRigidBody(const CRigidBody& rhs);
|
||||
virtual ~CRigidBody() = default;
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render()override;
|
||||
@@ -49,6 +52,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
|
||||
|
||||
ACTOR Get_Type() const { return m_eActorType; }
|
||||
PSX::PxActor* Get_Actor() const { return m_pRigidBody; }
|
||||
CTransform* Get_TransformPtr() const { return m_pTransform; }
|
||||
const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
|
||||
PXMATERIAL Get_MaterialType() const { return m_eMatType; }
|
||||
@@ -56,28 +60,37 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
_float Get_Density() const { return m_fDensity; }
|
||||
PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; }
|
||||
PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; }
|
||||
_float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
|
||||
_float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
|
||||
|
||||
|
||||
// 키네마틱은 transform으로 이동 ( simulate 전에 이동함 )
|
||||
// 키네마틱이 아닌 dynamic은 토크와 포스로 이동 ( simulate 후에 이동함 )
|
||||
void Set_Kinematic(_bool bKinematic);
|
||||
|
||||
|
||||
void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향
|
||||
void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향
|
||||
|
||||
private:
|
||||
ACTOR m_eActorType = ACTOR::END;
|
||||
PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = {};
|
||||
PXMATERIAL m_eMatType = { PXMATERIAL::END };
|
||||
_float m_fContactOffset = { 0.05f };
|
||||
const PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
|
||||
PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
|
||||
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
PhsXUserData m_tagData = {};
|
||||
|
||||
#pragma region DYNAMIC
|
||||
PSX::PxShapeFlags m_ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
|
||||
_float3 m_vMatInfo = {};
|
||||
_float3 m_vhalfGeometryInfo = {};
|
||||
_float3 m_vCenterOfMess = {}; // 회전축
|
||||
_float m_fDensity = { 1000.f };
|
||||
#pragma endregion
|
||||
#pragma region STATIC
|
||||
_wstring m_wstrMeshKey = { }; // 짝꿍 스태틱 메시의 triangleMesh 키
|
||||
_wstring m_wstrMeshKey = { }; // 짝꿍 스태틱 메시의 triangleMesh 키
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
@@ -86,6 +99,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
|
||||
HRESULT Initialize(void* pArg);
|
||||
HRESULT Initialize_UserData();
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user