Merge branch 'Develope' into Bloom

This commit is contained in:
kimnuri
2025-12-01 22:07:44 +09:00
15 changed files with 1768 additions and 52 deletions
@@ -68,7 +68,7 @@ HRESULT CLight_Main::Ready_Components()
{
return E_FAIL;
}
m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom);
return S_OK;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<MapLightObjects>
<Object Type="3" Lod_Level="0">
<PrototypeTag>Prototype_GameObject_SM_HM_LightPost</PrototypeTag>
<Position x="26.366684" y="0.44646791" z="36.957825"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
<Diffuse x="0.81999999" y="0.52999997" z="0.25"/>
<Ambient x="0.82999998" y="0.52999997" z="0.25"/>
<Specular x="0" y="0" z="0"/>
<PosOffset x="0" y="3.3" z="0"/>
<Info GlassIndex="0" BloomStrength="3.7000022" Range="5"/>
</Object>
<Object Type="3" Lod_Level="0">
<PrototypeTag>Prototype_GameObject_SM_HM_LightPost</PrototypeTag>
<Position x="17.501596" y="-4.5276604" z="-14.468103"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
<Diffuse x="1" y="0.60000002" z="0.30000001"/>
<Ambient x="1" y="0.60000002" z="0.30000001"/>
<Specular x="0" y="0" z="0"/>
<PosOffset x="0" y="3.3" z="0"/>
<Info GlassIndex="0" BloomStrength="3.5" Range="7"/>
</Object>
<Object Type="3" Lod_Level="0">
<PrototypeTag>Prototype_GameObject_SM_HM_LightPost</PrototypeTag>
<Position x="22.643427" y="-3.9982495" z="-15.436444"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
<Diffuse x="1" y="0.60000002" z="0.30000001"/>
<Ambient x="1" y="0.60000002" z="0.30000001"/>
<Specular x="0" y="0" z="0"/>
<PosOffset x="0" y="3.5" z="0"/>
<Info GlassIndex="0" BloomStrength="3.5" Range="6"/>
</Object>
</MapLightObjects>
@@ -2303,6 +2303,10 @@ HRESULT CLoader::Loading_For_MapViewer()
".fbx", true, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\LightFixtures",
".fbx", true, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
#pragma endregion
#ifdef gimch
+7 -3
View File
@@ -109,7 +109,7 @@ void CMainLight::Update(_float fTimeDelta)
//m_pLightCom->Set_Color(m_vCurDiffuse, m_vAmbient, m_vSpecular);
//m_pLightCom->Describe_Entity();
Describe_Entity();
}
void CMainLight::Late_Update(_float fTimeDelta)
@@ -130,8 +130,8 @@ HRESULT CMainLight::Ready_Components()
LIGHT_DESC LightDesc{};
LightDesc.eType = LIGHT::DIRECTIONAL;
LightDesc.vDiffuse = _float4(0.3f, 0.3f, 0.3f, 0.f);
LightDesc.vAmbient = _float4(0.3f, 0.3f, 0.3f, 0.f);
LightDesc.vDiffuse = _float4(0.3f, 0.3f, 0.1f, 0.f);
LightDesc.vAmbient = _float4(0.3f, 0.3f, 0.5f, 0.f);
LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 0.f);
LightDesc.pDirection = m_pTransformCom->Get_StatePtr(STATE::LOOK);
LightDesc.iLevel = NEXT_LEVEL;
@@ -142,6 +142,10 @@ HRESULT CMainLight::Ready_Components()
return E_FAIL;
}
m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom);
_float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f);
m_pGameInstance->Set_FogColor(vColor);
return S_OK;
}
@@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
#include "MapElement.h"
#include "GameInstance.h"
@@ -73,3 +73,8 @@ void CMapElement::Free()
void CMapElement::Describe_Entity()
{
}
HRESULT CMapElement::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)
{
return S_OK;
}
@@ -78,10 +78,32 @@ void CMapElement_Light::Late_Update(_float fTimeDelta)
}
#endif
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
if(m_bOnLight)
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius()))
{
if (m_isLightOn)
{
_float fDistance = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - m_pTransformCom->Get_State(STATE::POSITION)));
if (m_LightAdded_Distance > fDistance) // 카메라 범위 안
{
if(!m_isLightAdded)
{
m_isLightAdded = true;
m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom);
}
}
else
{
if (m_isLightAdded)
{
m_isLightAdded = false;
m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom);
}
}
m_pGameInstance->Add_RenderGroup(RENDER::BLOOM, this);
}
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
}
@@ -94,7 +116,7 @@ HRESULT CMapElement_Light::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
if (true == m_bOnLight && m_iGlassMeshIndex == i)
if (true == m_isLightOn && m_iGlassMeshIndex == i)
continue;
if (m_iGlassMeshIndex == i)
@@ -121,7 +143,7 @@ HRESULT CMapElement_Light::Render()
}
else
{
if (FAILED(m_pModelComs[0]->Bind_Material(1, m_pShaderCom))) {
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
@@ -191,12 +213,16 @@ HRESULT CMapElement_Light::Ready_Components(void* pArg)
LightDesc.fRange = pDesc->fRange;
LightDesc.iLevel = NEXT_LEVEL;
LightDesc.pPosition = m_pTransformCom->Get_StatePtr(STATE::POSITION);
/* Com_Light*/
if (FAILED(Add_Component<CLight>(g_iStaticLevel, &m_pLightCom, &LightDesc)))
{
return E_FAIL;
}
if(false == pDesc->isPow)
m_pLightCom->Switch_LightAttenationMethod();
return S_OK;
}
@@ -245,12 +271,12 @@ HRESULT CMapElement_Light::Render_Bloom()
void CMapElement_Light::Toggle_Light()
{
if (m_bOnLight)
if (m_isLightOn)
m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom);
else
m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom);
m_bOnLight = !m_bOnLight;
m_isLightAdded = m_isLightOn = !m_isLightOn;
}
CMapElement_Light* CMapElement_Light::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -302,7 +328,7 @@ void CMapElement_Light::Describe_Entity()
if (nullptr == m_pGameInstance)
return;
GUI::Text("LIGHT ");
GUI::InputFloat("Distacne", &m_LightAdded_Distance, 1.f, 10.f);
if (GUI::Button("Light ON / OFF"))
Toggle_Light();
@@ -345,3 +371,99 @@ void CMapElement_Light::Describe_Entity()
m_bSelected = true;
}
HRESULT CMapElement_Light::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)
{
tinyxml2::XMLElement* object = doc.NewElement("Object");
object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_LIGHT));
object->SetAttribute("Lod_Level", m_iLodIndex);
root->InsertEndChild(object);
#pragma region PROTOTYPETAG
for (_uint i = 0; i < m_iLodIndex + 1; ++i)
{
tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag");
prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str());
object->InsertEndChild(prototype);
}
#pragma endregion
#pragma region TRANSFORM
_float3 vPosition = {};
XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION));
_float3 vScale = m_pTransformCom->Get_Scale();
_float3 vRotation = {};
XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector());
vRotation.x = XMConvertToDegrees(vRotation.x);
vRotation.y = XMConvertToDegrees(vRotation.y);
vRotation.z = XMConvertToDegrees(vRotation.z);
tinyxml2::XMLElement* Position = doc.NewElement("Position");
Position->SetAttribute("x", vPosition.x);
Position->SetAttribute("y", vPosition.y);
Position->SetAttribute("z", vPosition.z);
object->InsertEndChild(Position);
tinyxml2::XMLElement* Scale = doc.NewElement("Scale");
Scale->SetAttribute("x", vScale.x);
Scale->SetAttribute("y", vScale.y);
Scale->SetAttribute("z", vScale.z);
object->InsertEndChild(Scale);
tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation");
Rotation->SetAttribute("x", vRotation.x);
Rotation->SetAttribute("y", vRotation.y);
Rotation->SetAttribute("z", vRotation.z);
object->InsertEndChild(Rotation);
#pragma endregion
#pragma region LIGHT_DESC
const LIGHT_DESC* pLight = m_pLightCom->Get_LightDesc();
/* Diffuse */
tinyxml2::XMLElement* Diffuse = doc.NewElement("Diffuse");
Diffuse->SetAttribute("x", pLight->vDiffuse.x);
Diffuse->SetAttribute("y", pLight->vDiffuse.y);
Diffuse->SetAttribute("z", pLight->vDiffuse.z);
object->InsertEndChild(Diffuse);
/* Ambient */
tinyxml2::XMLElement* Ambient = doc.NewElement("Ambient");
Ambient->SetAttribute("x", pLight->vAmbient.x);
Ambient->SetAttribute("y", pLight->vAmbient.y);
Ambient->SetAttribute("z", pLight->vAmbient.z);
object->InsertEndChild(Ambient);
/* Specular */
tinyxml2::XMLElement* Specular = doc.NewElement("Specular");
Specular->SetAttribute("x", pLight->vSpecular.x);
Specular->SetAttribute("y", pLight->vSpecular.y);
Specular->SetAttribute("z", pLight->vSpecular.z);
object->InsertEndChild(Specular);
/* PosOffset */
tinyxml2::XMLElement* PosOffset = doc.NewElement("PosOffset");
PosOffset->SetAttribute("x", pLight->vPosOffset.x);
PosOffset->SetAttribute("y", pLight->vPosOffset.y);
PosOffset->SetAttribute("z", pLight->vPosOffset.z);
object->InsertEndChild(PosOffset);
/* Info */
tinyxml2::XMLElement* Info = doc.NewElement("Info");
Info->SetAttribute("GlassIndex", m_iGlassMeshIndex);
Info->SetAttribute("BloomStrength", m_fBloomStrength);
Info->SetAttribute("Range", pLight->fRange);
if(false == m_pLightCom->Is_PowerLightAtt())
Info->SetAttribute("Pow", 0);
else
Info->SetAttribute("Pow", 1);
object->InsertEndChild(Info);
#pragma endregion
return S_OK;
}
@@ -58,6 +58,11 @@ HRESULT CMapObject_Manager::Initialize(void* pArg)
m_iContainerObjectIndex = 99;
//m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object<CBuildingContainer>();
if (FAILED(Load_MapData("Map1129")))
return E_FAIL;
/*if (FAILED(Load_LightObject("LightElement")))
return E_FAIL;
*/
return S_OK;
}
@@ -75,7 +80,7 @@ void CMapObject_Manager::Priority_Update(_float fTimeDelta)
void CMapObject_Manager::Update(_float fTimeDelta)
{
GUI::Begin("File");
GUI::Begin("Map Manager");
const char* ModeNames[4] =
{
"CONTAINER",
@@ -107,6 +112,20 @@ void CMapObject_Manager::Update(_float fTimeDelta)
Save_ContainerData("ContainerTest", m_szSaveContainerName);
}
}
else if (ADD_TYPE::ELEMENT_LIGHT == m_eType)
{
GUI::InputInt("GlassIndex", &m_iGlassIndex);
m_iGlassIndex = min(1, m_iGlassIndex);
if (GUI::Button("Save_LightElements"))
{
Save_LightObject(m_szSaveContainerName);
}
if (GUI::Button("Load_LightElements"))
{
Load_LightObject(m_szSaveContainerName);
}
}
if (GUI::Button("Load_Container"))
{
Load_ContainerData("ContainerTest", m_szSaveContainerName);
@@ -1140,13 +1159,143 @@ HRESULT CMapObject_Manager::Load_ContainerToMapObject(const _char* pFileName, co
return S_OK;
}
HRESULT CMapObject_Manager::Save_LightObject(const _char* pFileName)
{
CLayer* pLayer;
pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Light"));
if (nullptr == pLayer)
return S_OK;
tinyxml2::XMLDocument doc;
string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml";
tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str());
doc.Clear();
doc.InsertFirstChild(doc.NewDeclaration());
tinyxml2::XMLElement* root = doc.NewElement("MapLightObjects");
doc.InsertEndChild(root);
if (nullptr != pLayer)
{
const list<CGameObject*>* pList = pLayer->Get_Objects();
for (auto pGamObject : *pList)
{
CMapElement* pElement = dynamic_cast<CMapElement*>(pGamObject);
if (nullptr == pElement)
return E_FAIL;
if (FAILED(pElement->Save_XML(doc, root)))
return E_FAIL;
}
#pragma endregion
}
if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) {
MSG_BOX("Failed to Save File");
}
else
{
MSG_BOX("Succeed to Save File");
}
return S_OK;
}
#pragma endregion
HRESULT CMapObject_Manager::Load_LightObject(const _char* pFileName)
{
tinyxml2::XMLDocument xmlDoc;
string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml";
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
return E_FAIL;
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects");
if (nullptr == root)
{
MSG_BOX("Failed to Find root");
return S_OK;
}
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
{
CMapElement_Light::MAPELEMENT_LIGHT_DESC Desc = {};
/* Model Prototypes */
Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel);
string strTag = {};
for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
{
strTag = PrototypeTag->GetText();
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
}
/* Transform */
auto* Position = Object->FirstChildElement("Position");
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
auto* Scale = Object->FirstChildElement("Scale");
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
auto* Rotation = Object->FirstChildElement("Rotation");
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
/* Light Desc */
auto* Diffuse = Object->FirstChildElement("Diffuse");
Diffuse->QueryFloatAttribute("x", &Desc.vDiffuse.x);
Diffuse->QueryFloatAttribute("y", &Desc.vDiffuse.y);
Diffuse->QueryFloatAttribute("z", &Desc.vDiffuse.z);
auto* Ambient = Object->FirstChildElement("Ambient");
Ambient->QueryFloatAttribute("x", &Desc.vAmbient.x);
Ambient->QueryFloatAttribute("y", &Desc.vAmbient.y);
Ambient->QueryFloatAttribute("z", &Desc.vAmbient.z);
auto* Specular = Object->FirstChildElement("Specular");
Specular->QueryFloatAttribute("x", &Desc.vSpecular.x);
Specular->QueryFloatAttribute("y", &Desc.vSpecular.y);
Specular->QueryFloatAttribute("z", &Desc.vSpecular.z);
auto* PosOffset = Object->FirstChildElement("PosOffset");
PosOffset->QueryFloatAttribute("x", &Desc.vPosOffset.x);
PosOffset->QueryFloatAttribute("y", &Desc.vPosOffset.y);
PosOffset->QueryFloatAttribute("z", &Desc.vPosOffset.z);
auto* Info = Object->FirstChildElement("Info");
Info->QueryUnsignedAttribute("GlassIndex", &Desc.iGlassMeshIndex);
Info->QueryFloatAttribute("BloomStrength", &Desc.fBloomStregth);
Info->QueryFloatAttribute("Range", &Desc.fRange);
_uint iPow = {};
Info->QueryUnsignedAttribute("Pow", &iPow);
Desc.isPow = 0 == iPow ? false : true;
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Light>(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Desc)))
return E_FAIL;
}
MSG_BOX("Successed to Load File");
return S_OK;
}
void CMapObject_Manager::Update_PrototypeList()
{
GUI::Begin("Model Prototype List");
@@ -1470,15 +1619,20 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag)
}
else if (ADD_TYPE::ELEMENT_LIGHT == m_eType)
{
Light_Desc.iGlassMeshIndex = 0;
Light_Desc.fBloomStregth = 3.5f;
Light_Desc.fRange = 10.f;
Light_Desc.vDiffuse = _float4(1.f, 0.6f, 0.3f, 1.f);
Light_Desc.vAmbient = _float4(1.f, 0.6f, 0.3f, 1.f);
Light_Desc.isPow = false;
Light_Desc.iGlassMeshIndex = m_iGlassIndex;
Light_Desc.fBloomStregth = 4.5f;
Light_Desc.fRange = 7.f;
Light_Desc.vDiffuse = _float4(1.f, 0.6f, 0.2f, 1.f);
Light_Desc.vAmbient = _float4(1.f, 0.64f, 0.2f, 1.f);
Light_Desc.vSpecular = _float4(0.f, 0.f, 0.f, 1.f);
Light_Desc.vPosOffset = _float4(0.f, 3.5f, 0.f, 1.f);
Light_Desc.vPosOffset = _float4(0.f, 3.3f, 0.f, 1.f);
CMapElement_Light* pElement = { nullptr };
m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Light>(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Light_Desc);
m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Light>(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Light_Desc, nullptr, &pElement);
m_pSelectElemnt = pElement;
}
}
@@ -15,7 +15,7 @@ namespace Editor
enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, BLOOM, END };
enum class COLLIDABLEOBJECT { PLAYER, MONSTER, HOSTILE_HITBOX, ALLY_HITBOX, NEUTRAL_HITBOX, ENVIRIONMENT, NPC, ITEM, TRIGGERBOX, REGION, NOCOLLIDE, END };
enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT };
enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT, ELEMENT_LIGHT };
enum class MAPOBJECT_RENDER_TYPE { NORMAL, DECAL, GLASS };
enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, HAIR, EYELASH, OUTLINE_WRITE, OUTLINE_READ, END };
@@ -27,6 +27,9 @@ class CMapElement abstract : public CGameObject
virtual void Late_Update(_float fTimeDelta) override;
virtual HRESULT Render() override;
protected:
_bool m_bSelected = { false };
_uint m_iMaxLodLevel = {};
@@ -53,6 +56,8 @@ class CMapElement abstract : public CGameObject
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) PURE;
virtual void Free() override;
void Describe_Entity() override;
virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root);
};
NS_END
@@ -15,6 +15,7 @@ class CMapElement_Light : public CMapElement
public:
typedef struct MapElement_Light_Desc : MAPOBJECT_LOD_DESC
{
_bool isPow;
_uint iGlassMeshIndex;
_float fBloomStregth;
_float fRange;
@@ -44,11 +45,14 @@ class CMapElement_Light : public CMapElement
CTexture* m_pMaskTextureCom = { nullptr };
CTexture* m_pGlassTextureCom = { nullptr };
_bool m_bOnLight = { true };
_bool m_isLightOn = { true };
_bool m_isLightAdded = { false };
_uint m_iGlassMeshIndex = {};
_float m_fBloomStrength = {1.f};
_float m_fGlassRatio = { 0.5f };
_float m_LightAdded_Distance = { 5000.f };
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
@@ -61,6 +65,7 @@ class CMapElement_Light : public CMapElement
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
void Describe_Entity() override;
virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root);
};
NS_END
@@ -22,9 +22,9 @@ class CMapObject_Manager final : public CGameObject
public:
virtual HRESULT Initialize_Prototype(vector<_wstring>& ModelPrototypeTags, vector<filesystem::path>& ModelPrototypePaths);
virtual HRESULT Initialize(void* pArg) override;
virtual void Priority_Update(_float fTimeDelta) override;
virtual void Update(_float fTimeDelta) override;
virtual void Late_Update(_float fTimeDelta) override;
virtual void Priority_Update(_float fTimeDelta) override;
virtual void Update(_float fTimeDelta) override;
virtual void Late_Update(_float fTimeDelta) override;
virtual HRESULT Render() override;
const filesystem::path Get_PrototypePath(_uint iModelIndex);
@@ -45,6 +45,7 @@ class CMapObject_Manager final : public CGameObject
vector<filesystem::path> m_ModelPrototypePaths;
_uint m_iContainerObjectIndex = {};
_int m_iGlassIndex = { 1 };
class CBuildingContainer* m_pContainer = { nullptr };
_char m_szSaveFileName[MAX_PATH] = {};
@@ -62,6 +63,7 @@ class CMapObject_Manager final : public CGameObject
HRESULT Load_ContainerToMapObject(const _char* pFileName, const _char* pContainerName);
HRESULT Save_LightObject(const _char* pFileName);
HRESULT Load_LightObject(const _char* pFileName);
#pragma endregion
void Update_PrototypeList();
-2
View File
@@ -52,8 +52,6 @@ HRESULT CLight::Initialize(void* pArg)
m_LightDesc = *pLightDesc;
m_pGameInstance->Add_Light(m_LightDesc.iLevel, this);
return S_OK;
}
@@ -13,36 +13,54 @@ COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs)
void COcclusionQuery::Begin_Query()
{
m_pContext->Begin(m_pQuery);
m_pContext->Begin(m_pQuery[m_iCountFrame]);
}
_bool COcclusionQuery::isDraw()
{
UINT64 iNumSample;
if (m_pContext->GetData(m_pQuery, &iNumSample, sizeof(UINT64), 0) != S_OK)
return m_bPreFrameDraw;
static int sCheckFrame = 0;
0 < iNumSample ? m_bThisFrameDraw = true : m_bThisFrameDraw = false;
bool bVisible = m_bPreFrameDraw;
_bool bDraw = { false };
if(true == m_bThisFrameDraw)
m_NumCullFrame = 0;
else
if (++sCheckFrame >= 5)
{
if(m_NumCullFrame < 5)
++m_NumCullFrame;
sCheckFrame = 0;
UINT64 sampleCount = 0;
HRESULT hr = m_pContext->GetData(
m_pQuery[m_iGetFrameIndex],
&sampleCount,
sizeof(UINT64),
D3D11_ASYNC_GETDATA_DONOTFLUSH
);
if (hr == S_OK)
{
bVisible = (sampleCount > 0);
}
}
m_bPreFrameDraw = m_bThisFrameDraw;
if (bVisible)
{
m_iNumCullFrame = 0;
}
else
{
if (m_iNumCullFrame < 2)
++m_iNumCullFrame;
}
return m_NumCullFrame < 5;
m_bPreFrameDraw = bVisible;
return (m_iNumCullFrame < 2);
}
void COcclusionQuery::End_Query()
{
m_pContext->End(m_pQuery);
m_pContext->End(m_pQuery[m_iCountFrame]);
m_iGetFrameIndex = (m_iCountFrame + 5 - 1) % 5;
m_iCountFrame = (m_iCountFrame + 1) % 5;
}
HRESULT COcclusionQuery::Initialize_Prototype()
@@ -57,14 +75,17 @@ HRESULT COcclusionQuery::Initialize(void* pArg)
queryDesc.Query = D3D11_QUERY_OCCLUSION;
queryDesc.MiscFlags = 0;
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery)))
for (_uint i = 0; i < 5; i++)
{
MSG_BOX("Failed to Created : ID3D11Query");
return E_FAIL;
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery[i])))
{
MSG_BOX("Failed to Created : ID3D11Query");
return E_FAIL;
}
}
m_bPreFrameDraw = m_bThisFrameDraw = true;
m_NumCullFrame = 0;
m_iNumCullFrame = 0;
return S_OK;
}
@@ -99,7 +120,9 @@ void COcclusionQuery::Free()
{
__super::Free();
SAFE_RELEASE(m_pQuery);
for(auto& pQuery : m_pQuery)
SAFE_RELEASE(pQuery);
}
#ifdef _DEBUG
@@ -17,11 +17,13 @@ class ENGINE_DLL COcclusionQuery final : public CComponent
void End_Query();
private:
ID3D11Query* m_pQuery = { nullptr };
ID3D11Query* m_pQuery[5] = {};
_bool m_bPreFrameDraw = {};
_bool m_bThisFrameDraw = {};
_uint m_NumCullFrame = {};
_uint m_iNumCullFrame = {};
_uint m_iCountFrame = {};
_uint m_iGetFrameIndex = {};
private:
virtual HRESULT Initialize_Prototype() override;