[add] Client 조명 오브젝트 추가, MainLight Fog 색상 변경
@@ -164,6 +164,8 @@ call Update_Resources.bat
|
||||
<ClInclude Include="..\Public\Magic_Icon.h" />
|
||||
<ClInclude Include="..\Public\Magic_Item.h" />
|
||||
<ClInclude Include="..\Public\Magic_Meter.h" />
|
||||
<ClInclude Include="..\public\MapElement.h" />
|
||||
<ClInclude Include="..\public\MapElement_Light.h" />
|
||||
<ClInclude Include="..\Public\Potion.h" />
|
||||
<ClInclude Include="..\Public\Protego.h" />
|
||||
<ClInclude Include="..\Public\Bombard.h" />
|
||||
@@ -255,6 +257,8 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\Private\Magic_Icon.cpp" />
|
||||
<ClCompile Include="..\Private\Magic_Item.cpp" />
|
||||
<ClCompile Include="..\Private\Magic_Meter.cpp" />
|
||||
<ClCompile Include="..\private\MapElement.cpp" />
|
||||
<ClCompile Include="..\private\MapElement_Light.cpp" />
|
||||
<ClCompile Include="..\Private\Potion.cpp" />
|
||||
<ClCompile Include="..\Private\Protego.cpp" />
|
||||
<ClCompile Include="..\Private\Bombard.cpp" />
|
||||
|
||||
@@ -268,6 +268,18 @@
|
||||
<ClInclude Include="..\Public\Troll_Weapon.h">
|
||||
<Filter>02.GameObjects\Item\Troll_Weapon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\MapElement.h">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\MapElement_Light.h">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement\Light</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\MapElement.h">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\MapElement_Light.h">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement\Light</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Client.ico">
|
||||
@@ -578,6 +590,18 @@
|
||||
<Filter Include="04.Mechanic\Skill\Skill_Data">
|
||||
<UniqueIdentifier>{2bc5b43e-0e24-49d4-95b0-549ad4428201}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\03.MapElement">
|
||||
<UniqueIdentifier>{f3f219aa-034f-4aa2-9f2e-d75d15bd1f4a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\03.MapElement\Light">
|
||||
<UniqueIdentifier>{71f6a568-488d-4ec1-be79-8fcce6677e27}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\03.MapElement">
|
||||
<UniqueIdentifier>{f3f219aa-034f-4aa2-9f2e-d75d15bd1f4a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\03.MapElement\Light">
|
||||
<UniqueIdentifier>{71f6a568-488d-4ec1-be79-8fcce6677e27}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Monster\Troll">
|
||||
<UniqueIdentifier>{a1b1f17d-ed4f-4b20-aa8e-c52e693683d4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -838,6 +862,18 @@
|
||||
<ClCompile Include="..\private\Skill_Data.cpp">
|
||||
<Filter>04.Mechanic\Skill\Skill_Data</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\MapElement.cpp">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\MapElement_Light.cpp">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement\Light</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\MapElement.cpp">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\MapElement_Light.cpp">
|
||||
<Filter>02.GameObjects\Environment\03.MapElement\Light</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Troll.cpp">
|
||||
<Filter>02.GameObjects\Monster\Troll</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -25,7 +25,7 @@ void CBuildingContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
m_fCamDepth = XMVectorGetX(XMVector3Length(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition)));
|
||||
m_fCamDepth = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - XMLoadFloat3(&m_vExtentWorldPosition)));
|
||||
|
||||
for (auto& pCollisiton : m_ColiisonPartObjects){
|
||||
pCollisiton->Update(fTimeDelta);
|
||||
|
||||
@@ -81,6 +81,10 @@ HRESULT CInfoInstance::Load_MapObjects(const _char* pFilePath)
|
||||
{
|
||||
return m_pMapInfo->Load_MapObjects(pFilePath);
|
||||
}
|
||||
HRESULT CInfoInstance::Load_LightElements(const _char* pFilePath)
|
||||
{
|
||||
return m_pMapInfo->Load_LightElements(pFilePath);
|
||||
}
|
||||
#pragma endregion
|
||||
LEVEL CInfoInstance::Get_RestartLevel()
|
||||
{
|
||||
|
||||
@@ -120,10 +120,13 @@ HRESULT CLevel_GamePlay::Ready_Background()
|
||||
|
||||
/* Map Containters */
|
||||
/* 테스트용 맵 */
|
||||
// CInfoInstance::GetInstance()->Load_MapObjects("ClientTest");
|
||||
//CInfoInstance::GetInstance()->Load_MapObjects("ClientTest");
|
||||
/* 전체 맵 */
|
||||
CInfoInstance::GetInstance()->Load_MapObjects("Map1129");
|
||||
|
||||
/* 조명 오브젝트 */
|
||||
CInfoInstance::GetInstance()->Load_LightElements("LightElement");
|
||||
|
||||
|
||||
CInstancedProp::INSTANCE_PROP_DESC Desc = {};
|
||||
|
||||
|
||||
@@ -57,8 +57,11 @@ HRESULT CLight_Main::Ready_Components()
|
||||
LIGHT_DESC LightDesc{};
|
||||
|
||||
LightDesc.eType = LIGHT::DIRECTIONAL;
|
||||
LightDesc.vDiffuse = _float4(0.8f, 0.8f, 0.8f, 0.f);
|
||||
/*LightDesc.vDiffuse = _float4(0.8f, 0.8f, 0.8f, 0.f);
|
||||
LightDesc.vAmbient = _float4(0.6f, 0.6f, 0.6f, 0.f);
|
||||
LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 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;
|
||||
@@ -70,6 +73,10 @@ HRESULT CLight_Main::Ready_Components()
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
#include "MapObject_Render.h"
|
||||
#include "MapObject_Collision.h"
|
||||
#include "InstancedProp.h"
|
||||
#include "MapElement_Light.h"
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -435,6 +436,12 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
".bin", false
|
||||
));
|
||||
}
|
||||
{/* Light Objects */
|
||||
jobMapModels.emplace_back(Deferred_FolderLoad(
|
||||
"../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/LightPosts",
|
||||
".bin", false
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
@@ -636,6 +643,27 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Terrain/Hogsmeade_AlphaMap.dds"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* For.Prototype_Component_LightPost_Emissive */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Emissive"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE,
|
||||
TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_E.png"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* For.Prototype_Component_LightPost_Mask */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Mask"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE,
|
||||
TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_D.png"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* For.Prototype_Component_LightPost_Base */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Base"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE,
|
||||
TEXT("C:/MeshTable/Game/Environment/Hogsmeade/Common/Textures/LightPosts/T_HM_LampPost_Glass_Dark_D.png"), 0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -1028,6 +1056,8 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"),
|
||||
CVIBuffer_Model_Instance::Create(m_pDevice, m_pContext,
|
||||
@@ -1075,6 +1105,11 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
/* For.Prototype_GameObject_CInstancedProp */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CInstancedProp>(g_iStaticLevel, CInstancedProp::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_MapElement_Light */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Light>(g_iStaticLevel, CMapElement_Light::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
#pragma endregion // MAP PROTOTYPE
|
||||
|
||||
#pragma region ACTOR PROTOTYPE
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "pch.h"
|
||||
#include "MapElement.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
|
||||
CMapElement::CMapElement(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CMapElement::CMapElement(const CMapElement& rhs)
|
||||
: CGameObject(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapElement::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapElement::Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapElement::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CMapElement::Render()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement::Bind_ShaderResources()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMapElement::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMapElement::Describe_Entity()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,310 @@
|
||||
#include "pch.h"
|
||||
#include "MapElement_Light.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
|
||||
#include "Terrain.h"
|
||||
#include "Layer.h"
|
||||
#include "VIBuffer_Terrain.h"
|
||||
|
||||
CMapElement_Light::CMapElement_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CMapElement{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CMapElement_Light::CMapElement_Light(const CMapElement_Light& rhs)
|
||||
: CMapElement(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Initialize(void* pArg)
|
||||
{
|
||||
MAPELEMENT_LIGHT_DESC* pDesc = static_cast<MAPELEMENT_LIGHT_DESC*>(pArg);
|
||||
|
||||
m_iMaxLodLevel = pDesc->iMaxLodLevel;
|
||||
m_fBloomStrength = pDesc->fBloomStregth;
|
||||
m_iGlassMeshIndex = pDesc->iGlassMeshIndex;
|
||||
|
||||
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
|
||||
{
|
||||
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
|
||||
//m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]);
|
||||
}
|
||||
|
||||
if (FAILED(__super::Initialize(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Ready_Components(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void CMapElement_Light::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapElement_Light::Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapElement_Light::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Render()
|
||||
{
|
||||
if (FAILED(Bind_ShaderResources()))
|
||||
return E_FAIL;
|
||||
|
||||
_uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (true == m_isLightOn && m_iGlassMeshIndex == i)
|
||||
continue;
|
||||
|
||||
if (m_iGlassMeshIndex == i)
|
||||
{
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(m_iGlassMeshIndex, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_SRV("g_DiffuseTexture", m_pGlassTextureCom->Get_SRV(0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_SRV("g_GlassTexture", m_pMaskTextureCom->Get_SRV(0)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fGlassRatio", &m_fGlassRatio, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::GLASS)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i)
|
||||
{
|
||||
CModel* pModel = { nullptr };
|
||||
|
||||
/* Com_Model */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i],
|
||||
reinterpret_cast<CComponent**>(&pModel))))
|
||||
return E_FAIL;
|
||||
|
||||
m_pModelComs.push_back(pModel);
|
||||
}
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_Texture */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Emissive"),
|
||||
reinterpret_cast<CComponent**>(&m_pEmissiveTextureCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_Texture */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Mask"),
|
||||
reinterpret_cast<CComponent**>(&m_pMaskTextureCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_Texture */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("LightPost_Base"),
|
||||
reinterpret_cast<CComponent**>(&m_pGlassTextureCom))))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
MAPELEMENT_LIGHT_DESC* pDesc = static_cast<MAPELEMENT_LIGHT_DESC*>(pArg);
|
||||
|
||||
LIGHT_DESC LightDesc{};
|
||||
|
||||
LightDesc.eType = LIGHT::POINT;
|
||||
|
||||
memcpy(&LightDesc.vDiffuse, &pDesc->vDiffuse, sizeof(_float4));
|
||||
memcpy(&LightDesc.vAmbient, &pDesc->vAmbient, sizeof(_float4));
|
||||
memcpy(&LightDesc.vSpecular, &pDesc->vSpecular, sizeof(_float4));
|
||||
memcpy(&LightDesc.vPosOffset, &pDesc->vPosOffset, sizeof(_float4));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Bind_ShaderResources()
|
||||
{
|
||||
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->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Light::Render_Bloom()
|
||||
{
|
||||
if (FAILED(Bind_ShaderResources()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fBloomStrength", &m_fBloomStrength, sizeof(_float))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_SRV("g_EmissiveTexture", m_pEmissiveTextureCom->Get_SRV(0))))
|
||||
return E_FAIL;
|
||||
if (FAILED(m_pShaderCom->Bind_SRV("g_DiffuseTexture", m_pGlassTextureCom->Get_SRV(0))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::BLOOM)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelComs[m_iLodIndex]->Render(m_iGlassMeshIndex))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMapElement_Light::Toggle_Light()
|
||||
{
|
||||
if (m_isLightOn)
|
||||
m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom);
|
||||
else
|
||||
m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom);
|
||||
|
||||
m_isLightAdded = m_isLightOn = !m_isLightOn;
|
||||
}
|
||||
|
||||
CMapElement_Light* CMapElement_Light::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CMapElement_Light* pInstance = new CMapElement_Light(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMapElement_Light");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CMapElement_Light::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CMapElement_Light* pInstance = new CMapElement_Light(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CMapElement_Light");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CMapElement_Light::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pLightCom);
|
||||
SAFE_RELEASE(m_pEmissiveTextureCom);
|
||||
SAFE_RELEASE(m_pMaskTextureCom);
|
||||
SAFE_RELEASE(m_pGlassTextureCom);
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
for (auto& pModel : m_pModelComs)
|
||||
SAFE_RELEASE(pModel);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMapElement_Light::Describe_Entity()
|
||||
{
|
||||
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "MAPPartObject.h"
|
||||
#include "MapObject_Render.h"
|
||||
#include "MapObject_Collision.h"
|
||||
#include "MapElement_Light.h"
|
||||
|
||||
CMapInfo::CMapInfo()
|
||||
{
|
||||
@@ -269,6 +270,96 @@ HRESULT CMapInfo::Load_MapCollisionObjects(tinyxml2::XMLElement* Container, CMap
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_LightElements(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;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
|
||||
{
|
||||
m_pGameInstance = CGameInstance::GetInstance();
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Client
|
||||
|
||||
enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, HAIR, EYELASH, OUTLINE_WRITE, OUTLINE_READ, END };
|
||||
enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, END };
|
||||
enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL, GLASS, OUTLINE_WRITE, OUTLINE_READ, END };
|
||||
enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL, GLASS, OUTLINE_WRITE, OUTLINE_READ, BLOOM, END };
|
||||
enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, ENV_TERRAIN_ANISO, END };
|
||||
enum class SHADER_PASS_PARTICLE { EXPLOSION, END };
|
||||
enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, TRAIL_BLUR, TRAIL_BLOOM, END };
|
||||
|
||||
@@ -40,6 +40,7 @@ class CInfoInstance final : public CBase
|
||||
#pragma endregion
|
||||
#pragma region MAP_INFO
|
||||
HRESULT Load_MapObjects(const _char* pFilePath);
|
||||
HRESULT Load_LightElements(const _char* pFilePath);
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "Client_Define.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CModel;
|
||||
class CShader;
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CMapElement abstract : public CGameObject
|
||||
{
|
||||
public:
|
||||
typedef struct tagMapElement_Desc {
|
||||
_uint iRenderType{};
|
||||
CTransform* pParentTransform = { nullptr };
|
||||
_float3 vScale;
|
||||
_float3 vRotation;
|
||||
_float3 vPosition;
|
||||
_uint iMaxLodLevel{};
|
||||
vector<_wstring> ModelPrototypeTags;
|
||||
vector<_uint>* pModelPathIndices = { nullptr };
|
||||
}MAPELEMENT_DESC;
|
||||
|
||||
protected:
|
||||
CMapElement(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CMapElement(const CMapElement& rhs);
|
||||
virtual ~CMapElement() = 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;
|
||||
|
||||
protected:
|
||||
_uint m_iMaxLodLevel = {};
|
||||
_uint m_iLodIndex = {};
|
||||
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
vector<CModel*> m_pModelComs;
|
||||
vector<_wstring> m_ModelPrototypeTags;
|
||||
|
||||
protected:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
virtual HRESULT Bind_ShaderResources() override;
|
||||
|
||||
public:
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) PURE;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include "Client_Define.h"
|
||||
#include "MapElement.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CLight;
|
||||
class CTexture;
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CMapElement_Light : public CMapElement
|
||||
{
|
||||
public:
|
||||
typedef struct MapElement_Light_Desc : MAPELEMENT_DESC
|
||||
{
|
||||
_bool isPow;
|
||||
_uint iGlassMeshIndex;
|
||||
_float fBloomStregth;
|
||||
_float fRange;
|
||||
_float4 vPosOffset;
|
||||
_float4 vDiffuse;
|
||||
_float4 vAmbient;
|
||||
_float4 vSpecular;
|
||||
}MAPELEMENT_LIGHT_DESC;
|
||||
|
||||
private:
|
||||
CMapElement_Light(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CMapElement_Light(const CMapElement_Light& rhs);
|
||||
virtual ~CMapElement_Light() = 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;
|
||||
|
||||
HRESULT Render_Bloom()override;
|
||||
void Toggle_Light();
|
||||
|
||||
private:
|
||||
CLight* m_pLightCom = { nullptr };
|
||||
CTexture* m_pEmissiveTextureCom = { nullptr };
|
||||
CTexture* m_pMaskTextureCom = { nullptr };
|
||||
CTexture* m_pGlassTextureCom = { nullptr };
|
||||
|
||||
_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;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
virtual HRESULT Bind_ShaderResources() override;
|
||||
|
||||
|
||||
public:
|
||||
static CMapElement_Light* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
|
||||
virtual void Free() override;
|
||||
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -22,6 +22,7 @@ class CMapInfo final : public CBase
|
||||
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);
|
||||
HRESULT Load_LightElements(const _char* pFileName);
|
||||
|
||||
private:
|
||||
CGameInstance* m_pGameInstance = { nullptr };
|
||||
|
||||
@@ -30,7 +30,7 @@ class CMapObject_Render final : public CMapPartObject // Render PartObject
|
||||
|
||||
private:
|
||||
MAPOBJECT_RENDER_TYPE m_Type = {};
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
vector<CModel*> m_pModelComs;
|
||||
|
||||
_uint m_iLodIndex = {};
|
||||
|
||||
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 22 MiB |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 13 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 7.3 MiB |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 16 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 4.6 MiB |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 18 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 7.1 MiB |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 13 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 7.7 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 4.9 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 4.1 MiB |
@@ -49,7 +49,7 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De
|
||||
}
|
||||
}
|
||||
}
|
||||
m_pThreadHolder = CThreadHolder::Create( 12 );
|
||||
m_pThreadHolder = CThreadHolder::Create( 6 );
|
||||
if (nullptr == m_pThreadHolder) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ HRESULT CGameObject_Manager::Add_GameObject_ToLayer(_uint iLayerLevelIndex, cons
|
||||
void CGameObject_Manager::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifndef gimch
|
||||
Describe_Entity();
|
||||
#endif // !gimch
|
||||
m_pGameInstance->Compute_TimeDelta(TEXT("Timer_PriorityUpdate"));
|
||||
#endif // _DEBUG
|
||||
for (size_t i = 0; i < m_iNumLevels; i++)
|
||||
|
||||