diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.bin new file mode 100644 index 000000000..69a5b2777 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37f56c92b3118e197b6caf5ea1995fc5d4ab62a334521fc35cbe71b739d9b461 +size 2615 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.fbx new file mode 100644 index 000000000..bb8158c11 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/Decal/DecalBox.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9d8da615fe98d23a5a77fa2a69e2a3395cb74045ec4b224a21b64e5f392f771 +size 15020 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 4a596b98f..637c923b7 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -1295,6 +1295,38 @@ PS_OUT_SSAO_BLUR PS_SSAO_BLUR(PS_IN In) Out.fBlur = fResult; return Out; } + +struct PS_OUT_DECAL +{ + float4 vDiffuse : SV_TARGET0; +}; + +PS_OUT_DECAL PS_DECAL(PS_IN In) +{ + PS_OUT_DECAL Out; + + float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + + float fViewZ = vDepthDesc.y * g_fFar; + + + float4 vPosition, vPreShadowPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = In.vTexcoord.x * 2.f - 1.f; + vPosition.y = In.vTexcoord.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + vPosition = vPosition * fViewZ; + + vPosition = mul(vPosition, g_invmatProj); + vPosition = mul(vPosition, g_invMatView); + vPreShadowPosition = vPosition; + + + return Out; +} technique11 DefaultTechnique { pass DebugPass // 0 @@ -1509,4 +1541,14 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } + + pass DecalPass // 22 + { + SetRasterizerState(RS_Default); + 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_DECAL(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index 9d191be04..605643140 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -2,6 +2,7 @@ #include "Engine_Shader_Defines.hlsli" float4x4 g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; +float4x4 g_WorldMatrixInv, g_ViewMatrixInv, g_ProjMatrixInv; float4x4 g_PrevWorldMatrix, g_PrevViewMatrix, g_PrevProjMatrix; int g_bUVTargetDiffuse; @@ -79,6 +80,8 @@ Texture2D g_NormalLargeTexture; Texture2D g_NormalSubTexture; Texture2D g_DeadDisolveTexture; +Texture2D g_DepthTexture; + float g_fNormalValue1; float g_fNormalValue2; float g_fNormalValue3; @@ -100,6 +103,12 @@ float g_fRimPower; float g_fRimStrength; float4 g_vRimColor; +float g_fWinSizeX; +float g_fWinSizeY; + +float4 g_vMaskColorRed; +float4 g_vMaskColorGreen; +float4 g_vMaskColorBlue; struct VS_IN { @@ -133,6 +142,14 @@ struct VS_OUT_SHADOW float4 vPosition : SV_POSITION; }; +struct VS_OUT_DECAL +{ + float4 vPosition : SV_POSITION; + float3 vNormal : NORMAL; + float3 vTangent : TANGENT; + float3 vBinormal : BINORMAL; +}; + VS_OUT_BLUR VS_MAIN_BLUR(VS_IN In) { @@ -185,6 +202,22 @@ VS_OUT VS_MAIN(VS_IN In) return Out; } +VS_OUT_DECAL VS_MAIN_DECAL(VS_IN In) +{ + VS_OUT_DECAL Out; + + matrix matWV, matWVP; + matWV = mul(g_WorldMatrix, g_ViewMatrix); + matWVP = mul(matWV, g_ProjMatrix); + + Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP); + Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), g_WorldMatrix)).xyz; + Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), g_WorldMatrix)).xyz; + Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), g_WorldMatrix)).xyz; + + return Out; +} + VS_OUT_BLUR VS_BLOOM(VS_IN In) { VS_OUT_BLUR Out; @@ -853,6 +886,86 @@ PS_OUT PS_LEVIOSO(PS_IN In) return Out; } +struct PS_IN_DECAL +{ + float4 vPosition : SV_POSITION; + float3 vNormal : NORMAL; + float3 vTangent : TANGENT; + float3 vBinormal : BINORMAL; +}; +struct PS_OUT_DELCAL +{ + float4 vAlbedo : SV_TARGET0; + float4 vNormal : SV_TARGET1; + float4 vSurface : SV_Target2; +}; + +PS_OUT_DELCAL PS_MAIN_DECAL(PS_IN_DECAL In) +{ + PS_OUT_DELCAL Out; + + float2 vDepthUV; + vDepthUV.x = In.vPosition.x / g_fWinSizeX; + vDepthUV.y = In.vPosition.y / g_fWinSizeY; + + float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vDepthUV); + + float fViewZ = vDepthDesc.y * g_fFar; + + float4 vPosition; + + vPosition.x = vDepthUV.x * 2.f - 1.f; + vPosition.y = vDepthUV.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + float4 vViewPos = mul(vPosition, g_ProjMatrixInv); + vViewPos /= vViewPos.w; + + float4 vWorldPos = mul(vViewPos, g_ViewMatrixInv); + + vector vLocalPos = mul(vWorldPos, g_WorldMatrixInv); + + float3 ObjectAbsPos = abs(vLocalPos.xyz); + + clip(0.5f - ObjectAbsPos); + + float2 vDecalUV = vLocalPos.xz + 0.5f; + + float4 vMaskColor = g_MaskingTexture.Sample(DefaultSampler, vDecalUV); + if (vMaskColor.a < 0.2f) + { + discard; + } + + float4 vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, vDecalUV); + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, vDecalUV); + + float fMaskWeight = vMaskColor.r + vMaskColor.g + vMaskColor.b; + + float4 vDiffuseColor = vMaskColor.r * g_vMaskColorRed + + vMaskColor.g * g_vMaskColorGreen + + vMaskColor.b * g_vMaskColorBlue; + + vDiffuseColor /= fMaskWeight; + + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + Out.vAlbedo = vDiffuseColor; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.5f); + float fSurfaceParam = g_fUsingSurfaceParams; + if (true == AlmostEqual7(g_fUsingSurfaceParams, 0.f)) + { + fSurfaceParam = 0.f; + } + + Out.vSurface = vSurface; + + return Out; +} + technique11 MeshTechnique11 { @@ -1071,4 +1184,14 @@ technique11 MeshTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_LEVIOSO(); } + + pass DecalPass // 22 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN_DECAL(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_DECAL(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl index 136b32a9e..82a9b0d8c 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPos.hlsl @@ -2,12 +2,15 @@ #include "Engine_Shader_Defines.hlsli" matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; +matrix g_WorldMatrixInv, g_ViewMatrixInv, g_ProjMatrixInv; float g_fFar; +float g_fNormalThreshold; float3 g_vContainerMin; float3 g_vContainerMax; - +Texture2D g_DepthTexture; +Texture2D g_DiffuseTexture; struct VS_IN { @@ -52,6 +55,48 @@ PS_OUT PS_MAIN(PS_IN In) return Out; } +PS_OUT PS_DECAL(PS_IN In) +{ + PS_OUT Out; + + float2 vDepthUV; + vDepthUV.x = In.vPosition.x / 1920.f; + vDepthUV.y = In.vPosition.y / 1080.f; + + float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vDepthUV); + + float fViewZ = vDepthDesc.y * g_fFar; + + float4 vPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = vDepthUV.x * 2.f - 1.f; + vPosition.y = vDepthUV.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + float4 vViewPos = mul(vPosition, g_ProjMatrixInv); + vViewPos /= vViewPos.w; + + float4 vWorldPos = mul(vViewPos, g_ViewMatrixInv); + + vector vLocalPos = mul(vWorldPos, g_WorldMatrixInv); + + float3 ObjectAbsPos = abs(vLocalPos.xyz); + + clip(0.5f - ObjectAbsPos); + + float2 vDecalUV = vLocalPos.xz + 0.5f; + + float4 Color = g_DiffuseTexture.Sample(DefaultSampler, vDecalUV); + if (0.3f > Color.a) + discard; + Out.vColor = Color; //float4(1.f, vDecalUV.x, vDecalUV.y, 1.f); + + + return Out; +} + PS_OUT PS_DEBUG(PS_IN In) { PS_OUT Out; @@ -83,4 +128,13 @@ technique11 NorTechnique11 PixelShader = compile ps_5_0 PS_DEBUG(); } + pass Decal + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 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_DECAL(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index a9e6106c8..eca97dc82 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -179,6 +179,7 @@ call Update_Shaders.bat + @@ -422,6 +423,7 @@ call Update_Shaders.bat + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 9f042b142..e4887f53c 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -661,6 +661,9 @@ {0c039454-c5e4-4fbc-832e-06acb0f86f43} + + {ebd7a1c2-4914-4956-ad9c-a0fc2e857f56} + @@ -1344,6 +1347,9 @@ 02.GameObjects\Monster\Ranrok\RanrokState + + 02.GameObjects\Dummys\DummyDecal + @@ -2032,6 +2038,9 @@ 02.GameObjects\Monster\Ranrok\RanrokState + + 02.GameObjects\Dummys\DummyDecal + diff --git a/Jusin154_Team3D/Editor/Private/Camera_Debug.cpp b/Jusin154_Team3D/Editor/Private/Camera_Debug.cpp index 1ca817c7e..11b90968a 100644 --- a/Jusin154_Team3D/Editor/Private/Camera_Debug.cpp +++ b/Jusin154_Team3D/Editor/Private/Camera_Debug.cpp @@ -13,11 +13,6 @@ CCamera_Debug::CCamera_Debug(const CCamera_Debug& rhs) } void CCamera_Debug::Priority_Update(_float fTimeDelta) -{ - m_pGameInstance->Bind_Camera(g_iStaticLevel, CAMERA_DEBUG, false); -} - -void CCamera_Debug::Update(_float fTimeDelta) { if (false == m_bActive) { return; @@ -40,7 +35,7 @@ void CCamera_Debug::Update(_float fTimeDelta) } #endif // gimch - + if (m_bMovable) { #pragma region Position _float fSpeed = 5.f; @@ -77,6 +72,13 @@ void CCamera_Debug::Update(_float fTimeDelta) } __super::Bind_Matrices(); + + m_pGameInstance->Bind_Camera(g_iStaticLevel, CAMERA_DEBUG, false); +} + +void CCamera_Debug::Update(_float fTimeDelta) +{ + } void CCamera_Debug::Late_Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Editor/Private/DummyDecal.cpp b/Jusin154_Team3D/Editor/Private/DummyDecal.cpp new file mode 100644 index 000000000..22b3a5a21 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/DummyDecal.cpp @@ -0,0 +1,244 @@ +#include "pch.h" +#include "DummyDecal.h" + +#include "GameInstance.h" + + +CDummyDecal::CDummyDecal(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CGameObject{ pDevice, pContext } +{ +} + +CDummyDecal::CDummyDecal(const CDummyDecal& rhs) + : CGameObject(rhs) + , m_fWinSizeX{rhs.m_fWinSizeX} + , m_fWinSizeY{rhs.m_fWinSizeY} +{ +} + +HRESULT CDummyDecal::Initialize_Prototype() +{ + m_fWinSizeX = g_iWinSizeX; + m_fWinSizeY = g_iWinSizeY; + + return S_OK; +} + +HRESULT CDummyDecal::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_vMaskRed = _float4(1.f, 0.f, 0.f, 1.f); + m_vMaskGreen = _float4(1.f, 1.f, 1.f, 1.f); + m_vMaskBlue = _float4(1.f, 1.f, 1.f, 1.f); + + return S_OK; +} + +void CDummyDecal::Priority_Update(_float fTimeDelta) +{ +} + +void CDummyDecal::Update(_float fTimeDelta) +{ + Describe_Entity(); +} + +void CDummyDecal::Late_Update(_float fTimeDelta) +{ + //if (m_pGameInstance->IsIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { + m_pGameInstance->Add_RenderGroup(RENDER::DECAL, this); + //} +} + +HRESULT CDummyDecal::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMesh = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMesh; i++) + { + if (FAILED(m_pShaderCom->Bind_SRV("g_MaskingTexture", m_pMaskTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_SRV("g_NormalTexture", m_pNormalTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_SRV("g_SurfaceParamsTexture", m_pSurfaceTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(22))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CDummyDecal::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Decal_MSK"), + reinterpret_cast(&m_pMaskTextureCom)))) + return E_FAIL; + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Decal_Noraml"), + reinterpret_cast(&m_pNormalTextureCom)))) + return E_FAIL; + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Base_MRO"), + reinterpret_cast(&m_pSurfaceTextureCom)))) + return E_FAIL; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_DecalBox"), + reinterpret_cast(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CDummyDecal::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + _float4x4 WorldInv = {}; + + XMStoreFloat4x4(&WorldInv, m_pTransformCom->Get_WorldMatrixInv()); + + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrixInv", &WorldInv))) { + return E_FAIL; + } + + // Base MRO + // g_fUsingSurfaceParams 15.f / 27.f; + + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrixInv", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrixInv", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + /*if (FAILED(m_pShaderCom->Bind_RawValue("g_fNormalThreshold", &m_fNormalThreshold, sizeof(_float)))) { + return E_FAIL; + }*/ + if (FAILED(m_pShaderCom->Bind_RawValue("g_fWinSizeX", &m_fWinSizeX, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fWinSizeY", &m_fWinSizeY, sizeof(_float)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskColorRed", &m_vMaskRed, sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskColorGreen", &m_vMaskGreen, sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskColorBlue", &m_vMaskBlue, sizeof(_float4)))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShaderCom, "g_DepthTexture"))) { + return E_FAIL; + } + + return S_OK; +} + +CDummyDecal* CDummyDecal::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDummyDecal* pInstance = new CDummyDecal(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDummyDecal"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDummyDecal::Clone(void* pArg, CGameObject* pOwner) +{ + CDummyDecal* pInstance = new CDummyDecal(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDummyDecal"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDummyDecal::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pMaskTextureCom); + SAFE_RELEASE(m_pNormalTextureCom); + SAFE_RELEASE(m_pSurfaceTextureCom); + SAFE_RELEASE(m_pModelCom); + SAFE_RELEASE(m_pShaderCom); +} + +void CDummyDecal::Describe_Entity() +{ + GUI::Begin("TEST DECAL"); + + _float fAgle = XMConvertToDegrees(m_fNormalThreshold); + + GUI::InputFloat("m_fNormalThreshold", &fAgle); + + GUI::ColorEdit4("Mask Red", (_float*)&m_vMaskRed); + GUI::ColorEdit4("Mask Green", (_float*)&m_vMaskGreen); + GUI::ColorEdit4("Mask Blue", (_float*)&m_vMaskBlue); + + m_fNormalThreshold = XMConvertToRadians(fAgle); + + m_pTransformCom->Describe_Entity(); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + _float3 vPosition = {}; + if (m_pGameInstance->isPicking(&vPosition)) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&vPosition), 1.f)); + } + } + + + GUI::End(); +} diff --git a/Jusin154_Team3D/Editor/Private/InfoInstance.cpp b/Jusin154_Team3D/Editor/Private/InfoInstance.cpp index bf6f2f230..044373050 100644 --- a/Jusin154_Team3D/Editor/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Editor/Private/InfoInstance.cpp @@ -84,6 +84,10 @@ pair CInfoInstance::Get_NearestPlayerAlly(_fvector vPos) { return m_pMonsterInfo->Get_NearestPlayerAlly(vPos); } +HRESULT CInfoInstance::Load_MapObjects(const _char* pFilePath) +{ + return m_pMapInfo->Load_MapObjects(pFilePath); +} #pragma endregion #pragma region MAP_INFO diff --git a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp index 6d5cc095f..b54600172 100644 --- a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp @@ -41,25 +41,29 @@ HRESULT CLevel_EffectViewer::Initialize() { return E_FAIL; } + if (FAILED(Ready_Layer_BackGround(TEXT("Layer_Background")))) + { + return E_FAIL; + } if (FAILED(Ready_Layer_Effect(TEXT("Layer_Effect")))) { return E_FAIL; } - CTerrain::TERRAIN_DESC Desc = {}; - /* Hogsmeade */ + //CTerrain::TERRAIN_DESC Desc = {}; + ///* Hogsmeade */ - Desc.isEdit = false; - Desc.iAlphaSizeX = 2048; - Desc.iAlphaSizeY = 2048; - Desc.vPosition = _float3(-194, 18.5f, -153.f); - Desc.strAlphaMapTag = "Hogsmeade_AlphaMap.bin"; - Desc.strHeightMapTag = "Hogsmeade_HeightMap.bin"; - Desc.strBufferTag = TEXT("Prototype_Component_VIBuffer_Terrain_Hogsmeade"); + //Desc.isEdit = false; + //Desc.iAlphaSizeX = 2048; + //Desc.iAlphaSizeY = 2048; + //Desc.vPosition = _float3(-194, 18.5f, -153.f); + //Desc.strAlphaMapTag = "Hogsmeade_AlphaMap.bin"; + //Desc.strHeightMapTag = "Hogsmeade_HeightMap.bin"; + //Desc.strBufferTag = TEXT("Prototype_Component_VIBuffer_Terrain_Hogsmeade"); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Terrain"), &Desc))) - return E_FAIL; + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Terrain"), &Desc))) + // return E_FAIL; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_EffectPool")))) //플레이어보다 먼저 생성해야함! @@ -199,6 +203,16 @@ HRESULT CLevel_EffectViewer::Ready_Layer_PhysX(const _wstring& strLayerTag) return S_OK; } +HRESULT CLevel_EffectViewer::Ready_Layer_BackGround(const _wstring& strLayerTag) +{ + _float4 vColor = _float4(0.2f, 0.2f, 0.2f, 1.f); + m_pGameInstance->Set_FogColor(vColor); + m_pGameInstance->Set_Fog(10.f, 5.f); + m_pInfoInstance->Load_MapObjects("Dungeon_Map_Data"); + + return S_OK; +} + CLevel_EffectViewer* CLevel_EffectViewer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) diff --git a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp index a297cbb4f..eb745147a 100644 --- a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp @@ -56,8 +56,10 @@ void CLevel_Logo::Update(_float fTimeDelta) } GUI::End(); #ifdef gimch - if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::MAP)))) + if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::EFFECT)))) return; + //if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::MAP)))) + // return; #endif // gimch #ifdef 기무리 if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::OBJECT)))) diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 0ac8796b7..df5bf2975 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -16,6 +16,7 @@ #include "MapElement_Lake.h" #include "MapElement_Door.h" #include "MapElement_Chest.h" +#include "DummyDecal.h" CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -120,6 +121,9 @@ HRESULT CLevel_MapViewer::Ready_Layer_Camera(const _wstring& strLayerTag) HRESULT CLevel_MapViewer::Ready_Layer_Background(const _wstring& strLayerTag) { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + return E_FAIL; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index a27dcacfd..45734b5d9 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -6,6 +6,7 @@ #include "Camera_Debug.h" #include "DummyRect.h" +#include "DummyDecal.h" #include "MainApp.h" #include "Dummy_Cube.h" #include "MainLight.h" @@ -209,6 +210,7 @@ #include "Dummy_Globe.h" + #pragma endregion CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -1618,6 +1620,105 @@ HRESULT CLoader::Loading_For_Effect() } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Static::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_LOD::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Collision::Create(m_pDevice, m_pContext)))) { + 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; + } + + /* 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_BuildingContainer */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBuildingContainer::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* Lake_Cube_D */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Lake_Cube_D"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Models/Lake/SkyCube.dds"), 0)))) { + return E_FAIL; + } + +#pragma region DUNGEON_MAP + vector<_wstring> ModelPrototypeTags = {}; + vector ModelPrototypePath = {}; + /* Cave Wall */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Wall", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Props */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Props", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* ArenaFloor */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/ArenaFloor", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Center_Structure_AnteChamber */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/Center_Structure/AnteChamber", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Center_Structure_Core */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/Center_Structure/Core", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_ConjuredDragonAttackZones */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/ConjuredDragonAttackZones", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_Barriers */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/Rock_Barriers", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_SM_Repository_FloatingGround */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/SM_Repository_FloatingGround", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_SM_Repository_Stage3MoveableRocks */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/Stage3MoveableRocks", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_Interactables */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository/BreakingRocks/LG_E", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_Main */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Meshes/Repository", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Sanctum_Dungeon_Rock_Main */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Sanctum_Dungeon/Interactables", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Cavern_Dungeon_Rocks */ + if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Cavern_Dungeon/Mesh/Rocks", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; +#pragma endregion + + + + m_strMessage = TEXT("Shader Loading.."); @@ -2639,6 +2740,21 @@ HRESULT CLoader::Loading_For_MapViewer() CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures//T_LandscapeStreamingProxy_0_LOD1_Summer_D.png"), 0)))) { return E_FAIL; } + /* Base_MRO */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Base_MRO"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("C:/MeshTable/Game/Environment//MasterMaterials/BaseTextures/T_Base011_MRO.dds"), 0)))) { + return E_FAIL; + } + /* Decal_MSK */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Decal_MSK"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("C:/MeshTable/Game/Environment/Sanctum_Dungeon/Textures/Repository/T_Rift_Material_MSK.dds"), 0)))) { + return E_FAIL; + } + /* Decal_Noraml */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Decal_Noraml"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("C:/MeshTable/Game/Environment/Sanctum_Dungeon/Textures/Repository/T_Rift_Veins_N.dds"), 0)))) { + return E_FAIL; + } /* Terrain_Diffuse */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Terrain_Diffuse"), @@ -2738,6 +2854,11 @@ HRESULT CLoader::Loading_For_MapViewer() CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.bin", XMMatrixIdentity())))) return E_FAIL; + /* For.Prototype_Component_DecalBox */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_DecalBox"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Effect/Decal/DecalBox.fbx", XMMatrixIdentity())))) + return E_FAIL; + #pragma region MAP_LANDS /* For.Prototype_Component_Hogsmead_Land */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_Hogsmead_Land"), @@ -2798,7 +2919,6 @@ HRESULT CLoader::Loading_For_MapViewer() ".bin", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; - /* Terrain*/ //if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain", // ".bin", false, ModelPrototypeTags, ModelPrototypePath))) @@ -3045,7 +3165,7 @@ if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Objects\\Interactabl #pragma region HOGWART -_bool bHogwartLoad = { true }; +_bool bHogwartLoad = { false }; /* Hogwart LOD */ if (FAILED(MapFolderLoad("../Bin/Resources/Models/MapMesh/Game/Environment/Hogwarts/HogwartsLOD", @@ -3915,6 +4035,10 @@ if(isLoad_Map) if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_CDummyDecal */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummyDecal::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_MapObject_Manager */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Manager::Create(m_pDevice, m_pContext, ModelPrototypeTags, ModelPrototypePath)))) return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/MapInfo.cpp b/Jusin154_Team3D/Editor/Private/MapInfo.cpp index 990c13879..4cde79584 100644 --- a/Jusin154_Team3D/Editor/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Editor/Private/MapInfo.cpp @@ -6,6 +6,9 @@ #include "MapObject_Collision.h" #include "MapElement_Light.h" #include "Layer.h" +#include "MapElement_Static.h" +#include "MapElement_Interactable.h" +#include "MapObject_LOD.h" CMapInfo::CMapInfo() { @@ -54,6 +57,204 @@ void CMapInfo::Change_Level() { } +HRESULT CMapInfo::Load_MapObjects(const _char* pFilePath) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/" + string(pFilePath) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Land"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + /* Container */ + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; + + Container->QueryStringAttribute("Name", &pName); +#pragma region ADD_CONTAINER_OBJECT + + CBuildingContainer* pContainerObject = { nullptr }; + 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); + + ContainerDesc.strName = string(pName); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, g_iStaticLevel, TEXT("Layer_Building"), &ContainerDesc, nullptr, &pContainerObject))) + { + MSG_BOX("Faield Clone Building"); + return E_FAIL; + } +#pragma endregion + +#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_LOD + MAPOBJECT_LOD_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(); + 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); + + CMapObject_LOD* pMapObject; + + if (FAILED(pContainerObject->Add_Part(strKey, g_iStaticLevel, &pMapObject, &Desc))) + return E_FAIL; + + pMapObject->Set_KeyIndex(iKeyIndex); + + SAFE_RELEASE(pMapObject); +#pragma endregion + + } +#pragma endregion + + pContainerObject->Set_BoundingBox(); + +#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 + MAPOBJECT_LOD_DESC Desc = {}; + string strTag = {}; + for (auto* PrototypeTag = Collision->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(); + + /* 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(g_iStaticLevel, &Desc); +#pragma endregion + SAFE_RELEASE(pContainerObject); + } +#pragma endregion + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + MAPOBJECT_LOD_DESC Desc = {}; + + MAPOBJECT_TYPE eType = {}; + + Object->QueryUnsignedAttribute("Type", (_uint*)(&eType)); + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + + 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); + + string strTag = {}; + + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + if (MAPOBJECT_TYPE::ELEMENT_STATIC == eType) + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Static"), &Desc); + else if (MAPOBJECT_TYPE::ELEMENT_INTERACT == eType) + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable"), &Desc); + } + + + return S_OK; +} + HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { @@ -86,10 +287,10 @@ void CMapInfo::Free() { __super::Free(); - SAFE_RELEASE(m_pGameInstance); SAFE_RELEASE(m_pInfoInstance); SAFE_RELEASE(m_pDevice); SAFE_RELEASE(m_pContext); + SAFE_RELEASE(m_pGameInstance); } #ifdef _DEBUG diff --git a/Jusin154_Team3D/Editor/Public/DummyDecal.h b/Jusin154_Team3D/Editor/Public/DummyDecal.h new file mode 100644 index 000000000..fe5a9f42b --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/DummyDecal.h @@ -0,0 +1,55 @@ +#pragma once + +#include "Editor_Define.h" +#include "GameObject.h" + +NS_BEGIN(Engine) +class CModel; +class CShader; +NS_END + +NS_BEGIN(Editor) + +class CDummyDecal final : public CGameObject +{ +private: + CDummyDecal(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDummyDecal(const CDummyDecal& rhs); + virtual ~CDummyDecal() = 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: + CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + CTexture* m_pMaskTextureCom = { nullptr }; + CTexture* m_pNormalTextureCom = { nullptr }; + CTexture* m_pSurfaceTextureCom = { nullptr }; + + _float m_fNormalThreshold = {}; + + _float m_fWinSizeX = {}; + _float m_fWinSizeY = {}; + + _float4 m_vMaskRed = {}; + _float4 m_vMaskGreen = {}; + _float4 m_vMaskBlue = {}; + +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 CDummyDecal* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Dummy_Cube.h b/Jusin154_Team3D/Editor/Public/Dummy_Cube.h index 9ba5ab09f..3964c4e9d 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_Cube.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_Cube.h @@ -24,8 +24,9 @@ class CDummy_Cube final : public CGameObject virtual HRESULT Render() override; private: - CModel* m_pModelCom = { nullptr }; - CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CTexture* m_pTextureCom = { nullptr }; private: @@ -41,4 +42,4 @@ class CDummy_Cube final : public CGameObject void Describe_Entity() override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Public/InfoInstance.h b/Jusin154_Team3D/Editor/Public/InfoInstance.h index 332d62b43..f7d2bd63e 100644 --- a/Jusin154_Team3D/Editor/Public/InfoInstance.h +++ b/Jusin154_Team3D/Editor/Public/InfoInstance.h @@ -40,6 +40,7 @@ class CInfoInstance final : public CBase pair Get_NearestPlayerAlly(_fvector vPos); #pragma endregion #pragma region MAP_INFO + HRESULT Load_MapObjects(const _char* pFilePath); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h index 8ac9b2339..612bd22ac 100644 --- a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h @@ -23,6 +23,7 @@ class CLevel_EffectViewer final : public CLevel HRESULT Ready_Layer_UI(const _wstring& strLayerTag); HRESULT Ready_Layer_Effect(const _wstring& strLayerTag); HRESULT Ready_Layer_PhysX(const _wstring& strLayerTag); + HRESULT Ready_Layer_BackGround(const _wstring& strLayerTag); PhsXUserData m_PlaneData = {}; class CInfoInstance* m_pInfoInstance = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Public/MapInfo.h b/Jusin154_Team3D/Editor/Public/MapInfo.h index a3ccc7246..40675d0e4 100644 --- a/Jusin154_Team3D/Editor/Public/MapInfo.h +++ b/Jusin154_Team3D/Editor/Public/MapInfo.h @@ -18,11 +18,11 @@ 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_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); - HRESULT Load_LightElements(const _char* pFileName); + HRESULT Load_LightElements(const _char* pFileName);*/ private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 4a596b98f..637c923b7 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -1295,6 +1295,38 @@ PS_OUT_SSAO_BLUR PS_SSAO_BLUR(PS_IN In) Out.fBlur = fResult; return Out; } + +struct PS_OUT_DECAL +{ + float4 vDiffuse : SV_TARGET0; +}; + +PS_OUT_DECAL PS_DECAL(PS_IN In) +{ + PS_OUT_DECAL Out; + + float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + + float fViewZ = vDepthDesc.y * g_fFar; + + + float4 vPosition, vPreShadowPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = In.vTexcoord.x * 2.f - 1.f; + vPosition.y = In.vTexcoord.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + vPosition = vPosition * fViewZ; + + vPosition = mul(vPosition, g_invmatProj); + vPosition = mul(vPosition, g_invMatView); + vPreShadowPosition = vPosition; + + + return Out; +} technique11 DefaultTechnique { pass DebugPass // 0 @@ -1509,4 +1541,14 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } + + pass DecalPass // 22 + { + SetRasterizerState(RS_Default); + 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_DECAL(); + } } diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 0fafd8464..89d863052 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -10,6 +10,7 @@ void CRenderer::Render() Render_Priority(); Render_Shadow(); Render_NonBlend(); + Render_Decal(); Render_SSAO(); Render_SSAO_BLUR(); Render_LightAcc(); @@ -328,6 +329,30 @@ void CRenderer::Render_NonBlend() COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); } +void CRenderer::Render_Decal() +{ + EVENTSCOPE_("Render_Decal"); + if (FAILED(m_pGameInstance->Begin_MRT_NonClear(TEXT("MRT_Decal")))) { + return; + } + + for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::DECAL)]) + { + if (nullptr != pRenderObject) { + if (FAILED(pRenderObject->Render())) { + assert(false); + } + } + + SAFE_RELEASE(pRenderObject); + } + + m_RenderObjects[ENUM_CLASS(RENDER::DECAL)].clear(); + if (FAILED(m_pGameInstance->End_MRT())) { + return; + } +} + void CRenderer::Render_LightAcc() { COMPUTE_TIMEDELTA("Timer_Render_LightAcc"); diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index 9a0d9596a..7fb8fe6e9 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -517,6 +517,17 @@ HRESULT CRenderer::Initialize() return E_FAIL; } + /* MRT_Decal */ + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Decal"), TEXT("Target_Diffuse")))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Decal"), TEXT("Target_Normal")))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Decal"), TEXT("Target_Surface")))) { + return E_FAIL; + } + } m_pShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_DEFERRED, nullptr, nullptr); diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index d26ce88e0..ecd0c9cd3 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -113,6 +113,7 @@ class CRenderer final : public CBase void Render_Priority(); void Render_Shadow(); void Render_NonBlend(); + void Render_Decal(); void Render_Blur(); void Render_SSAO(); void Render_SSAO_BLUR();