@@ -235,6 +235,7 @@ call Update_Resources.bat
|
||||
<ClInclude Include="..\Public\State_Land.h" />
|
||||
<ClInclude Include="..\Public\State_Move.h" />
|
||||
<ClInclude Include="..\Public\State_Root.h" />
|
||||
<ClInclude Include="..\public\StreetContainer.h" />
|
||||
<ClInclude Include="..\public\Terrain.h" />
|
||||
<ClInclude Include="..\Public\TrailObject.h" />
|
||||
<ClInclude Include="..\Public\Wand.h" />
|
||||
@@ -322,6 +323,7 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\Private\State_Land.cpp" />
|
||||
<ClCompile Include="..\Private\State_Move.cpp" />
|
||||
<ClCompile Include="..\Private\State_Root.cpp" />
|
||||
<ClCompile Include="..\private\StreetContainer.cpp" />
|
||||
<ClCompile Include="..\private\Terrain.cpp" />
|
||||
<ClCompile Include="..\Private\TrailObject.cpp" />
|
||||
<ClCompile Include="..\Private\Wand.cpp" />
|
||||
|
||||
@@ -250,6 +250,9 @@
|
||||
<ClInclude Include="..\Public\Potion.h">
|
||||
<Filter>02.GameObjects\UI\GamePlay_Canvas\Action_Panel\Potion</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\StreetContainer.h">
|
||||
<Filter>02.GameObjects\Environment\00.MapContainer\StreetContainer</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Client.ico">
|
||||
@@ -548,6 +551,9 @@
|
||||
<Filter Include="02.GameObjects\UI\GamePlay_Canvas\Action_Panel\Spell_UI">
|
||||
<UniqueIdentifier>{9914341c-f246-4fdb-b28c-de7a6d2d149b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\00.MapContainer\StreetContainer">
|
||||
<UniqueIdentifier>{e12a4228-0754-4217-b65d-7f962409f85c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Client.cpp">
|
||||
@@ -787,6 +793,9 @@
|
||||
<ClCompile Include="..\Private\Potion.cpp">
|
||||
<Filter>02.GameObjects\UI\GamePlay_Canvas\Action_Panel\Potion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\StreetContainer.cpp">
|
||||
<Filter>02.GameObjects\Environment\00.MapContainer\StreetContainer</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Client.rc">
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include "pch.h"
|
||||
#include "BuildingContainer.h"
|
||||
#include "PartObject.h"
|
||||
//#include "Terrain.h"
|
||||
//#include "Layer.h"
|
||||
//#include "VIBuffer_Terrain.h"
|
||||
|
||||
CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CMapContainer(pDevice, pContext)
|
||||
@@ -27,16 +24,21 @@ void CBuildingContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
m_fCamDepth = XMVectorGetX(XMVector3Length(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition)));
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CBuildingContainer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
if (m_pOcclusionQueryCom->isDraw())
|
||||
__super::Late_Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Late_Update(fTimeDelta);
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this);
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Render()
|
||||
@@ -44,6 +46,38 @@ HRESULT CBuildingContainer::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Render_BoundingBox()
|
||||
{
|
||||
/* Begin_Query, End_Query 사이에 Render */
|
||||
|
||||
m_pOcclusionQueryCom->Begin_Query();
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(0)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pVIBufferCom->Bind_Resources()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pVIBufferCom->Render()))
|
||||
return E_FAIL;
|
||||
|
||||
m_pOcclusionQueryCom->End_Query();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
@@ -65,6 +99,8 @@ HRESULT CBuildingContainer::Initialize(void* pArg)
|
||||
m_pTransformCom->Set_Scale(pDesc->vScale);
|
||||
m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z));
|
||||
|
||||
XMStoreFloat3(&m_vExtentWorldPosition, XMVector3TransformCoord(XMLoadFloat3(&m_vExtentWorldPosition), m_pTransformCom->Get_XMWorldMatrix()));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -74,6 +110,44 @@ HRESULT CBuildingContainer::Ready_Components(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_VTXPOS,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
return E_FAIL;
|
||||
|
||||
MAP_CONTAINER_DESC* pDesc = static_cast<MAP_CONTAINER_DESC*>(pArg);
|
||||
|
||||
_float3 vBoxCorners[8] = {};
|
||||
|
||||
vBoxCorners[0] = _float3(pDesc->vContainerMin.x, pDesc->vContainerMax.y, pDesc->vContainerMin.z);
|
||||
vBoxCorners[1] = _float3(pDesc->vContainerMax.x, pDesc->vContainerMax.y, pDesc->vContainerMin.z);
|
||||
vBoxCorners[2] = _float3(pDesc->vContainerMax.x, pDesc->vContainerMin.y, pDesc->vContainerMin.z);
|
||||
vBoxCorners[3] = _float3(pDesc->vContainerMin.x, pDesc->vContainerMin.y, pDesc->vContainerMin.z);
|
||||
vBoxCorners[4] = _float3(pDesc->vContainerMin.x, pDesc->vContainerMax.y, pDesc->vContainerMax.z);
|
||||
vBoxCorners[5] = _float3(pDesc->vContainerMax.x, pDesc->vContainerMax.y, pDesc->vContainerMax.z);
|
||||
vBoxCorners[6] = _float3(pDesc->vContainerMax.x, pDesc->vContainerMin.y, pDesc->vContainerMax.z);
|
||||
vBoxCorners[7] = _float3(pDesc->vContainerMin.x, pDesc->vContainerMin.y, pDesc->vContainerMax.z);
|
||||
|
||||
_float3 vRadius = {};
|
||||
|
||||
vRadius.x = (pDesc->vContainerMax.x - pDesc->vContainerMin.x) * 0.5f;
|
||||
vRadius.y = (pDesc->vContainerMax.y - pDesc->vContainerMin.y) * 0.5f;
|
||||
vRadius.z = (pDesc->vContainerMax.z - pDesc->vContainerMin.z) * 0.5f;
|
||||
|
||||
m_vExtentWorldPosition.x = pDesc->vContainerMin.x + vRadius.x;
|
||||
m_vExtentWorldPosition.y = pDesc->vContainerMin.y + vRadius.y;
|
||||
m_vExtentWorldPosition.z = pDesc->vContainerMin.z + vRadius.z;
|
||||
|
||||
/* Com_VIBuffer */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Box"),
|
||||
reinterpret_cast<CComponent**>(&m_pVIBufferCom), &vBoxCorners)))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_OcclusionQuery */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_OcclusionQuery"),
|
||||
reinterpret_cast<CComponent**>(&m_pOcclusionQueryCom))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -112,6 +186,10 @@ void CBuildingContainer::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
SAFE_RELEASE(m_pOcclusionQueryCom);
|
||||
|
||||
for (auto& pCollision : m_ColiisonPartObjects)
|
||||
SAFE_RELEASE(pCollision);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "VIBuffer_Terrain.h"
|
||||
#include "VIBuffer_Model_Instance.h"
|
||||
#include "BuildingContainer.h"
|
||||
#include "StreetContainer.h"
|
||||
#include "MapObject_Render.h"
|
||||
#include "MapObject_Collision.h"
|
||||
#include "InstancedProp.h"
|
||||
@@ -458,6 +459,12 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
|
||||
m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다.");
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_VTXPOS,
|
||||
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl"),
|
||||
VTXPOS::Elements, VTXPOS::iNumElements)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_MESH,
|
||||
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl"),
|
||||
VTXMESH::Elements, VTXMESH::iNumElements)))) {
|
||||
@@ -1106,6 +1113,16 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
"../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Box */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Box"),
|
||||
CVIBuffer_Box::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_Component_OcclusionQuery */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_OcclusionQuery"),
|
||||
COcclusionQuery::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_Terrain */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CTerrain>(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
@@ -1114,6 +1131,10 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CBuildingContainer>(g_iStaticLevel, CBuildingContainer::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_CStreetContainer */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CStreetContainer>(g_iStaticLevel, CStreetContainer::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_CMapObject_Render */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CMapObject_Render>(g_iStaticLevel, CMapObject_Render::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "GameInstance.h"
|
||||
#include "InfoInstance.h"
|
||||
#include "BuildingContainer.h"
|
||||
#include "StreetContainer.h"
|
||||
#include "MAPPartObject.h"
|
||||
#include "MapObject_Render.h"
|
||||
#include "MapObject_Collision.h"
|
||||
@@ -40,123 +41,28 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName)
|
||||
for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container"))
|
||||
{
|
||||
const _char* pName = {};
|
||||
|
||||
_uint iMapContainerType = {};
|
||||
Container->QueryStringAttribute("Name", &pName);
|
||||
#pragma region ADD_CONTAINER_OBJECT
|
||||
Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType);
|
||||
|
||||
CBuildingContainer* pContainerObject = { nullptr };
|
||||
CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {};
|
||||
CMapContainer* pContainerObject = nullptr;
|
||||
|
||||
auto* ContainerPosition = Container->FirstChildElement("Position");
|
||||
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
|
||||
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
|
||||
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z);
|
||||
|
||||
auto* ContainerScale = Container->FirstChildElement("Scale");
|
||||
ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x);
|
||||
ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y);
|
||||
ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z);
|
||||
|
||||
auto* ContainerRotation = Container->FirstChildElement("Rotation");
|
||||
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
|
||||
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
|
||||
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
|
||||
|
||||
m_pGameInstance->Add_GameObject_ToLayer<CBuildingContainer>(
|
||||
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, &pContainerObject);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ADD_PARTOBJECT
|
||||
for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject"))
|
||||
if (0 == iMapContainerType)
|
||||
{
|
||||
_uint iLodLevel = {};
|
||||
_uint iKeyIndex = {};
|
||||
|
||||
PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
|
||||
PartObject->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
|
||||
|
||||
#pragma region MAPOBJECT_RENDER
|
||||
CMapPartObject::MAPOBJECT_DESC Desc = {};
|
||||
string strTag = {};
|
||||
for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
|
||||
{
|
||||
strTag = PrototypeTag->GetText();
|
||||
|
||||
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
|
||||
}
|
||||
|
||||
Desc.iMaxLodLevel = iLodLevel;
|
||||
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
|
||||
const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex);
|
||||
|
||||
/* Position */
|
||||
tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Scale */
|
||||
tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
/* Rotation */
|
||||
tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
if (FAILED(pContainerObject->Add_Part<CMapObject_Render>(strKey, g_iStaticLevel, nullptr, &Desc)))
|
||||
return E_FAIL;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
Load_BuildingContainer(Container, &pContainerObject);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ADD_COLLISION
|
||||
for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision"))
|
||||
else if (1 == iMapContainerType)
|
||||
{
|
||||
_uint iLodLevel = {};
|
||||
_uint iKeyIndex = {};
|
||||
|
||||
Collision->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
|
||||
Collision->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
|
||||
|
||||
#pragma region MAPOBJECT_LOD
|
||||
CMapPartObject::MAPOBJECT_DESC Desc = {};
|
||||
string strTag = {};
|
||||
for (auto* PrototypeTag = Collision->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
|
||||
{
|
||||
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(PrototypeTag->GetText()));
|
||||
}
|
||||
Desc.iMaxLodLevel = iLodLevel;
|
||||
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
|
||||
|
||||
/* Position */
|
||||
tinyxml2::XMLElement* Position = Collision->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Scale */
|
||||
tinyxml2::XMLElement* Scale = Collision->FirstChildElement("Scale");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
/* Rotation */
|
||||
tinyxml2::XMLElement* Rotation = Collision->FirstChildElement("Rotation");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
pContainerObject->Add_Collision<CMapObject_Collision>(g_iStaticLevel, &Desc);
|
||||
#pragma endregion
|
||||
|
||||
Load_StreetContainer(Container, &pContainerObject);
|
||||
}
|
||||
#pragma endregion
|
||||
else
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Load_MapRenderObjects(Container, pContainerObject)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Load_MapCollisionObjects(Container, pContainerObject)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
|
||||
@@ -201,6 +107,165 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_BuildingContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject)
|
||||
{
|
||||
CBuildingContainer::MAP_CONTAINER_DESC ContainerDesc = {};
|
||||
|
||||
auto* ContainerPosition = Container->FirstChildElement("Position");
|
||||
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
|
||||
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
|
||||
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z);
|
||||
|
||||
auto* ContainerScale = Container->FirstChildElement("Scale");
|
||||
ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x);
|
||||
ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y);
|
||||
ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z);
|
||||
|
||||
auto* ContainerRotation = Container->FirstChildElement("Rotation");
|
||||
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
|
||||
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
|
||||
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
|
||||
|
||||
auto* BoundingBox_Min = Container->FirstChildElement("BoundingBox_Min");
|
||||
BoundingBox_Min->QueryFloatAttribute("x", &ContainerDesc.vContainerMin.x);
|
||||
BoundingBox_Min->QueryFloatAttribute("y", &ContainerDesc.vContainerMin.y);
|
||||
BoundingBox_Min->QueryFloatAttribute("z", &ContainerDesc.vContainerMin.z);
|
||||
|
||||
auto* BoundingBox_Max = Container->FirstChildElement("BoundingBox_Max");
|
||||
BoundingBox_Max->QueryFloatAttribute("x", &ContainerDesc.vContainerMax.x);
|
||||
BoundingBox_Max->QueryFloatAttribute("y", &ContainerDesc.vContainerMax.y);
|
||||
BoundingBox_Max->QueryFloatAttribute("z", &ContainerDesc.vContainerMax.z);
|
||||
|
||||
m_pGameInstance->Add_GameObject_ToLayer<CBuildingContainer>(
|
||||
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, reinterpret_cast<CBuildingContainer**>(ppContainerObject));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_StreetContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject)
|
||||
{
|
||||
CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {};
|
||||
|
||||
auto* ContainerPosition = Container->FirstChildElement("Position");
|
||||
ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x);
|
||||
ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y);
|
||||
ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z);
|
||||
|
||||
auto* ContainerScale = Container->FirstChildElement("Scale");
|
||||
ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x);
|
||||
ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y);
|
||||
ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z);
|
||||
|
||||
auto* ContainerRotation = Container->FirstChildElement("Rotation");
|
||||
ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x);
|
||||
ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y);
|
||||
ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z);
|
||||
|
||||
m_pGameInstance->Add_GameObject_ToLayer<CStreetContainer>(
|
||||
g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), LAYER_BACKGROUND, &ContainerDesc, nullptr, reinterpret_cast<CStreetContainer**>(ppContainerObject));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject)
|
||||
{
|
||||
#pragma region ADD_PARTOBJECT
|
||||
for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject"))
|
||||
{
|
||||
_uint iLodLevel = {};
|
||||
_uint iKeyIndex = {};
|
||||
|
||||
PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
|
||||
PartObject->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
|
||||
|
||||
#pragma region MAPOBJECT_RENDER
|
||||
CMapPartObject::MAPOBJECT_DESC Desc = {};
|
||||
string strTag = {};
|
||||
for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
|
||||
{
|
||||
strTag = PrototypeTag->GetText();
|
||||
|
||||
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
|
||||
}
|
||||
|
||||
Desc.iMaxLodLevel = iLodLevel;
|
||||
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
|
||||
const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex);
|
||||
|
||||
/* Position */
|
||||
tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Scale */
|
||||
tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
/* Rotation */
|
||||
tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
if (FAILED(pContainerObject->Add_Part<CMapObject_Render>(strKey, g_iStaticLevel, nullptr, &Desc)))
|
||||
return E_FAIL;
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_MapCollisionObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject)
|
||||
{
|
||||
#pragma region ADD_COLLISION
|
||||
for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision"))
|
||||
{
|
||||
_uint iLodLevel = {};
|
||||
_uint iKeyIndex = {};
|
||||
|
||||
Collision->QueryUnsignedAttribute("Lod_Level", &iLodLevel);
|
||||
Collision->QueryUnsignedAttribute("Key_Index", &iKeyIndex);
|
||||
|
||||
#pragma region MAPOBJECT_LOD
|
||||
CMapPartObject::MAPOBJECT_DESC Desc = {};
|
||||
string strTag = {};
|
||||
for (auto* PrototypeTag = Collision->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
|
||||
{
|
||||
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(PrototypeTag->GetText()));
|
||||
}
|
||||
Desc.iMaxLodLevel = iLodLevel;
|
||||
Desc.pParentTransform = pContainerObject->Get_Component<CTransform>();
|
||||
|
||||
/* Position */
|
||||
tinyxml2::XMLElement* Position = Collision->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
/* Scale */
|
||||
tinyxml2::XMLElement* Scale = Collision->FirstChildElement("Scale");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
/* Rotation */
|
||||
tinyxml2::XMLElement* Rotation = Collision->FirstChildElement("Rotation");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
pContainerObject->Add_Collision<CMapObject_Collision>(g_iStaticLevel, &Desc);
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
|
||||
{
|
||||
m_pGameInstance = CGameInstance::GetInstance();
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
#include "pch.h"
|
||||
#include "StreetContainer.h"
|
||||
#include "PartObject.h"
|
||||
|
||||
CStreetContainer::CStreetContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CMapContainer(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CStreetContainer::CStreetContainer(const CStreetContainer& rhs)
|
||||
:CMapContainer(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
void CStreetContainer::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Priority_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CStreetContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CStreetContainer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
HRESULT CStreetContainer::Render()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CStreetContainer::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CStreetContainer::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
MAP_CONTAINER_DESC* pDesc = static_cast<MAP_CONTAINER_DESC*>(pArg);
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f));
|
||||
m_pTransformCom->Set_Scale(pDesc->vScale);
|
||||
m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CStreetContainer::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CStreetContainer::Bind_ShaderResources()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CStreetContainer* CStreetContainer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CStreetContainer* pInstance = new CStreetContainer(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CStreetContainer");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CStreetContainer::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CStreetContainer* pInstance = new CStreetContainer(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CStreetContainer");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CStreetContainer::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
for (auto& pCollision : m_ColiisonPartObjects)
|
||||
SAFE_RELEASE(pCollision);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CStreetContainer::Describe_Entity()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -3,10 +3,23 @@
|
||||
#include "Client_Define.h"
|
||||
#include "MapContainer.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CShader;
|
||||
class CVIBuffer_Box;
|
||||
class COcclusionQuery;
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CBuildingContainer final : public CMapContainer
|
||||
class CBuildingContainer final : public CMapContainer // OCCLUSION CONTAINER
|
||||
{
|
||||
public:
|
||||
typedef struct tagMapContainerDesc : public CMapContainer::MAP_CONTAINER_DESC
|
||||
{
|
||||
_float3 vContainerMin;
|
||||
_float3 vContainerMax;
|
||||
}MAP_CONTAINER_DESC;
|
||||
|
||||
private:
|
||||
CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CBuildingContainer(const CBuildingContainer& rhs);
|
||||
@@ -17,25 +30,14 @@ class CBuildingContainer final : public CMapContainer
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Render_BoundingBox() override;
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) {
|
||||
return Add_PartObject<T>(strPartKey, iPrototypeLevelIndex, ppOut, pArg);
|
||||
}
|
||||
template<typename T>
|
||||
HRESULT Add_Collision(_uint iPrototypeLevelIndex, void* pArg = nullptr)
|
||||
{
|
||||
T* pPartObject = m_pGameInstance->Clone_Prototype<T>(iPrototypeLevelIndex, pArg, this);
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Box* m_pVIBufferCom = { nullptr };
|
||||
COcclusionQuery* m_pOcclusionQueryCom = { nullptr };
|
||||
|
||||
if (nullptr == pPartObject) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_ColiisonPartObjects.push_back(pPartObject);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
_float3 m_vExtentWorldPosition = {};
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Client {
|
||||
#define FX_INSTANCE_PROP_MODEL TEXT("FX_INSTANCE_PROP_MODEL")
|
||||
#define FX_UIEDITOR TEXT("FX_UIEDITOR")
|
||||
#define FX_UIINSTANCE TEXT("FX_UIINSTANCE")
|
||||
#define FX_VTXPOS TEXT("FX_VTXPOS")
|
||||
|
||||
#pragma endregion
|
||||
#pragma region MACRO_PROTOTYPE
|
||||
|
||||
@@ -26,6 +26,25 @@ class CMapContainer abstract : public CContainerObject
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) {
|
||||
return Add_PartObject<T>(strPartKey, iPrototypeLevelIndex, ppOut, pArg);
|
||||
}
|
||||
template<typename T>
|
||||
HRESULT Add_Collision(_uint iPrototypeLevelIndex, void* pArg = nullptr)
|
||||
{
|
||||
T* pPartObject = m_pGameInstance->Clone_Prototype<T>(iPrototypeLevelIndex, pArg, this);
|
||||
|
||||
if (nullptr == pPartObject) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_ColiisonPartObjects.push_back(pPartObject);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
@@ -18,7 +18,10 @@ class CMapInfo final : public CBase
|
||||
void Update(_float fTimeDelta);
|
||||
void Change_Level();
|
||||
HRESULT Load_MapObjects(const _char* pFilePath);
|
||||
|
||||
HRESULT Load_BuildingContainer(tinyxml2::XMLElement* Container, class CMapContainer** ppContainerObject);
|
||||
HRESULT Load_StreetContainer(tinyxml2::XMLElement* Container, class CMapContainer** ppContainerObject);
|
||||
HRESULT Load_MapRenderObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject);
|
||||
HRESULT Load_MapCollisionObjects(tinyxml2::XMLElement* Container, class CMapContainer* pContainerObject);
|
||||
|
||||
private:
|
||||
CGameInstance* m_pGameInstance = { nullptr };
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "Client_Define.h"
|
||||
#include "MapContainer.h"
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CStreetContainer final : public CMapContainer // NON OCCLUSION CONTAINER
|
||||
{
|
||||
private:
|
||||
CStreetContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CStreetContainer(const CStreetContainer& rhs);
|
||||
~CStreetContainer() = default;
|
||||
|
||||
public:
|
||||
virtual void Priority_Update(_float fTimeDelta) override;
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
virtual HRESULT Bind_ShaderResources()override;
|
||||
|
||||
public:
|
||||
static CStreetContainer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner = nullptr)override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entity()override;
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -4,6 +4,9 @@
|
||||
<Position x="39.271946" y="3.7999978" z="70.609833"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="-0" y="-60" z="-0"/>
|
||||
<MapContainerType type="0"/>
|
||||
<BoundingBox_Min x="-7.0020647" y="-0.45976496" z="-1.5148951"/>
|
||||
<BoundingBox_Max x="6.3698497" y="12.858675" z="14.645905"/>
|
||||
<PartObject Lod_Level="1" Key_Index="4">
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_Railing_Post_A</PrototypeTag>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_Railing_Post_A_Lod1</PrototypeTag>
|
||||
@@ -366,6 +369,9 @@
|
||||
<Position x="24" y="8" z="16"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
<MapContainerType type="1"/>
|
||||
<BoundingBox_Min x="-35.479698" y="-22.290039" z="7.2240992"/>
|
||||
<BoundingBox_Max x="91.70047" y="12.14246" z="98.067856"/>
|
||||
<PartObject Lod_Level="0" Key_Index="0">
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_LowerHiStreet_Zonkos</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
@@ -520,6 +526,9 @@
|
||||
<Position x="23.494474" y="0" z="2.9722724"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="7.0000072" z="0"/>
|
||||
<MapContainerType type="0"/>
|
||||
<BoundingBox_Min x="-10.33712" y="-13.23702" z="-19.093868"/>
|
||||
<BoundingBox_Max x="8.3332806" y="10.47531" z="17.818052"/>
|
||||
<PartObject Lod_Level="2" Key_Index="0">
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_Gatehouse_Bridge</PrototypeTag>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_Gatehouse_Bridge_Lod1</PrototypeTag>
|
||||
@@ -716,6 +725,9 @@
|
||||
<Position x="108.25024" y="16.399971" z="131.35001"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
<MapContainerType type="1"/>
|
||||
<BoundingBox_Min x="-16.85453" y="-16.870581" z="-19.638439"/>
|
||||
<BoundingBox_Max x="19.18985" y="14.93294" z="34.01255"/>
|
||||
<PartObject Lod_Level="0" Key_Index="0">
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_PlazaMain_A</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,12 @@ RasterizerState RS_Nocull
|
||||
DepthClipEnable = false;
|
||||
};
|
||||
|
||||
RasterizerState RS_NocullOcclusion
|
||||
{
|
||||
FillMode = Solid;
|
||||
CullMode = None;
|
||||
};
|
||||
|
||||
RasterizerState RS_Nocull_Wireframe
|
||||
{
|
||||
FillMode = Wireframe;
|
||||
@@ -121,6 +127,12 @@ DepthStencilState DSS_Default_OutLine_Read
|
||||
BackFaceStencilFunc = Equal;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Occlusion
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
BlendState BS_None
|
||||
{
|
||||
BlendEnable[0] = false;
|
||||
@@ -233,6 +245,28 @@ BlendState BS_WeightBlend
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
BlendState BS_WhiteMask
|
||||
{
|
||||
BlendEnable[0] = false;
|
||||
BlendEnable[1] = false;
|
||||
BlendEnable[2] = false;
|
||||
BlendEnable[3] = false;
|
||||
BlendEnable[4] = false;
|
||||
BlendEnable[5] = false;
|
||||
BlendEnable[6] = false;
|
||||
BlendEnable[7] = false;
|
||||
|
||||
RenderTargetWriteMask[0] = 0;
|
||||
RenderTargetWriteMask[1] = 0;
|
||||
RenderTargetWriteMask[2] = 0;
|
||||
RenderTargetWriteMask[3] = 0;
|
||||
RenderTargetWriteMask[4] = 0;
|
||||
RenderTargetWriteMask[5] = 0;
|
||||
RenderTargetWriteMask[6] = 0;
|
||||
RenderTargetWriteMask[7] = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENGINE_SHADER_STATES_HLSLI
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
|
||||
float g_fFar;
|
||||
float3 g_vContainerMin;
|
||||
float3 g_vContainerMax;
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
};
|
||||
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(float4(In.vPosition, 1.f), matWVP);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 vColor : SV_TARGET0;
|
||||
};
|
||||
|
||||
PS_OUT PS_MAIN(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_DEBUG(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
Out.vColor = float4(1.f, 0.5f, 0.5f, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
technique11 NorTechnique11
|
||||
{
|
||||
pass BoundingBoxPass
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
SetDepthStencilState(DSS_Occlusion, 0);
|
||||
SetBlendState(BS_WhiteMask, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
pass BoundingDebugPass
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
SetDepthStencilState(DSS_None, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_DEBUG();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -476,6 +476,7 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_VtxPos.hlsl" />
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_VtxNorTex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">5.0</ShaderModel>
|
||||
|
||||
@@ -1166,5 +1166,8 @@
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_VtxWorldModelInstance.hlsl">
|
||||
<Filter>99.Define\SHADER</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_VtxPos.hlsl">
|
||||
<Filter>99.Define\SHADER</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "Terrain.h"
|
||||
#include "Layer.h"
|
||||
#include "VIBuffer_Terrain.h"
|
||||
#include "PartObject.h"
|
||||
#include "MapObject_LOD.h"
|
||||
#include "Bounding_OBB.h"
|
||||
|
||||
CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CMapContainer(pDevice, pContext)
|
||||
@@ -28,10 +29,24 @@ void CBuildingContainer::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CBuildingContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
m_pVIBufferCom->Update(m_vBoxCorners);
|
||||
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Update(fTimeDelta);
|
||||
|
||||
if (m_bOcclusionPassed)
|
||||
{
|
||||
_vector WorldPosition = XMVector3TransformCoord(
|
||||
XMVectorSetW(XMLoadFloat3(&m_vExtentPosition), 1.f),
|
||||
XMMatrixTranslation(m_vExtentPosition.x, m_vExtentPosition.y, m_vExtentPosition.z) * m_pTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
_vector vCamPosition = XMLoadFloat4(m_pGameInstance->Get_CamPosition());
|
||||
|
||||
// m_fCamDepth = XMVectorGetX(XMVector3LengthSq(vCamPosition - XMVectorSetW(XMLoadFloat3(&m_vExtentPosition), 1.f)));
|
||||
m_fCamDepth = XMVectorGetX(XMVector3Length(vCamPosition - XMLoadFloat3(&m_vExtentPosition)));
|
||||
}
|
||||
}
|
||||
|
||||
void CBuildingContainer::Late_Update(_float fTimeDelta)
|
||||
@@ -46,10 +61,20 @@ void CBuildingContainer::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
__super::Late_Update(fTimeDelta);
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects)
|
||||
pCollisiton->Late_Update(fTimeDelta);
|
||||
|
||||
if (m_bOcclusionPassed)
|
||||
{
|
||||
if (m_pOcclusionQueryCom->isDraw())
|
||||
__super::Late_Update(fTimeDelta);
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Render()
|
||||
@@ -57,6 +82,85 @@ HRESULT CBuildingContainer::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Render_BoundingBox()
|
||||
{
|
||||
m_pOcclusionQueryCom->Begin_Query();
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (m_pGameInstance->Key_Pressing(DIK_Q))
|
||||
{
|
||||
if (FAILED(m_pShaderCom->Begin(1)))
|
||||
return E_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(m_pShaderCom->Begin(0)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pVIBufferCom->Bind_Resources()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pVIBufferCom->Render()))
|
||||
return E_FAIL;
|
||||
|
||||
m_pOcclusionQueryCom->End_Query();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CBuildingContainer::Set_BoundingBox()
|
||||
{
|
||||
_float3 vCurrentMin = {};
|
||||
_float3 vCurrentMax = {};
|
||||
|
||||
|
||||
for (auto& piar : m_PartObjects)
|
||||
{
|
||||
dynamic_cast<CMapObject_LOD*>(piar.second)->Get_BoundingBox(&vCurrentMin, &vCurrentMax);
|
||||
|
||||
vContainerMin.x = min(vContainerMin.x, vCurrentMin.x);
|
||||
vContainerMin.y = min(vContainerMin.y, vCurrentMin.y);
|
||||
vContainerMin.z = min(vContainerMin.z, vCurrentMin.z);
|
||||
|
||||
vContainerMax.x = max(vContainerMax.x, vCurrentMax.x);
|
||||
vContainerMax.y = max(vContainerMax.y, vCurrentMax.y);
|
||||
vContainerMax.z = max(vContainerMax.z, vCurrentMax.z);
|
||||
}
|
||||
|
||||
m_vExtentRadius.x = (vContainerMax.x - vContainerMin.x) * 0.5f;
|
||||
m_vExtentRadius.y = (vContainerMax.y - vContainerMin.y) * 0.5f;
|
||||
m_vExtentRadius.z = (vContainerMax.z - vContainerMin.z) * 0.5f;
|
||||
|
||||
m_vExtentPosition.x = vContainerMin.x + m_vExtentRadius.x;
|
||||
m_vExtentPosition.y = vContainerMin.y + m_vExtentRadius.y;
|
||||
m_vExtentPosition.z = vContainerMin.z + m_vExtentRadius.z;
|
||||
|
||||
m_vBoxCorners[0] = _float3(vContainerMin.x, vContainerMax.y, vContainerMin.z);
|
||||
m_vBoxCorners[1] = _float3(vContainerMax.x, vContainerMax.y, vContainerMin.z);
|
||||
m_vBoxCorners[2] = _float3(vContainerMax.x, vContainerMin.y, vContainerMin.z);
|
||||
m_vBoxCorners[3] = _float3(vContainerMin.x, vContainerMin.y, vContainerMin.z);
|
||||
m_vBoxCorners[4] = _float3(vContainerMin.x, vContainerMax.y, vContainerMax.z);
|
||||
m_vBoxCorners[5] = _float3(vContainerMax.x, vContainerMax.y, vContainerMax.z);
|
||||
m_vBoxCorners[6] = _float3(vContainerMax.x, vContainerMin.y, vContainerMax.z);
|
||||
m_vBoxCorners[7] = _float3(vContainerMin.x, vContainerMin.y, vContainerMax.z);
|
||||
|
||||
m_pVIBufferCom->Update(m_vBoxCorners);
|
||||
|
||||
//XMStoreFloat4x4(&m_BoundingBoxWorldMatirx, m_pTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
//memcpy(&m_BoundingBoxWorldMatirx.m[3], &m_vExtentPosition, sizeof(_float3));
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
@@ -75,6 +179,10 @@ HRESULT CBuildingContainer::Initialize(void* pArg)
|
||||
MAP_CONTAINER_DESC* pDesc = static_cast<MAP_CONTAINER_DESC*>(pArg);
|
||||
|
||||
m_strName = pDesc->strName;
|
||||
if (string::npos == m_strName.find("Street"))
|
||||
m_bOcclusionPassed = true;
|
||||
else
|
||||
m_bOcclusionPassed = false;
|
||||
|
||||
m_vPosition = pDesc->vPosition;
|
||||
m_vScale = pDesc->vScale;
|
||||
@@ -93,6 +201,21 @@ HRESULT CBuildingContainer::Ready_Components(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_VTXPOS,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Box"),
|
||||
reinterpret_cast<CComponent**>(&m_pVIBufferCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_OcclusionQuery */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_OcclusionQuery"),
|
||||
reinterpret_cast<CComponent**>(&m_pOcclusionQueryCom))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -131,6 +254,10 @@ void CBuildingContainer::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
SAFE_RELEASE(m_pOcclusionQueryCom);
|
||||
|
||||
for (auto& pCollision : m_ColiisonPartObjects)
|
||||
SAFE_RELEASE(pCollision);
|
||||
}
|
||||
@@ -141,6 +268,11 @@ void CBuildingContainer::Describe_Entity()
|
||||
return;
|
||||
if (nullptr == m_pGameInstance)
|
||||
return;
|
||||
if (GUI::Button("BoundingBox"))
|
||||
{
|
||||
Set_BoundingBox();
|
||||
}
|
||||
|
||||
|
||||
GUI::Text(m_strName.c_str());
|
||||
GUI::Text("----- Transfrom ----");
|
||||
@@ -170,6 +302,9 @@ void CBuildingContainer::Describe_Entity()
|
||||
m_vScale.z = max(0.01f, m_vScale.z);
|
||||
|
||||
|
||||
GUI::InputFloat3("Extent Radius", &m_vExtentRadius.x);
|
||||
GUI::InputFloat3("Extent Position", &m_vExtentPosition.x);
|
||||
|
||||
if (GUI::Button("Delete"))
|
||||
m_bDead = true;
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
|
||||
#pragma region MAP_HEADER
|
||||
#include "VIBuffer_Terrain.h"
|
||||
#include "VIBuffer_Box.h"
|
||||
#include "OcclusionQuery.h"
|
||||
#include "Terrain.h"
|
||||
#include "BuildingContainer.h"
|
||||
#include "MapObject_Collision.h"
|
||||
@@ -2290,6 +2292,12 @@ vector<vector<FOLDER_LOAD*>*> Contents(iLoadCount);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_VTXPOS,
|
||||
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl"),
|
||||
VTXPOS::Elements, VTXPOS::iNumElements)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다.");
|
||||
|
||||
|
||||
@@ -2303,6 +2311,7 @@ vector<vector<FOLDER_LOAD*>*> Contents(iLoadCount);
|
||||
CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "../Bin/Resources/Data/Map/T_LandscapeStreamingProxy_0_LOD1_D.png"))))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
CVIBuffer_Model_Instance::INSTANCE_DESC InstanceDesc = {};
|
||||
|
||||
InstanceDesc.iNum = 200;
|
||||
@@ -2325,6 +2334,16 @@ vector<vector<FOLDER_LOAD*>*> Contents(iLoadCount);
|
||||
"../Bin/Resources/Models/InstanceProp/SM_BearBerry_A.fbx", "../Bin/Resources/Data/Map/Instance/InstanceMaterial.xml"))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Box */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Box"),
|
||||
CVIBuffer_Box::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_Component_OcclusionQuery */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_OcclusionQuery"),
|
||||
COcclusionQuery::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_SkyBox */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CDummySkyBox>(g_iStaticLevel, CDummySkyBox::Create(m_pDevice, m_pContext)))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -67,7 +67,7 @@ HRESULT CMapObject_LOD::Initialize(void* pArg)
|
||||
_matrix ColliderMatrix = XMMatrixTranslation(vOffset.x, vOffset.y, vOffset.z) * XMLoadFloat4x4(&m_CombinedWorldMatrix);
|
||||
XMStoreFloat4(&m_vExtentPosition, ColliderMatrix.r[3]);
|
||||
|
||||
|
||||
XMStoreFloat3(&m_CombinedExtendPosition, XMVector3TransformCoord(XMLoadFloat3(&vOffset), XMLoadFloat4x4(&m_CombinedWorldMatrix)));
|
||||
|
||||
//m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
|
||||
@@ -111,6 +111,8 @@ void CMapObject_LOD::Late_Update(_float fTimeDelta)
|
||||
_matrix ColliderMatrix = XMMatrixTranslation(vOffset.x, vOffset.y, vOffset.z) * XMLoadFloat4x4(&m_CombinedWorldMatrix);
|
||||
XMStoreFloat4(&m_vExtentPosition, ColliderMatrix.r[3]);
|
||||
|
||||
|
||||
|
||||
_float fRaius = m_pModelComs[0]->Get_Radius();
|
||||
if (m_pGameInstance->isIn_WorldFrustum(XMLoadFloat4(&m_vExtentPosition), fRaius)) {
|
||||
|
||||
@@ -184,6 +186,24 @@ _wstring CMapObject_LOD::Get_PrototypeTag(_uint iLodIndex)
|
||||
return m_ModelPrototypeTags[iLodIndex];
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Get_BoundingBox(_float3* pMinPosition, _float3* pMaxPosition)
|
||||
{
|
||||
_float fRadius = m_pModelComs[0]->Get_Radius() / 2.f;
|
||||
_float3 vOffset = m_pModelComs[0]->Get_RadiusOffset();
|
||||
|
||||
_float3 vPosition = {};
|
||||
|
||||
XMStoreFloat3(&vPosition, XMVector3TransformCoord(XMLoadFloat3(&vOffset), m_pTransformCom->Get_XMWorldMatrix()));
|
||||
|
||||
pMinPosition->x = vPosition.x - fRadius;
|
||||
pMinPosition->y = vPosition.y - fRadius;
|
||||
pMinPosition->z = vPosition.z - fRadius;
|
||||
|
||||
pMaxPosition->x = vPosition.x + fRadius;
|
||||
pMaxPosition->y = vPosition.y + fRadius;
|
||||
pMaxPosition->z = vPosition.z + fRadius;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag)
|
||||
{
|
||||
CModel* pModel = { nullptr };
|
||||
|
||||
@@ -259,6 +259,32 @@ HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName)
|
||||
container->InsertEndChild(Rotation);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region BOUNDING_BOX
|
||||
tinyxml2::XMLElement* MapContainerType = doc.NewElement("MapContainerType");
|
||||
if(pContainerObject->Is_OcclusionPassed())
|
||||
MapContainerType->SetAttribute("type", 0); // Building
|
||||
else
|
||||
MapContainerType->SetAttribute("type", 1); // Road
|
||||
|
||||
container->InsertEndChild(MapContainerType);
|
||||
|
||||
_float3 vMinPosition = dynamic_cast<CBuildingContainer*>(pGamObject)->Get_BoundingBox_Min();
|
||||
_float3 vMaxPosition = dynamic_cast<CBuildingContainer*>(pGamObject)->Get_BoundingBox_Max();
|
||||
|
||||
tinyxml2::XMLElement* BoundingBox_Min = doc.NewElement("BoundingBox_Min");
|
||||
BoundingBox_Min->SetAttribute("x", vMinPosition.x);
|
||||
BoundingBox_Min->SetAttribute("y", vMinPosition.y);
|
||||
BoundingBox_Min->SetAttribute("z", vMinPosition.z);
|
||||
container->InsertEndChild(BoundingBox_Min);
|
||||
|
||||
tinyxml2::XMLElement* BoundingBox_Max = doc.NewElement("BoundingBox_Max");
|
||||
BoundingBox_Max->SetAttribute("x", vMaxPosition.x);
|
||||
BoundingBox_Max->SetAttribute("y", vMaxPosition.y);
|
||||
BoundingBox_Max->SetAttribute("z", vMaxPosition.z);
|
||||
container->InsertEndChild(BoundingBox_Max);
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region SAVE_PARTOBJECT
|
||||
|
||||
if (FAILED(pContainerObject->Save_PartObjects(doc, container)))
|
||||
@@ -710,6 +736,8 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName)
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
pContainerObject->Set_BoundingBox();
|
||||
|
||||
#pragma region ADD_COLLISION
|
||||
for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision"))
|
||||
{
|
||||
@@ -1342,6 +1370,17 @@ void CMapObject_Manager::Update_ContainerObject()
|
||||
|
||||
_uint iIndex = {};
|
||||
|
||||
if (GUI::Button("Set Box"))
|
||||
{
|
||||
if (false == (*pList).empty())
|
||||
{
|
||||
for (auto& pObject : (*pList))
|
||||
{
|
||||
dynamic_cast<CBuildingContainer*>(pObject)->Set_BoundingBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (false == (*pList).empty())
|
||||
{
|
||||
CGameObject* pSelectObject = { nullptr };
|
||||
|
||||
@@ -34,7 +34,7 @@ HRESULT CTerrain::Initialize(void* pArg)
|
||||
|
||||
m_fUsingSurfaceParams = 15.f / 27.f;
|
||||
m_vRotation = _float3{ 0.f, 0.f, 0.f };
|
||||
//m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-194, 18.5f, -153.f, 1.f));
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-194, 18.5f, -153.f, 1.f));
|
||||
|
||||
//m_pVIBufferCom->Set_CullingRadius(0.04f);
|
||||
|
||||
@@ -109,7 +109,7 @@ void CTerrain::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CTerrain::Update(_float fTimeDelta)
|
||||
{
|
||||
m_pVIBufferCom->Culling(XMMatrixIdentity());
|
||||
//m_pVIBufferCom->Culling(XMMatrixIdentity());
|
||||
|
||||
if(m_pGameInstance->Key_Down(DIK_LSHIFT) && m_pGameInstance->Key_Down(DIK_W))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
#include "Editor_Define.h"
|
||||
#include "MapContainer.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CShader;
|
||||
class CVIBuffer_Box;
|
||||
class COcclusionQuery;
|
||||
class CCollider;
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CBuildingContainer final : public CMapContainer
|
||||
@@ -17,7 +24,12 @@ class CBuildingContainer final : public CMapContainer
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Render_BoundingBox() override;
|
||||
|
||||
_float3 Get_BoundingBox_Min() { return vContainerMin; }
|
||||
_float3 Get_BoundingBox_Max() { return vContainerMax; }
|
||||
void Set_BoundingBox();
|
||||
_bool Is_OcclusionPassed() { return m_bOcclusionPassed; }
|
||||
public:
|
||||
template<typename T>
|
||||
HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) {
|
||||
@@ -39,7 +51,20 @@ class CBuildingContainer final : public CMapContainer
|
||||
|
||||
vector<class CPartObject*>* Get_Collision() { return &m_ColiisonPartObjects; }
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Box* m_pVIBufferCom = { nullptr };
|
||||
COcclusionQuery* m_pOcclusionQueryCom = { nullptr };
|
||||
CCollider* m_pCollider = { nullptr };
|
||||
|
||||
_bool m_bOcclusionPassed = { true };
|
||||
_float4x4 m_BoundingBoxWorldMatirx = {};
|
||||
_float3 m_vBoxCorners[8] = {};
|
||||
|
||||
_float3 m_vExtentPosition = {};
|
||||
_float3 m_vExtentRadius = {};
|
||||
_float3 vContainerMin = { 999.f, 999.f, 999.f };
|
||||
_float3 vContainerMax = { -999.f, -999.f, -999.f };
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Editor {
|
||||
#define FX_INSTANCE_PROP_MODEL TEXT("FX_INSTANCE_PROP_MODEL")
|
||||
#define FX_UIEDITOR TEXT("FX_UIEDITOR")
|
||||
#define FX_UIINSTANCE TEXT("FX_UIINSTANCE")
|
||||
|
||||
#define FX_VTXPOS TEXT("FX_VTXPOS")
|
||||
|
||||
#pragma endregion
|
||||
#pragma region MACRO_PROTOTYPE
|
||||
|
||||
@@ -25,6 +25,7 @@ class CMapContainer abstract : public CContainerObject
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
|
||||
virtual _string& Get_Name() { return m_strName; }
|
||||
virtual HRESULT Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class CMapObject_LOD final : public CMapObject // LOD 있는 애들
|
||||
|
||||
public:
|
||||
virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0);
|
||||
void Get_BoundingBox(_float3* pMinPosition, _float3* pMaxPosition);
|
||||
HRESULT Add_LodModel(const _tchar* pModelPrototypeTag);
|
||||
void Set_KeyIndex(_uint iIndex) {
|
||||
m_iKeyIndex = iIndex;
|
||||
@@ -41,6 +42,8 @@ class CMapObject_LOD final : public CMapObject // LOD 있는 애들
|
||||
|
||||
vector<_wstring> m_ModelPrototypeTags;
|
||||
vector<_uint> m_ModelPathIndices = { };
|
||||
_float3 m_CombinedExtendPosition = {};
|
||||
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
|
||||
@@ -15,6 +15,12 @@ RasterizerState RS_Nocull
|
||||
DepthClipEnable = false;
|
||||
};
|
||||
|
||||
RasterizerState RS_NocullOcclusion
|
||||
{
|
||||
FillMode = Solid;
|
||||
CullMode = None;
|
||||
};
|
||||
|
||||
RasterizerState RS_Nocull_Wireframe
|
||||
{
|
||||
FillMode = Wireframe;
|
||||
@@ -121,6 +127,12 @@ DepthStencilState DSS_Default_OutLine_Read
|
||||
BackFaceStencilFunc = Equal;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Occlusion
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
BlendState BS_None
|
||||
{
|
||||
BlendEnable[0] = false;
|
||||
@@ -233,6 +245,28 @@ BlendState BS_WeightBlend
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
BlendState BS_WhiteMask
|
||||
{
|
||||
BlendEnable[0] = false;
|
||||
BlendEnable[1] = false;
|
||||
BlendEnable[2] = false;
|
||||
BlendEnable[3] = false;
|
||||
BlendEnable[4] = false;
|
||||
BlendEnable[5] = false;
|
||||
BlendEnable[6] = false;
|
||||
BlendEnable[7] = false;
|
||||
|
||||
RenderTargetWriteMask[0] = 0;
|
||||
RenderTargetWriteMask[1] = 0;
|
||||
RenderTargetWriteMask[2] = 0;
|
||||
RenderTargetWriteMask[3] = 0;
|
||||
RenderTargetWriteMask[4] = 0;
|
||||
RenderTargetWriteMask[5] = 0;
|
||||
RenderTargetWriteMask[6] = 0;
|
||||
RenderTargetWriteMask[7] = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENGINE_SHADER_STATES_HLSLI
|
||||
|
||||
@@ -208,6 +208,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
<ClCompile Include="..\Private\DebugDraw.cpp" />
|
||||
<ClCompile Include="..\private\QuadTree.cpp" />
|
||||
<ClCompile Include="..\private\OcclusionQuery.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@@ -311,6 +312,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\private\UIObject.cpp" />
|
||||
<ClCompile Include="..\Private\Unit.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer.cpp" />
|
||||
<ClCompile Include="..\private\VIBuffer_Box.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Cell.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Cube.cpp" />
|
||||
<ClCompile Include="..\Private\Instance_Model.cpp" />
|
||||
@@ -423,6 +425,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\Bounding_Sphere.h" />
|
||||
<ClInclude Include="..\public\FSM.h" />
|
||||
<ClInclude Include="..\public\QuadTree.h" />
|
||||
<ClInclude Include="..\public\OcclusionQuery.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@@ -556,6 +559,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\public\UIObject.h" />
|
||||
<ClInclude Include="..\Public\Unit.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer.h" />
|
||||
<ClInclude Include="..\public\VIBuffer_Box.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Cell.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Cube.h" />
|
||||
<ClInclude Include="..\Public\Instance_Model.h" />
|
||||
|
||||
@@ -289,6 +289,12 @@
|
||||
<Filter Include="99.Define\99.THIRDPARTY\PHYSX">
|
||||
<UniqueIdentifier>{5948985e-f67e-4627-aca4-09b8e9edc359}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\02.VIBuffer\Box">
|
||||
<UniqueIdentifier>{f1ac53f8-59f6-4371-a48c-c331f337ebe7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\11.Query">
|
||||
<UniqueIdentifier>{432b36d5-fdf6-456a-bc71-8bf793a42314}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -546,6 +552,12 @@
|
||||
<ClCompile Include="..\Private\VIBuffer_Model_Instance.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\Model_Instance</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\OcclusionQuery.cpp">
|
||||
<Filter>02.Element\02.Component\11.Query</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\VIBuffer_Box.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Box</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1172,6 +1184,12 @@
|
||||
<ClInclude Include="..\Public\VIBuffer_Model_Instance.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\Model_Instance</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\OcclusionQuery.h">
|
||||
<Filter>02.Element\02.Component\11.Query</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\VIBuffer_Box.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Box</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "pch.h"
|
||||
#include "OcclusionQuery.h"
|
||||
|
||||
COcclusionQuery::COcclusionQuery(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CComponent(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs)
|
||||
:CComponent(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
void COcclusionQuery::Begin_Query()
|
||||
{
|
||||
m_pContext->Begin(m_pQuery);
|
||||
}
|
||||
|
||||
_bool COcclusionQuery::isDraw()
|
||||
{
|
||||
UINT64 iNumSample;
|
||||
|
||||
if (m_pContext->GetData(m_pQuery, &iNumSample, sizeof(UINT64), 0) != S_OK)
|
||||
return m_bPreFrameDraw;
|
||||
|
||||
0 < iNumSample ? m_bThisFrameDraw = true : m_bThisFrameDraw = false;
|
||||
|
||||
_bool bDraw = { false };
|
||||
|
||||
if(true == m_bThisFrameDraw)
|
||||
m_NumCullFrame = 0;
|
||||
else
|
||||
{
|
||||
if(m_NumCullFrame < 5)
|
||||
++m_NumCullFrame;
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw;
|
||||
|
||||
return m_NumCullFrame < 5;
|
||||
}
|
||||
|
||||
void COcclusionQuery::End_Query()
|
||||
{
|
||||
m_pContext->End(m_pQuery);
|
||||
}
|
||||
|
||||
HRESULT COcclusionQuery::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COcclusionQuery::Initialize(void* pArg)
|
||||
{
|
||||
D3D11_QUERY_DESC queryDesc = {};
|
||||
|
||||
queryDesc.Query = D3D11_QUERY_OCCLUSION;
|
||||
queryDesc.MiscFlags = 0;
|
||||
|
||||
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : ID3D11Query");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw = true;
|
||||
m_NumCullFrame = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
COcclusionQuery* COcclusionQuery::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
COcclusionQuery* pInstance = new COcclusionQuery(pDevice, pContext);
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : COcclusionQuery");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* COcclusionQuery::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
COcclusionQuery* pInstance = new COcclusionQuery(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : COcclusionQuery");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void COcclusionQuery::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pQuery);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void COcclusionQuery::Describe_Entity()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -57,13 +57,13 @@ void CRenderer::Render()
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
Render_Priority();
|
||||
Render_Shadow();
|
||||
Render_NonBlend();
|
||||
Render_LightAcc();
|
||||
Render_Blur();
|
||||
Render_Combined();
|
||||
Render_Occlusion();
|
||||
Render_Effect();
|
||||
Render_NonLight();
|
||||
Render_Blend();
|
||||
@@ -81,6 +81,26 @@ void CRenderer::Render()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].sort([](CGameObject* pSour, CGameObject* pDest)->_bool {
|
||||
return pSour->Get_Depth() < pDest->Get_Depth();
|
||||
});
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_BoundingBox())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pRenderObject);
|
||||
}
|
||||
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].clear();
|
||||
}
|
||||
|
||||
void CRenderer::Render_Priority()
|
||||
{
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRIORITY)])
|
||||
@@ -808,8 +828,6 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
m_pShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_DEFERRED, nullptr, nullptr);
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
#include "pch.h"
|
||||
#include "VIBuffer_Box.h"
|
||||
|
||||
CVIBuffer_Box::CVIBuffer_Box(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CVIBuffer(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CVIBuffer_Box::CVIBuffer_Box(const CVIBuffer_Box& rhs)
|
||||
: CVIBuffer(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Update(_float3* pVertexDatas)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE SubResource{};
|
||||
m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource);
|
||||
|
||||
VTXPOS* pVertices = static_cast<VTXPOS*>(SubResource.pData);
|
||||
|
||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||
{
|
||||
memcpy(&pVertices[i].vPosition, &pVertexDatas[i], sizeof(_float3));
|
||||
}
|
||||
|
||||
m_pContext->Unmap(m_pVB, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Initialize_Prototype()
|
||||
{
|
||||
m_iNumVertexBuffers = 1;
|
||||
m_iNumVertices = 8;
|
||||
m_iVertexStride = sizeof(VTXPOS);
|
||||
|
||||
m_iIndexStride = 2;
|
||||
m_iNumIndices = 36;
|
||||
|
||||
m_eIndexFormat = DXGI_FORMAT_R16_UINT;
|
||||
m_ePrimitive = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
|
||||
#pragma region IB_BUFFER
|
||||
D3D11_BUFFER_DESC IBDesc{};
|
||||
IBDesc.ByteWidth = m_iIndexStride * m_iNumIndices;
|
||||
IBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
IBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
IBDesc.StructureByteStride = m_iIndexStride;
|
||||
IBDesc.CPUAccessFlags = 0;
|
||||
IBDesc.MiscFlags = 0;
|
||||
|
||||
|
||||
_ushort* pIndices = new _ushort[m_iNumIndices];
|
||||
ZeroMemory(pIndices, sizeof(_ushort) * m_iNumIndices);
|
||||
|
||||
/* + x */
|
||||
pIndices[0] = 1; pIndices[1] = 5; pIndices[2] = 6;
|
||||
pIndices[3] = 1; pIndices[4] = 6; pIndices[5] = 2;
|
||||
|
||||
/* - x */
|
||||
pIndices[6] = 4; pIndices[7] = 0; pIndices[8] = 3;
|
||||
pIndices[9] = 4; pIndices[10] = 3; pIndices[11] = 7;
|
||||
|
||||
/* + y */
|
||||
pIndices[12] = 4; pIndices[13] = 5; pIndices[14] = 1;
|
||||
pIndices[15] = 4; pIndices[16] = 1; pIndices[17] = 0;
|
||||
|
||||
/* - y */
|
||||
pIndices[18] = 3; pIndices[19] = 2; pIndices[20] = 6;
|
||||
pIndices[21] = 3; pIndices[22] = 6; pIndices[23] = 7;
|
||||
|
||||
/* + z */
|
||||
pIndices[24] = 5; pIndices[25] = 4; pIndices[26] = 7;
|
||||
pIndices[27] = 5; pIndices[28] = 7; pIndices[29] = 6;
|
||||
|
||||
/* - z */
|
||||
pIndices[30] = 0; pIndices[31] = 1; pIndices[32] = 2;
|
||||
pIndices[33] = 0; pIndices[34] = 2; pIndices[35] = 3;
|
||||
|
||||
|
||||
D3D11_SUBRESOURCE_DATA IBRes{};
|
||||
IBRes.pSysMem = pIndices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &IBRes, &m_pIB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pIndices);
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Initialize(void* pArg)
|
||||
{
|
||||
if (nullptr == pArg)
|
||||
{
|
||||
#ifdef EDITOR_PROJECT
|
||||
if(FAILED(Ready_VIBuffer_Editor()))
|
||||
return E_FAIL;
|
||||
#else
|
||||
return E_FAIL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if(FAILED(Ready_VIBuffer(pArg)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Ready_VIBuffer(void* pArg)
|
||||
{
|
||||
_float3* pCorners = static_cast<_float3*>(pArg);
|
||||
|
||||
#pragma region VTX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
|
||||
VBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.CPUAccessFlags = 0;
|
||||
VBDesc.MiscFlags = 0;
|
||||
VBDesc.StructureByteStride = m_iVertexStride;
|
||||
|
||||
VTXPOS* pVertices = new VTXPOS[m_iNumVertices];
|
||||
memset(pVertices, 0, sizeof(VTXPOS) * m_iNumVertices);
|
||||
|
||||
pVertices[0].vPosition = pCorners[0];
|
||||
pVertices[1].vPosition = pCorners[1];
|
||||
pVertices[2].vPosition = pCorners[2];
|
||||
pVertices[3].vPosition = pCorners[3];
|
||||
pVertices[4].vPosition = pCorners[4];
|
||||
pVertices[5].vPosition = pCorners[5];
|
||||
pVertices[6].vPosition = pCorners[6];
|
||||
pVertices[7].vPosition = pCorners[7];
|
||||
|
||||
D3D11_SUBRESOURCE_DATA VBRes{};
|
||||
VBRes.pSysMem = pVertices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &VBRes, &m_pVB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT CVIBuffer_Box::Ready_VIBuffer_Editor()
|
||||
{
|
||||
#pragma region VTX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
|
||||
VBDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
VBDesc.MiscFlags = 0;
|
||||
VBDesc.StructureByteStride = m_iVertexStride;
|
||||
|
||||
VTXPOS* pVertices = new VTXPOS[m_iNumVertices];
|
||||
memset(pVertices, 0, sizeof(VTXPOS) * m_iNumVertices);
|
||||
|
||||
pVertices[0].vPosition = _float3(-0.5f, 0.5f, -0.5f);
|
||||
pVertices[1].vPosition = _float3(0.5f, 0.5f, -0.5f);
|
||||
pVertices[2].vPosition = _float3(0.5f, -0.5f, -0.5f);
|
||||
pVertices[3].vPosition = _float3(-0.5f, -0.5f, -0.5f);
|
||||
pVertices[4].vPosition = _float3(-0.5f, 0.5f, 0.5f);
|
||||
pVertices[5].vPosition = _float3(0.5f, 0.5f, 0.5f);
|
||||
pVertices[6].vPosition = _float3(0.5f, -0.5f, 0.5f);
|
||||
pVertices[7].vPosition = _float3(-0.5f, -0.5f, 0.5f);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA VBRes{};
|
||||
VBRes.pSysMem = pVertices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &VBRes, &m_pVB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
CVIBuffer_Box* CVIBuffer_Box::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CVIBuffer_Box* pInstance = new CVIBuffer_Box(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CVIBuffer_Rect");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CVIBuffer_Box* CVIBuffer_Box::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CVIBuffer_Box* pInstance = new CVIBuffer_Box(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CVIBuffer_Box");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CVIBuffer_Box::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CVIBuffer_Box::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
@@ -5,7 +5,7 @@ NS_BEGIN(Engine)
|
||||
enum class STATE { RIGHT, UP, LOOK, POSITION, END };
|
||||
enum class LIGHT { DIRECTIONAL, POINT, SPOT, END };
|
||||
enum class COLLIDER { AABB, OBB, SPHERE, END };
|
||||
enum class RENDER { PRIORITY, SHADOW, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, UI, END };
|
||||
enum class RENDER { OCCLUSION, PRIORITY, SHADOW, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, UI, END };
|
||||
enum class RAY { LOCAL, WORLD, END };
|
||||
enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END };
|
||||
|
||||
|
||||
@@ -240,6 +240,18 @@ typedef struct tagVertexPositionTexcoord {
|
||||
|
||||
}VTXPOSTEX;
|
||||
|
||||
typedef struct tagVertexPositionNormal {
|
||||
_float3 vPosition = {};
|
||||
_float3 vNormal = {};
|
||||
|
||||
static constexpr _uint iNumElements = { 2 };
|
||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }
|
||||
};
|
||||
|
||||
}VTXPOSNOR;
|
||||
|
||||
typedef struct tagVertexPositionNormalTexcoord {
|
||||
_float3 vPosition = {};
|
||||
_float3 vNormal = {};
|
||||
|
||||
@@ -255,6 +255,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
class CPhysX_Manager* m_pPhysX_Manager = { nullptr };
|
||||
class CPicking* m_pPicking = { nullptr };
|
||||
class CThreadHolder* m_pThreadHolder = { nullptr };
|
||||
class COcclusionQuery* m_pOcclusionQuery = { nullptr };
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,7 @@ class ENGINE_DLL CGameObject abstract
|
||||
virtual HRESULT Render_Blur() { return S_OK; }
|
||||
virtual HRESULT Render_Bloom() { return S_OK; }
|
||||
virtual HRESULT Render_OutLine() { return S_OK; }
|
||||
virtual HRESULT Render_BoundingBox() { return S_OK; }
|
||||
|
||||
virtual _float Get_Depth(); // z 소팅 할 때 쓰시면 됨
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL COcclusionQuery final : public CComponent
|
||||
{
|
||||
private:
|
||||
COcclusionQuery(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
COcclusionQuery(const COcclusionQuery& rhs);
|
||||
virtual ~COcclusionQuery() = default;
|
||||
|
||||
public:
|
||||
void Begin_Query();
|
||||
_bool isDraw();
|
||||
void End_Query();
|
||||
|
||||
private:
|
||||
ID3D11Query* m_pQuery = { nullptr };
|
||||
|
||||
_bool m_bPreFrameDraw = {};
|
||||
_bool m_bThisFrameDraw = {};
|
||||
_uint m_NumCullFrame = {};
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
static COcclusionQuery* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -16,7 +16,9 @@
|
||||
#include "FSM.h"
|
||||
#include "State.h"
|
||||
#include "VIBuffer_UI_Instance.h"
|
||||
#include "VIBuffer_Box.h"
|
||||
#include "Trail.h"
|
||||
#include "OcclusionQuery.h"
|
||||
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
@@ -40,6 +40,7 @@ class CRenderer final : public CBase
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
|
||||
ID3D11DepthStencilView* m_pShadowDSV = { nullptr };
|
||||
ID3D11DepthStencilView* m_pOcclusionDSV = { nullptr };
|
||||
|
||||
SHADOW_LIGHT_DESC m_PreShadowDesc = {};
|
||||
_float4x4 m_PreShadowMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
@@ -49,6 +50,7 @@ class CRenderer final : public CBase
|
||||
_float m_fThreshold = { 1.26f };
|
||||
|
||||
private:
|
||||
void Render_Occlusion();
|
||||
void Render_Priority();
|
||||
void Render_Shadow();
|
||||
void Render_NonBlend();
|
||||
@@ -71,6 +73,7 @@ class CRenderer final : public CBase
|
||||
|
||||
private:
|
||||
HRESULT Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
HRESULT Ready_OcclusionDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
|
||||
private:
|
||||
HRESULT Initialize();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "VIBuffer.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL CVIBuffer_Box final :
|
||||
public CVIBuffer
|
||||
{
|
||||
private:
|
||||
CVIBuffer_Box(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CVIBuffer_Box(const CVIBuffer_Box& rhs);
|
||||
virtual ~CVIBuffer_Box() = default;
|
||||
|
||||
public:
|
||||
virtual HRESULT Update(_float3* pVertices);
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
HRESULT Ready_VIBuffer(void* pArg);
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT Ready_VIBuffer_Editor();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static CVIBuffer_Box* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CVIBuffer_Box* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
Reference in New Issue
Block a user