[add] Terrain QuadTree LOD, Picking
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.0 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 524 KiB |
@@ -148,10 +148,10 @@ void CBuildingContainer::Describe_Entity()
|
||||
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
|
||||
{
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
/*if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
GUI::Text("----- Rotation ----");
|
||||
|
||||
@@ -26,12 +26,25 @@ void CLand::Update(_float fTimeDelta)
|
||||
//m_pTransformCom->Set_State(STATE::POSITION, XMLoadFloat4(&m_vPosition));
|
||||
|
||||
//GUI::End();
|
||||
|
||||
_float3 vPos = {};
|
||||
if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON))
|
||||
{
|
||||
if (m_pGameInstance->isPicking(&vPos))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GUI::Begin("TEEEEE");
|
||||
GUI::InputFloat3("Pos", (_float*)(&vPos));
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
void CLand::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
//m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
|
||||
HRESULT CLand::Render()
|
||||
@@ -76,7 +89,9 @@ HRESULT CLand::Initialize(void* pArg)
|
||||
if (FAILED(Ready_Components(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(66.f, 18.f, 96.f, 1.f));
|
||||
//m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(66.f, 18.f, 96.f, 1.f));
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f,0.f, 1.f));
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -105,9 +120,11 @@ HRESULT CLand::Bind_ShaderResources()
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
|
||||
CameraDesc.fFar = 500.f;
|
||||
CameraDesc.vEye = _float3(0.f, 10.f, -10.f);
|
||||
CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
|
||||
CameraDesc.fSpeedPerSec = 2.f;
|
||||
CameraDesc.fSpeedPerSec = 5.f;
|
||||
CameraDesc.pCameraKey = TEXT("Debug_Camera");
|
||||
CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f);
|
||||
CameraDesc.fMouseSensor = 0.1f;
|
||||
|
||||
@@ -1168,7 +1168,7 @@ HRESULT CLoader::Loading_For_MapViewer()
|
||||
m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다.");
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) {
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/T_C_Dun_Moss_D.png"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -1193,193 +1193,193 @@ HRESULT CLoader::Loading_For_MapViewer()
|
||||
vector<filesystem::path> ModelPrototypePath = {};
|
||||
|
||||
#pragma region HOGSMEADE
|
||||
/* Terrain*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
///* Terrain*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
/* TScrolls*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Collisions",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
///* TScrolls*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Collisions",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
/* 3BroomStick*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
///* 3BroomStick*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
/* Ollivanders*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
///* Ollivanders*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
/* Gatehouse*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Gatehouse\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
///* Gatehouse*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Gatehouse\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_QuidditchShop */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_HogsheadInn */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_Honeydukes */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_OwlPost */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_TeaShop */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_Zonkos */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_DB_GR */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_Potions */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Collisions",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* BLDG_Salon */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* Hengist_Tree */
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Vegetation\\Hengist_Tree",
|
||||
// ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Vegetation",
|
||||
// ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN A*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN B*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN C*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN E*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN F*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN G*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN H*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
///* GEN J*/
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Meshes",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
//if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Collision",
|
||||
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
/* BLDG_QuidditchShop */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
#pragma endregion
|
||||
|
||||
/* BLDG_HogsheadInn */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_Honeydukes */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_OwlPost */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_TeaShop */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_Zonkos */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_DB_GR */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_Potions */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Collisions",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* BLDG_Salon */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* Hengist_Tree */
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Vegetation\\Hengist_Tree",
|
||||
".bin", true, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Vegetation",
|
||||
".bin", true, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN A*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN B*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN C*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN E*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN F*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN G*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN H*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
/* GEN J*/
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Meshes",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Collision",
|
||||
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
|
||||
|
||||
m_strMessage = TEXT("쉐이더를(을) 로딩 중 입니다.");
|
||||
|
||||
m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다.");
|
||||
@@ -1392,7 +1392,7 @@ HRESULT CLoader::Loading_For_MapViewer()
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Terrain */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"),
|
||||
CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100))))
|
||||
CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "../Bin/Resources/Data/Map/Height.bmp", 257, 257))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_SkyBox */
|
||||
|
||||
@@ -218,7 +218,7 @@ void CMapElement_Interactable::Describe_Entity()
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>()->Get_XMWorldMatrix(), &m_vPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void CMapElement_Static::Describe_Entity()
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>()->Get_XMWorldMatrix(), &m_vPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ void CMapObject_Collision::Describe_Entity()
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>()->Get_XMWorldMatrix(), &m_vPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ void CMapObject_LOD::Describe_Entity()
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>()->Get_XMWorldMatrix(), &m_vPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,24 +33,30 @@ HRESULT CTerrain::Initialize(void* pArg)
|
||||
|
||||
void CTerrain::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
GUI::Begin("Picking Position");
|
||||
if (m_pGameInstance->Mouse_Pressing(0))
|
||||
{
|
||||
if (m_pGameInstance->isPicking(&m_vPickingPosition))
|
||||
{
|
||||
m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_vPickingPosition.y);
|
||||
}
|
||||
}
|
||||
|
||||
GUI::DragFloat3("Pos", (_float*)(&m_vPickingPosition));
|
||||
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
void CTerrain::Update(_float fTimeDelta)
|
||||
{
|
||||
GUI::Begin("Picking Position");
|
||||
if (m_pGameInstance->Mouse_Down(0))
|
||||
m_pVIBufferCom->Picking(m_pTransformCom, m_vPickingPosition);
|
||||
|
||||
GUI::DragFloat3("Pos", (_float*)(&m_vPickingPosition));
|
||||
GUI::End();
|
||||
m_pVIBufferCom->Culling(XMMatrixIdentity());
|
||||
}
|
||||
|
||||
void CTerrain::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
//if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
HRESULT CTerrain::Render()
|
||||
|
||||
@@ -34,6 +34,9 @@ class CLand final : public CGameObject
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
_float4 m_vPosition = {};
|
||||
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
_float4x4 m_ViewMatrix = {};
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
@@ -207,6 +207,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\ComputeShader.cpp" />
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
<ClCompile Include="..\Private\DebugDraw.cpp" />
|
||||
<ClCompile Include="..\private\QuadTree.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@@ -418,6 +419,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\Bounding_OBB.h" />
|
||||
<ClInclude Include="..\Public\Bounding_Sphere.h" />
|
||||
<ClInclude Include="..\public\FSM.h" />
|
||||
<ClInclude Include="..\public\QuadTree.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
</Filter>
|
||||
<Filter Include="02.Element\01.GameObject\Unit">
|
||||
<UniqueIdentifier>{a4560f1b-c4f4-4705-bbf8-6a60977d3211}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\01.GameObject\00.ContainerObject\01.PartObject">
|
||||
<UniqueIdentifier>{b3742605-653a-4bdf-bad9-329d993e7f52}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -277,6 +277,9 @@
|
||||
<Filter Include="02.Element\02.Component\02.VIBuffer\Trail">
|
||||
<UniqueIdentifier>{dae29f0c-1727-4423-a3ca-9ef27460520b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\02.VIBuffer\Terrain\QuadTree">
|
||||
<UniqueIdentifier>{d9f03f43-e9d1-4a50-b465-e1000462bd3e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -512,7 +515,7 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Unit.cpp">
|
||||
<Filter>02.Element\01.GameObject\Unit</Filter>
|
||||
</ClCompile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\VIBuffer_UI_Instance.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\UI_nstance</Filter>
|
||||
</ClCompile>
|
||||
@@ -525,6 +528,9 @@
|
||||
<ClCompile Include="..\Private\Trail.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Trail</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\QuadTree.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Terrain\QuadTree</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1126,7 +1132,7 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Unit.h">
|
||||
<Filter>02.Element\01.GameObject\Unit</Filter>
|
||||
</ClInclude>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\VIBuffer_UI_Instance.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\UI_nstance</Filter>
|
||||
</ClInclude>
|
||||
@@ -1139,6 +1145,9 @@
|
||||
<ClInclude Include="..\Public\Trail.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Trail</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\QuadTree.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Terrain\QuadTree</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mouse_Manager.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameInstance.h"
|
||||
@@ -50,7 +50,7 @@ HRESULT CMouse_Manager::Initialize()
|
||||
void CMouse_Manager::Update()
|
||||
{
|
||||
if (GetForegroundWindow() == m_ghWnd) {
|
||||
/* 뷰포트 마우스 좌표*/
|
||||
/* 뷰포트 마우스 좌표*/
|
||||
GetCursorPos(&m_ptCurrentMouseCur);
|
||||
|
||||
m_vMove = { _float(m_ptCurrentMouseCur.x - m_ptOldMouseCur.x), _float(m_ptCurrentMouseCur.y - m_ptOldMouseCur.y) , 0.f };
|
||||
@@ -106,22 +106,22 @@ void CMouse_Manager::Picking()
|
||||
_float4 vMousePos = {};
|
||||
POINT vViewPortMousePos = Get_MouseViewPortPos();
|
||||
|
||||
/* 뷰포트 좌표를 투영 스페이스 좌표로 바꾸는 작업 */
|
||||
/* 뷰포트 좌표를 투영 스페이스 좌표로 바꾸는 작업 */
|
||||
vMousePos.x = vViewPortMousePos.x / (m_iWinCX * 0.5f) - 1.f;
|
||||
vMousePos.y = vViewPortMousePos.y / -(m_iWinCY * 0.5f) + 1.f;
|
||||
vMousePos.z = 0.f; // 근평면상의 좌표이기 때문에 0
|
||||
vMousePos.w = 1.f; // W 나누기를 수행한 상태이기 때문에 1
|
||||
vMousePos.z = 0.f; // 근평면상의 좌표이기 때문에 0
|
||||
vMousePos.w = 1.f; // W 나누기를 수행한 상태이기 때문에 1
|
||||
|
||||
/* 투영스페이스 좌표 -> 뷰스페이스 좌표*/
|
||||
/* 투영스페이스 좌표 -> 뷰스페이스 좌표*/
|
||||
_matrix InverseProjectionMatrix = XMMatrixInverse(nullptr, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ));
|
||||
XMStoreFloat4(&vMousePos, XMVector4Transform(XMLoadFloat4(&vMousePos), InverseProjectionMatrix));
|
||||
|
||||
|
||||
/* 뷰스페이스 좌표 -> 월드 스페이스 좌표*/
|
||||
/* 뷰스페이스 좌표 -> 월드 스페이스 좌표*/
|
||||
_float3 vRayPos, vRayDir = {};
|
||||
|
||||
vRayPos = _float3{ 0.f,0.f,0.f }; // 뷰스페이스 상에서 카메라의 위치는 0,0,0
|
||||
vRayDir = _float3{ (_float)vMousePos.x, (_float)vMousePos.y, (_float)vMousePos.z }; // 레이의 방향벡터는 마우스위치에서 카메라 위치 뺀 값
|
||||
vRayPos = _float3{ 0.f,0.f,0.f }; // 뷰스페이스 상에서 카메라의 위치는 0,0,0
|
||||
vRayDir = _float3{ (_float)vMousePos.x, (_float)vMousePos.y, (_float)vMousePos.z }; // 레이의 방향벡터는 마우스위치에서 카메라 위치 뺀 값
|
||||
|
||||
_matrix InverseViewSpaceMatrix = XMMatrixInverse(nullptr, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW));
|
||||
|
||||
@@ -165,7 +165,7 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
|
||||
_bool isCollision;
|
||||
|
||||
_float fU, fV, fDist = {};
|
||||
|
||||
|
||||
isCollision = CMyTools::IntersectTri(XMLoadFloat3(&m_vRayPos[ENUM_CLASS(RAY::WORLD)]), XMLoadFloat3(&m_vRayDir[ENUM_CLASS(RAY::WORLD)]),
|
||||
XMLoadFloat3(&vPointA), XMLoadFloat3(&vPointB), XMLoadFloat3(&vPointC), fDist, fU, fV);
|
||||
|
||||
@@ -186,24 +186,24 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
|
||||
// const float cw = float(rc.right - rc.left);
|
||||
// const float ch = float(rc.bottom - rc.top);
|
||||
//
|
||||
// // 2) 뷰/프로젝션: 화면 좌상단(0,0) ~ (cw,ch), Y-다운
|
||||
// // 2) 뷰/프로젝션: 화면 좌상단(0,0) ~ (cw,ch), Y-다운
|
||||
// XMFLOAT4X4 view{}, proj{};
|
||||
// XMStoreFloat4x4(&view, XMMatrixIdentity());
|
||||
// XMStoreFloat4x4(&proj, XMMatrixOrthographicOffCenterLH(0.f, cw, ch, 0.f, 0.f, 1.f));
|
||||
//
|
||||
// // 3) 마우스 좌표 (클라이언트 좌표로 변환)
|
||||
// // 3) 마우스 좌표 (클라이언트 좌표로 변환)
|
||||
// POINT pt{}; GetCursorPos(&pt); ScreenToClient(m_ghWnd, &pt);
|
||||
//
|
||||
// // 4) 월드 행렬: 30x30 스케일 + 위치(픽셀 센터 정렬: +0.5f)
|
||||
// // 4) 월드 행렬: 30x30 스케일 + 위치(픽셀 센터 정렬: +0.5f)
|
||||
// XMFLOAT4X4 world{};
|
||||
// world._11 = 30.f; // width
|
||||
// world._22 = 30.f; // height
|
||||
// world._33 = 1.f; // keep
|
||||
// world._44 = 1.f; // keep
|
||||
// world._41 = floorf((float)pt.x) + 0.5f; // translation X (row-vector 규약)
|
||||
// world._41 = floorf((float)pt.x) + 0.5f; // translation X (row-vector 규약)
|
||||
// world._42 = floorf((float)pt.y) + 0.5f; // translation Y
|
||||
//
|
||||
// // 5) 바인딩
|
||||
// // 5) 바인딩
|
||||
// m_pShader->Bind_Matrix("g_WorldMatrix", &world);
|
||||
// m_pShader->Bind_Matrix("g_ViewMatrix", &view);
|
||||
// m_pShader->Bind_Matrix("g_ProjMatrix", &proj);
|
||||
@@ -211,9 +211,9 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
|
||||
// m_pShader->Bind_SRV("g_Texture", m_pMouseSRV);
|
||||
// m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(float));
|
||||
//
|
||||
// // 6) 상태 셋업(권장)
|
||||
// // 6) 상태 셋업(권장)
|
||||
// // - DepthTest OFF / DepthWrite OFF (UI)
|
||||
// // - AlphaBlend ON (필요시)
|
||||
// // - AlphaBlend ON (필요시)
|
||||
// m_pShader->Begin(2);
|
||||
// m_pRect->Bind_Resources();
|
||||
// m_pRect->Render();
|
||||
|
||||
@@ -66,9 +66,12 @@ _bool CPicking::isPicking(_float3* pOut)
|
||||
|
||||
_uint iMouseIndex = ptMouse.y * m_iNumPixelW + ptMouse.x;
|
||||
|
||||
if (0.f == m_pPixels[iMouseIndex].w)
|
||||
if (iMouseIndex > m_iNumPixelW * m_iNumPixelH)
|
||||
return false;
|
||||
|
||||
if (0.f == m_pPixels[iMouseIndex].w)
|
||||
return false;
|
||||
|
||||
_float3 vMousePos = _float3(0.f, 0.f, 0.f);
|
||||
|
||||
vMousePos.x = ptMouse.x / (m_iNumPixelW * 0.5f) - 1.f;
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
#include "pch.h"
|
||||
#include "QuadTree.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CQuadTree::CQuadTree()
|
||||
{
|
||||
}
|
||||
|
||||
void CQuadTree::Culling(CGameInstance* pGameInstance, const _float3* pVertexPositions, _uint* pIndices, _uint* pNumIndices)
|
||||
{
|
||||
/* 해당 노드에서 그릴건지 확인 */
|
||||
if (nullptr == m_pChildren[CORNER_LT] ||
|
||||
true == isDraw(pGameInstance, pVertexPositions))
|
||||
{
|
||||
_bool isDraw[NEIGHBOR_END] = { true, true, true, true };
|
||||
|
||||
/* 이웃노드가 그려지는지 확인 */
|
||||
for (size_t i = 0; i < NEIGHBOR_END; i++)
|
||||
{
|
||||
if (nullptr != m_pNeighbors[i])
|
||||
isDraw[i] = m_pNeighbors[i]->isDraw(pGameInstance, pVertexPositions);
|
||||
|
||||
}
|
||||
|
||||
/* 점들이 절두체 안에 있는지 확인 */
|
||||
_bool isIn[4] = {
|
||||
pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[0]]), 0.f),
|
||||
pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[1]]), 0.f),
|
||||
pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[2]]), 0.f),
|
||||
pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[3]]), 0.f),
|
||||
};
|
||||
|
||||
/* 이웃하는 노드가 모두 그려진다면 */
|
||||
if (true == isDraw[NEIGHBOR_LEFT] &&
|
||||
true == isDraw[NEIGHBOR_TOP] &&
|
||||
true == isDraw[NEIGHBOR_RIGHT] &&
|
||||
true == isDraw[NEIGHBOR_BOTTOM])
|
||||
{
|
||||
/* 삼각형의 한점이라도 절두체 안에 있다면 그린다(인덱스를 넣어주고 NumIndices++)*/
|
||||
|
||||
if (true == isIn[0] ||
|
||||
true == isIn[1] ||
|
||||
true == isIn[2])
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[0];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[1];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[2];
|
||||
}
|
||||
|
||||
if (true == isIn[0] ||
|
||||
true == isIn[2] ||
|
||||
true == isIn[3])
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[0];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[2];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[3];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 이웃 노드와 크기 차이가 있을 때 */
|
||||
_uint iLC, iTC, iRC, iBC;
|
||||
|
||||
iLC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_LB]) >> 1;
|
||||
iTC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RT]) >> 1;
|
||||
iRC = (m_iCorners[CORNER_RT] + m_iCorners[CORNER_RB]) >> 1;
|
||||
iBC = (m_iCorners[CORNER_LB] + m_iCorners[CORNER_RB]) >> 1;
|
||||
|
||||
|
||||
/* 왼쪽 아래 확인 */
|
||||
if (true == isIn[0] ||
|
||||
true == isIn[2] ||
|
||||
true == isIn[3])
|
||||
{
|
||||
/* 왼쪽 이웃 확인 (같은 크기로 그려지는지)*/
|
||||
if (false == isDraw[NEIGHBOR_LEFT])
|
||||
{
|
||||
/* 아닐때 삼각형 분할 */
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = iLC;
|
||||
|
||||
pIndices[(*pNumIndices)++] = iLC;
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 같은 크기면 인접한 큰 삼각형으로(사각형의 1/4 )*/
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
|
||||
}
|
||||
|
||||
if (false == isDraw[NEIGHBOR_BOTTOM])
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = iBC;
|
||||
|
||||
pIndices[(*pNumIndices)++] = iBC;
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
|
||||
}
|
||||
else
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
|
||||
}
|
||||
}
|
||||
|
||||
/* 오른쪽 위 확인*/
|
||||
if (true == isIn[0] ||
|
||||
true == isIn[1] ||
|
||||
true == isIn[2])
|
||||
{
|
||||
if (false == isDraw[NEIGHBOR_TOP])
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
|
||||
pIndices[(*pNumIndices)++] = iTC;
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = iTC;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
|
||||
}
|
||||
else
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
}
|
||||
|
||||
if (false == isDraw[NEIGHBOR_RIGHT])
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
|
||||
pIndices[(*pNumIndices)++] = iRC;
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
pIndices[(*pNumIndices)++] = iRC;
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
|
||||
}
|
||||
else
|
||||
{
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
|
||||
pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
|
||||
pIndices[(*pNumIndices)++] = m_iCenter;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 현재 사각형이 절두체 안에 있다면 자식 호출 */
|
||||
/* Range 는 사각형의 중심에서 꼭짓점까지의 거리 */
|
||||
_float fRange = XMVector3Length(XMLoadFloat3(&pVertexPositions[m_iCorners[CORNER_LT]]) - XMLoadFloat3(&pVertexPositions[m_iCenter])).m128_f32[0];
|
||||
|
||||
if (true == pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCenter]), fRange))
|
||||
{
|
||||
for (size_t i = 0; i < CORNER_END; i++)
|
||||
{
|
||||
if (nullptr != m_pChildren[i])
|
||||
m_pChildren[i]->Culling(pGameInstance, pVertexPositions, pIndices, pNumIndices);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CQuadTree::SetUp_Neighbors()
|
||||
{
|
||||
if (nullptr == m_pChildren[CORNER_LT]->m_pChildren[CORNER_LT])
|
||||
return;
|
||||
|
||||
/* 해당 위치의 child의 neighbor에 포인터를 저장*/
|
||||
m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pChildren[CORNER_RT];
|
||||
m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pChildren[CORNER_LB];
|
||||
|
||||
m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_LEFT] = m_pChildren[CORNER_LT];
|
||||
m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pChildren[CORNER_RB];
|
||||
|
||||
m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_LEFT] = m_pChildren[CORNER_LB];
|
||||
m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_TOP] = m_pChildren[CORNER_RT];
|
||||
|
||||
m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pChildren[CORNER_RB];
|
||||
m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_TOP] = m_pChildren[CORNER_LT];
|
||||
|
||||
/* 다른 부모의 자식인 인접한 이웃을 설정 */
|
||||
if (nullptr != m_pNeighbors[NEIGHBOR_LEFT])
|
||||
{
|
||||
m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_LEFT] = m_pNeighbors[NEIGHBOR_LEFT]->m_pChildren[CORNER_RT];
|
||||
m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_LEFT] = m_pNeighbors[NEIGHBOR_LEFT]->m_pChildren[CORNER_RB];
|
||||
}
|
||||
|
||||
if (nullptr != m_pNeighbors[NEIGHBOR_TOP])
|
||||
{
|
||||
m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_TOP] = m_pNeighbors[NEIGHBOR_TOP]->m_pChildren[CORNER_LB];
|
||||
m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_TOP] = m_pNeighbors[NEIGHBOR_TOP]->m_pChildren[CORNER_RB];
|
||||
}
|
||||
|
||||
if (nullptr != m_pNeighbors[NEIGHBOR_RIGHT])
|
||||
{
|
||||
m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pNeighbors[NEIGHBOR_RIGHT]->m_pChildren[CORNER_LT];
|
||||
m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pNeighbors[NEIGHBOR_RIGHT]->m_pChildren[CORNER_LB];
|
||||
}
|
||||
|
||||
if (nullptr != m_pNeighbors[NEIGHBOR_BOTTOM])
|
||||
{
|
||||
m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pNeighbors[NEIGHBOR_BOTTOM]->m_pChildren[CORNER_LT];
|
||||
m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pNeighbors[NEIGHBOR_BOTTOM]->m_pChildren[CORNER_RT];
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CORNER_END; i++)
|
||||
{
|
||||
m_pChildren[i]->SetUp_Neighbors();
|
||||
}
|
||||
}
|
||||
|
||||
_bool CQuadTree::Picking(CGameInstance* pGameInstance, const _float3* pVertexPositions, _float3& Out, _fmatrix WorldMatrix)
|
||||
{
|
||||
_bool isIn = { false };
|
||||
|
||||
if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]],pVertexPositions[m_iCorners[CORNER_RT]],pVertexPositions[m_iCorners[CORNER_RB]], Out))
|
||||
{
|
||||
if (nullptr == m_pChildren[CORNER_LT])
|
||||
{
|
||||
XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
|
||||
return true;
|
||||
}
|
||||
isIn = true;
|
||||
}
|
||||
|
||||
if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RB]], pVertexPositions[m_iCorners[CORNER_LB]], Out))
|
||||
{
|
||||
if (nullptr == m_pChildren[CORNER_LT])
|
||||
{
|
||||
XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
|
||||
return true;
|
||||
}
|
||||
isIn = true;
|
||||
}
|
||||
|
||||
if (isIn)
|
||||
{
|
||||
for (_uint i = 0; i < CORNER_END; ++i)
|
||||
{
|
||||
if (m_pChildren[i]->Picking(pGameInstance, pVertexPositions, Out, WorldMatrix))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_bool CQuadTree::Set_Y(CGameInstance* pGameInstance, const _float3* pVertexPositions, VTXNORTEX* pVertices, _fmatrix WorldMatrix, _float fY)
|
||||
{
|
||||
_bool isIn = { false };
|
||||
_float3 Out = {};
|
||||
if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RT]], pVertexPositions[m_iCorners[CORNER_RB]], Out))
|
||||
{
|
||||
if (nullptr == m_pChildren[CORNER_LT])
|
||||
{
|
||||
pVertices[m_iCorners[CORNER_LT]].vPosition.y = fY;
|
||||
pVertices[m_iCorners[CORNER_RT]].vPosition.y = fY;
|
||||
pVertices[m_iCorners[CORNER_RB]].vPosition.y = fY;
|
||||
|
||||
XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
|
||||
return true;
|
||||
}
|
||||
isIn = true;
|
||||
}
|
||||
|
||||
if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RB]], pVertexPositions[m_iCorners[CORNER_LB]], Out))
|
||||
{
|
||||
if (nullptr == m_pChildren[CORNER_LT])
|
||||
{
|
||||
pVertices[m_iCorners[CORNER_LT]].vPosition.y = fY;
|
||||
pVertices[m_iCorners[CORNER_RB]].vPosition.y = fY;
|
||||
pVertices[m_iCorners[CORNER_LB]].vPosition.y = fY;
|
||||
|
||||
XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
|
||||
return true;
|
||||
}
|
||||
isIn = true;
|
||||
}
|
||||
|
||||
if (isIn)
|
||||
{
|
||||
for (_uint i = 0; i < CORNER_END; ++i)
|
||||
{
|
||||
if (m_pChildren[i]->Set_Y(pGameInstance, pVertexPositions, pVertices, WorldMatrix, fY))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_bool CQuadTree::isDraw(CGameInstance* pGameInstance, const _float3* pVertexPositions)
|
||||
{
|
||||
_vector vCamPos = XMLoadFloat4(pGameInstance->Get_CamPosition());
|
||||
_vector vCenter = XMLoadFloat3(&pVertexPositions[m_iCenter]);
|
||||
|
||||
if (m_iCorners[CORNER_RT] - m_iCorners[CORNER_LT] < XMVectorGetX(XMVector3Length(vCamPos - vCenter)) * 0.2f)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT CQuadTree::Initialize(_uint iLT, _uint iRT, _uint iRB, _uint iLB)
|
||||
{
|
||||
m_iCorners[CORNER_LT] = iLT;
|
||||
m_iCorners[CORNER_RT] = iRT;
|
||||
m_iCorners[CORNER_RB] = iRB;
|
||||
m_iCorners[CORNER_LB] = iLB;
|
||||
|
||||
/* 길이가 1일때 트리 최하위 */
|
||||
if (1 == m_iCorners[CORNER_RT] - m_iCorners[CORNER_LT])
|
||||
return S_OK;
|
||||
|
||||
/* 중간 점들 인덱스 구하기 */
|
||||
m_iCenter = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RB]) >> 1;
|
||||
|
||||
_uint iLC, iTC, iRC, iBC;
|
||||
|
||||
iLC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_LB]) >> 1;
|
||||
iTC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RT]) >> 1;
|
||||
iRC = (m_iCorners[CORNER_RT] + m_iCorners[CORNER_RB]) >> 1;
|
||||
iBC = (m_iCorners[CORNER_LB] + m_iCorners[CORNER_RB]) >> 1;
|
||||
|
||||
/* 점들을 이용해서 하위 트리를 만든다 */
|
||||
m_pChildren[CORNER_LT] = CQuadTree::Create(m_iCorners[CORNER_LT], iTC, m_iCenter, iLC);
|
||||
m_pChildren[CORNER_RT] = CQuadTree::Create(iTC, m_iCorners[CORNER_RT], iRC, m_iCenter);
|
||||
m_pChildren[CORNER_RB] = CQuadTree::Create(m_iCenter, iRC, m_iCorners[CORNER_RB], iBC);
|
||||
m_pChildren[CORNER_LB] = CQuadTree::Create(iLC, m_iCenter, iBC, m_iCorners[CORNER_LB]);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CQuadTree* CQuadTree::Create(_uint iLT, _uint iRT, _uint iRB, _uint iLB)
|
||||
{
|
||||
CQuadTree* pInstance = new CQuadTree();
|
||||
|
||||
if (FAILED(pInstance->Initialize(iLT, iRT, iRB, iLB)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CQuadTree");
|
||||
Safe_Release(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CQuadTree::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
for (auto& pChild : m_pChildren)
|
||||
Safe_Release(pChild);
|
||||
|
||||
}
|
||||
@@ -1,143 +1,154 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "VIBuffer_Terrain.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
#include "QuadTree.h"
|
||||
|
||||
CVIBuffer_Terrain::CVIBuffer_Terrain(ID3D11Device * pDevice, ID3D11DeviceContext * pContext)
|
||||
CVIBuffer_Terrain::CVIBuffer_Terrain(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CVIBuffer{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CVIBuffer_Terrain::CVIBuffer_Terrain(CVIBuffer_Terrain& rhs)
|
||||
:CVIBuffer(rhs),
|
||||
m_iNumVerticesX{ rhs.m_iNumVerticesX },
|
||||
m_iNumVerticesZ{ rhs.m_iNumVerticesZ }
|
||||
CVIBuffer_Terrain::CVIBuffer_Terrain(const CVIBuffer_Terrain& rhs)
|
||||
: CVIBuffer(rhs)
|
||||
, m_iNumVerticesX{ rhs.m_iNumVerticesX }
|
||||
, m_iNumVerticesZ{ rhs.m_iNumVerticesZ }
|
||||
, m_pQuadTree{ rhs.m_pQuadTree }
|
||||
{
|
||||
Safe_AddRef(m_pQuadTree);
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ)
|
||||
{
|
||||
m_bChange = { false };
|
||||
|
||||
m_iNumVerticesX = iSizeX;
|
||||
m_iNumVerticesZ = iSizeZ;
|
||||
_ulong dwByte = {};
|
||||
HANDLE hFile = CreateFile(CMyTools::ToWstring(pFilePath).c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
|
||||
BITMAPFILEHEADER fh{};
|
||||
BITMAPINFOHEADER ih{};
|
||||
|
||||
ReadFile(hFile, &fh, sizeof fh, &dwByte, nullptr);
|
||||
ReadFile(hFile, &ih, sizeof ih, &dwByte, nullptr);
|
||||
|
||||
m_iNumVerticesX = ih.biWidth + 1;//iSizeX;
|
||||
m_iNumVerticesZ = ih.biHeight + 1;//iSizeZ;
|
||||
m_iNumVertices = m_iNumVerticesX * m_iNumVerticesZ;
|
||||
|
||||
m_pVertexPositions = new _float3[m_iNumVertices];
|
||||
ZeroMemory(m_pVertexPositions, sizeof(_float3) * m_iNumVertices);
|
||||
|
||||
//if (FAILED(Load_HeightFile(pFilePath)))
|
||||
// return E_FAIL;
|
||||
|
||||
m_iNumVertexBuffers = 1;
|
||||
m_iVertexStride = sizeof(VTXNORTEX);
|
||||
|
||||
_uint* pPixels = new _uint[m_iNumVertices];
|
||||
ZeroMemory(pPixels, sizeof(_uint) * m_iNumVertices);
|
||||
|
||||
ReadFile(hFile, pPixels, sizeof(_uint) * ih.biHeight * ih.biWidth, &dwByte, nullptr);
|
||||
|
||||
m_iNumVertexBuffers = 1;
|
||||
|
||||
m_iVertexStride = sizeof(VTXNORTEX);
|
||||
|
||||
m_iNumIndices = (m_iNumVerticesX - 1) * (m_iNumVerticesZ - 1) * 2 * 3;
|
||||
m_iIndexStride = 4;
|
||||
|
||||
m_eIndexFormat = DXGI_FORMAT_R32_UINT;
|
||||
m_ePrimitive = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
|
||||
#pragma region VETEX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc = {};
|
||||
#pragma region VERTEX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
|
||||
VBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.Usage = D3D11_USAGE_STAGING;
|
||||
VBDesc.BindFlags = 0;//D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.StructureByteStride = m_iVertexStride;
|
||||
VBDesc.CPUAccessFlags = 0;
|
||||
VBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ;
|
||||
VBDesc.MiscFlags = 0;
|
||||
|
||||
VTXNORTEX* pVertices = new VTXNORTEX[m_iNumVertices];
|
||||
ZeroMemory(pVertices, sizeof(VTXNORTEX) * m_iNumVertices);
|
||||
|
||||
for (_uint i = 0; i < m_iNumVerticesZ; ++i)
|
||||
{
|
||||
for (_uint j = 0; j < m_iNumVerticesX; ++j)
|
||||
{
|
||||
_uint iIndex = j + i * m_iNumVerticesX;
|
||||
m_pVertexPositions = new _float3[m_iNumVertices];
|
||||
ZeroMemory(m_pVertexPositions, sizeof(_float3) * m_iNumVertices);
|
||||
|
||||
m_pVertexPositions[iIndex] = pVertices[iIndex].vPosition = _float3((_float)j, 0.f, (_float)i);
|
||||
for (_uint i = 0; i < m_iNumVerticesZ; i++)
|
||||
{
|
||||
for (_uint j = 0; j < m_iNumVerticesX; j++)
|
||||
{
|
||||
_uint iIndex = i * m_iNumVerticesX + j;
|
||||
|
||||
m_pVertexPositions[iIndex] = pVertices[iIndex].vPosition = _float3((_float)j, (_float)(pPixels[iIndex] & 0x000000ff) / 5.f, (_float)i);
|
||||
pVertices[iIndex].vNormal = _float3(0.f, 0.f, 0.f);
|
||||
pVertices[iIndex].vTexcoord = _float2(j / (m_iNumVerticesX - 1.f), i / (m_iNumVerticesZ - 1.f));
|
||||
}
|
||||
}
|
||||
D3D11_SUBRESOURCE_DATA InitVBData = {};
|
||||
InitVBData.pSysMem = pVertices;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA InitialVBData{};
|
||||
InitialVBData.pSysMem = pVertices;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region INDEX_BUFFER
|
||||
D3D11_BUFFER_DESC IBDesc = {};
|
||||
IBDesc.ByteWidth = m_iNumIndices * m_iIndexStride;
|
||||
IBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
D3D11_BUFFER_DESC IBDesc{};
|
||||
IBDesc.ByteWidth = m_iIndexStride * m_iNumIndices;
|
||||
IBDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
IBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
IBDesc.StructureByteStride = m_iIndexStride;
|
||||
IBDesc.CPUAccessFlags = 0;
|
||||
IBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
IBDesc.MiscFlags = 0;
|
||||
|
||||
|
||||
_uint* pIndices = new _uint[m_iNumIndices];
|
||||
ZeroMemory(pIndices, sizeof(_uint) * m_iNumIndices);
|
||||
|
||||
_uint iNumIndex = {};
|
||||
_uint iCountZ = m_iNumVerticesZ - 1;
|
||||
_uint iCountX = m_iNumVerticesX - 1;
|
||||
for (_uint i = 0; i < iCountZ; ++i)
|
||||
{
|
||||
for (_uint j = 0; j < iCountX; ++j)
|
||||
{
|
||||
_uint iIndex = j + i * m_iNumVerticesX;
|
||||
_uint iNumIndices = {};
|
||||
|
||||
_uint Indices[4] = {
|
||||
for (_uint i = 0; i < m_iNumVerticesZ - 1; i++)
|
||||
{
|
||||
for (_uint j = 0; j < m_iNumVerticesX - 1; j++)
|
||||
{
|
||||
_uint iIndex = i * m_iNumVerticesX + j;
|
||||
|
||||
_uint iIndices[4] = {
|
||||
iIndex + m_iNumVerticesX,
|
||||
iIndex + m_iNumVerticesX + 1,
|
||||
iIndex + 1,
|
||||
iIndex,
|
||||
iIndex
|
||||
};
|
||||
|
||||
pIndices[iNumIndex++] = Indices[0];
|
||||
pIndices[iNumIndex++] = Indices[1];
|
||||
pIndices[iNumIndex++] = Indices[2];
|
||||
_vector vSourDir, vDestDir, vNormal;
|
||||
|
||||
_vector vSrc, vDst, vNormal;
|
||||
pIndices[iNumIndices++] = iIndices[0];
|
||||
pIndices[iNumIndices++] = iIndices[1];
|
||||
pIndices[iNumIndices++] = iIndices[2];
|
||||
|
||||
vSrc = XMLoadFloat3(&pVertices[Indices[1]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
|
||||
vDst = XMLoadFloat3(&pVertices[Indices[2]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
|
||||
vSourDir = XMLoadFloat3(&pVertices[iIndices[1]].vPosition) - XMLoadFloat3(&pVertices[iIndices[0]].vPosition);
|
||||
vDestDir = XMLoadFloat3(&pVertices[iIndices[2]].vPosition) - XMLoadFloat3(&pVertices[iIndices[1]].vPosition);
|
||||
vNormal = XMVector3Normalize(XMVector3Cross(vSourDir, vDestDir));
|
||||
|
||||
vNormal = XMVector3Normalize(XMVector3Cross(vSrc, vDst));
|
||||
XMStoreFloat3(&pVertices[iIndices[0]].vNormal, XMLoadFloat3(&pVertices[iIndices[0]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[iIndices[1]].vNormal, XMLoadFloat3(&pVertices[iIndices[1]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[iIndices[2]].vNormal, XMLoadFloat3(&pVertices[iIndices[2]].vNormal) + vNormal);
|
||||
|
||||
XMStoreFloat3(&pVertices[Indices[0]].vNormal, XMLoadFloat3(&pVertices[Indices[0]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[Indices[1]].vNormal, XMLoadFloat3(&pVertices[Indices[1]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[Indices[2]].vNormal, XMLoadFloat3(&pVertices[Indices[2]].vNormal) + vNormal);
|
||||
pIndices[iNumIndices++] = iIndices[0];
|
||||
pIndices[iNumIndices++] = iIndices[2];
|
||||
pIndices[iNumIndices++] = iIndices[3];
|
||||
|
||||
pIndices[iNumIndex++] = Indices[0];
|
||||
pIndices[iNumIndex++] = Indices[2];
|
||||
pIndices[iNumIndex++] = Indices[3];
|
||||
vSourDir = XMLoadFloat3(&pVertices[iIndices[2]].vPosition) - XMLoadFloat3(&pVertices[iIndices[0]].vPosition);
|
||||
vDestDir = XMLoadFloat3(&pVertices[iIndices[3]].vPosition) - XMLoadFloat3(&pVertices[iIndices[2]].vPosition);
|
||||
vNormal = XMVector3Normalize(XMVector3Cross(vSourDir, vDestDir));
|
||||
|
||||
vSrc = XMLoadFloat3(&pVertices[Indices[2]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
|
||||
vDst = XMLoadFloat3(&pVertices[Indices[3]].vPosition) - XMLoadFloat3(&pVertices[Indices[2]].vPosition);
|
||||
|
||||
vNormal = XMVector3Normalize(XMVector3Cross(vSrc, vDst));
|
||||
|
||||
XMStoreFloat3(&pVertices[Indices[0]].vNormal, XMLoadFloat3(&pVertices[Indices[0]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[Indices[2]].vNormal, XMLoadFloat3(&pVertices[Indices[2]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[Indices[3]].vNormal, XMLoadFloat3(&pVertices[Indices[3]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[iIndices[0]].vNormal, XMLoadFloat3(&pVertices[iIndices[0]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[iIndices[2]].vNormal, XMLoadFloat3(&pVertices[iIndices[2]].vNormal) + vNormal);
|
||||
XMStoreFloat3(&pVertices[iIndices[3]].vNormal, XMLoadFloat3(&pVertices[iIndices[3]].vNormal) + vNormal);
|
||||
}
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||
for (size_t i = 0; i < m_iNumVertices; i++)
|
||||
{
|
||||
XMStoreFloat3(&pVertices[i].vNormal, XMVector3Normalize(XMLoadFloat3(&pVertices[i].vNormal)));
|
||||
XMStoreFloat3(&pVertices[i].vNormal,
|
||||
XMVector3Normalize(XMLoadFloat3(&pVertices[i].vNormal)));
|
||||
}
|
||||
|
||||
D3D11_SUBRESOURCE_DATA InitIBData = {};
|
||||
InitIBData.pSysMem = pIndices;
|
||||
D3D11_SUBRESOURCE_DATA InitialIBData{};
|
||||
InitialIBData.pSysMem = pIndices;
|
||||
#pragma endregion
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitVBData, &m_pVB)))
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitialVBData, &m_pVB)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &InitIBData, &m_pIB)))
|
||||
if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &InitialIBData, &m_pIB)))
|
||||
return E_FAIL;
|
||||
|
||||
Safe_Delete_Array(pVertices);
|
||||
@@ -145,7 +156,11 @@ HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath, _uint iS
|
||||
|
||||
Safe_Delete_Array(pPixels);
|
||||
|
||||
#pragma endregion
|
||||
m_pQuadTree = CQuadTree::Create(m_iNumVerticesX * m_iNumVerticesZ - m_iNumVerticesX, m_iNumVerticesX * m_iNumVerticesZ - 1, m_iNumVerticesX - 1, 0);
|
||||
if (nullptr == m_pQuadTree)
|
||||
return E_FAIL;
|
||||
|
||||
m_pQuadTree->SetUp_Neighbors();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -155,76 +170,84 @@ HRESULT CVIBuffer_Terrain::Initialize(void* pArg)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_bool CVIBuffer_Terrain::Picking(CTransform* pTransform, _float3& pOut)
|
||||
_bool CVIBuffer_Terrain::Picking(_fmatrix WorldMatrix, _float3* pOut)
|
||||
{
|
||||
_matrix WorldMatrixInv = pTransform->Get_WorldMatrixInv();
|
||||
_matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
|
||||
|
||||
m_pGameInstance->Ray_WorldToLocal(&WorldMatrixInv);
|
||||
|
||||
_uint iNumIndices = {};
|
||||
|
||||
for (_uint i = 0; i < m_iNumVerticesZ - 1; i++)
|
||||
{
|
||||
for (_uint j = 0; j < m_iNumVerticesX - 1; j++)
|
||||
{
|
||||
_uint iIndex = i * m_iNumVerticesX + j;
|
||||
|
||||
_uint iIndices[4] = {
|
||||
iIndex + m_iNumVerticesX,
|
||||
iIndex + m_iNumVerticesX + 1,
|
||||
iIndex + 1,
|
||||
iIndex
|
||||
};
|
||||
|
||||
if (true == m_pGameInstance->MousePicking_InLocalSpace(m_pVertexPositions[iIndices[0]], m_pVertexPositions[iIndices[1]], m_pVertexPositions[iIndices[2]], pOut))
|
||||
{
|
||||
XMStoreFloat3(&pOut, XMVector3TransformCoord(XMLoadFloat3(&pOut), XMLoadFloat4x4(pTransform->Get_WorldMatrixPtr())));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (true == m_pGameInstance->MousePicking_InWorldSpace(m_pVertexPositions[iIndices[0]], m_pVertexPositions[iIndices[2]], m_pVertexPositions[iIndices[3]], pOut))
|
||||
{
|
||||
XMStoreFloat3(&pOut, XMVector3TransformCoord(XMLoadFloat3(&pOut), XMLoadFloat4x4(pTransform->Get_WorldMatrixPtr())));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
m_pGameInstance->Ray_WorldToLocal(&WorldInv);
|
||||
return m_pQuadTree->Picking(m_pGameInstance,m_pVertexPositions, *pOut, WorldMatrix);
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::Culling(_fmatrix WorldMatrix)
|
||||
{
|
||||
m_pGameInstance->Transform_Frustum_ToLocalSpace(XMMatrixInverse(nullptr, WorldMatrix));
|
||||
|
||||
CVIBuffer_Terrain * CVIBuffer_Terrain::Create(ID3D11Device * pDevice, ID3D11DeviceContext * pContext, const _char * pFilePath, _uint iSizeX, _uint iSizeZ)
|
||||
D3D11_MAPPED_SUBRESOURCE SubResource{};
|
||||
|
||||
m_pContext->Map(m_pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource);
|
||||
|
||||
_uint* pIndices = static_cast<_uint*>(SubResource.pData);
|
||||
|
||||
_uint iNumIndices = {};
|
||||
|
||||
m_pQuadTree->Culling(m_pGameInstance, m_pVertexPositions, pIndices, &iNumIndices);
|
||||
|
||||
m_pContext->Unmap(m_pIB, 0);
|
||||
|
||||
m_iNumIndices = iNumIndices;
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::FitY(_fmatrix WorldMatrix, _float fY)
|
||||
{
|
||||
m_pGameInstance->Transform_Frustum_ToLocalSpace(XMMatrixInverse(nullptr, WorldMatrix));
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE SubResource{};
|
||||
|
||||
m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE, 0, &SubResource);
|
||||
|
||||
VTXNORTEX* pVertices = static_cast<VTXNORTEX*>(SubResource.pData);
|
||||
|
||||
_matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
|
||||
|
||||
m_pGameInstance->Ray_WorldToLocal(&WorldInv);
|
||||
|
||||
m_pQuadTree->Set_Y(m_pGameInstance, m_pVertexPositions, pVertices, WorldMatrix, fY);
|
||||
|
||||
m_pContext->Unmap(m_pVB, 0);
|
||||
}
|
||||
|
||||
CVIBuffer_Terrain* CVIBuffer_Terrain::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pFilePath, _uint iSizeX, _uint iSizeZ)
|
||||
{
|
||||
CVIBuffer_Terrain* pInstance = new CVIBuffer_Terrain(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(pFilePath, iSizeX, iSizeZ)))
|
||||
{
|
||||
MSG_BOX("Failed to Create : CVIBuffer_Terrain");
|
||||
SAFE_RELEASE(pInstance);
|
||||
MSG_BOX("Failed to Created : CVIBuffer_Terrain");
|
||||
Safe_Release(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CVIBuffer_Terrain* CVIBuffer_Terrain::Clone(void* pArg, CGameObject* pOwner)
|
||||
CComponent* CVIBuffer_Terrain::Clone(void* pArg, class CGameObject* pOwner)
|
||||
{
|
||||
CVIBuffer_Terrain* pInstance = new CVIBuffer_Terrain(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CVIBuffer_Terrain");
|
||||
SAFE_RELEASE(pInstance);
|
||||
Safe_Release(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pQuadTree);
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::Describe_Entity()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
@@ -14,6 +14,7 @@ class CPicking final : public CBase
|
||||
HRESULT Initialize(HWND hWnd, _uint iSizeX, _uint iSizeY);
|
||||
void Update();
|
||||
_bool isPicking(_float3* pOut);
|
||||
|
||||
private:
|
||||
HWND m_hWnd = { };
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
@@ -32,4 +33,4 @@ class CPicking final : public CBase
|
||||
virtual void Free();
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class CQuadTree final : public CBase
|
||||
{
|
||||
public:
|
||||
enum CORNER { CORNER_LT, CORNER_RT, CORNER_RB, CORNER_LB, CORNER_END };
|
||||
enum NEIGHBOR { NEIGHBOR_LEFT, NEIGHBOR_TOP, NEIGHBOR_RIGHT, NEIGHBOR_BOTTOM, NEIGHBOR_END };
|
||||
private:
|
||||
CQuadTree();
|
||||
virtual ~CQuadTree() = default;
|
||||
|
||||
public:
|
||||
void Culling(class CGameInstance* pGameInstance, const _float3* pVertexPositions, _uint* pIndices, _uint* pNumIndices);
|
||||
void SetUp_Neighbors();
|
||||
_bool Picking(class CGameInstance* pGameInstance, const _float3* pVertexPositions, _float3& Out, _fmatrix WorldMatrix);
|
||||
_bool Set_Y(class CGameInstance* pGameInstance, const _float3* pVertexPositions, VTXNORTEX* pVertices, _fmatrix WorldMatrix, _float fY);
|
||||
|
||||
private:
|
||||
_uint m_iCorners[CORNER_END] = { };
|
||||
_uint m_iCenter = {};
|
||||
|
||||
CQuadTree* m_pChildren[CORNER_END] = { nullptr };
|
||||
CQuadTree* m_pNeighbors[NEIGHBOR_END] = { nullptr, nullptr, nullptr, nullptr };
|
||||
|
||||
private:
|
||||
_bool isDraw(class CGameInstance* pGameInstance, const _float3* pVertexPositions);
|
||||
HRESULT Initialize(_uint iLT, _uint iRT, _uint iRB, _uint iLB);
|
||||
|
||||
public:
|
||||
static CQuadTree* Create(_uint iLT, _uint iRT, _uint iRB, _uint iLB);
|
||||
virtual void Free() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "VIBuffer.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
@@ -13,7 +13,7 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
|
||||
}VIBUFFER_TERRAIN_DESC;
|
||||
private:
|
||||
CVIBuffer_Terrain(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CVIBuffer_Terrain(CVIBuffer_Terrain& rhs);
|
||||
CVIBuffer_Terrain(const CVIBuffer_Terrain& rhs);
|
||||
virtual ~CVIBuffer_Terrain() = default;
|
||||
|
||||
_float2 Get_Size() { return _float2((_float)m_iNumVerticesX, (_float)m_iNumVerticesZ); }
|
||||
@@ -22,8 +22,9 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
|
||||
virtual HRESULT Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
|
||||
_bool Picking(class CTransform* pTransform, _float3& pOut);
|
||||
|
||||
_bool Picking(_fmatrix WorldMatrix, _float3* pOut);
|
||||
void Culling(_fmatrix WorldMatrix);
|
||||
void FitY(_fmatrix WorldMatrix, _float fY);
|
||||
private:
|
||||
_bool m_bChange = {};
|
||||
_uint m_iNumVerticesX = {};
|
||||
@@ -31,11 +32,13 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
|
||||
|
||||
vector<_float> m_HeigthValues = {};
|
||||
|
||||
class CQuadTree* m_pQuadTree = { nullptr };
|
||||
|
||||
public:
|
||||
static CVIBuffer_Terrain* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
|
||||
virtual CVIBuffer_Terrain* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
Reference in New Issue
Block a user