diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml index e8082d594..ec0e10dae 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -337,4 +337,164 @@ + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_L + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A + + + + + + + + + + + Prototype_GameObject_SM_HW_GH_FloorMain + + + + + + Prototype_GameObject_SM_HW_GH_FloorEnd + + + + + + Prototype_GameObject_SM_HW_GH_Sconce_Gryffindor + + + + + + Prototype_GameObject_SM_HW_GH_WallIntWindowB + + + + + + Prototype_GameObject_SM_HW_GH_WallIntWindowB + + + + + + Prototype_GameObject_SM_HW_GH_WallIntWindowC + + + + + + Prototype_GameObject_SM_HW_GH_WallPaneling + + + + + + Prototype_GameObject_SM_HW_GH_WallInt_FlatCeilingB + + + + + + Prototype_GameObject_SM_HW_GH_Sconce_Gryffindor + + + + + + Prototype_GameObject_SM_HW_GH_Sconce_HufflePuff + + + + + + Prototype_GameObject_SM_HW_GH_Sconce_Slytherin + + + + + + Prototype_GameObject_SM_HW_GH_ShadowCaster + + + + + + Prototype_GameObject_SM_HW_GH_Table + + + + + + Prototype_GameObject_SM_HW_GH_Table + + + + + + Prototype_GameObject_SM_HW_GH_Table + + + + + + Prototype_GameObject_SM_HW_GH_TableRunnerGryff + + + + + + Prototype_GameObject_SM_HW_GH_TableRunnerHufflePuff + + + + + + Prototype_GameObject_SM_HW_GH_TableRunnerRaven + + + + + + Prototype_GameObject_SM_HW_GH_WallColumnAB + + + + + + Prototype_GameObject_SM_HW_GH_WallColumnAC + + + + + + Prototype_GameObject_SM_HW_GH_WallColumnC + + + + + + Prototype_GameObject_SM_HW_GH_WallDoor + + + + + + Prototype_GameObject_SM_HW_GH_WallDoorB + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.bin new file mode 100644 index 000000000..c811d8aaa Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.fbx new file mode 100644 index 000000000..b183a8c11 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/SkyBox.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b30d1637699b814cc8505a4d955e532f074c2590c8b8f93a40d72d4ea6a8d3a +size 154860 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/T_Sky_Blue.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/T_Sky_Blue.dds new file mode 100644 index 000000000..80183c8ba Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/SkyBox/T_Sky_Blue.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index b2618d4ee..816786437 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -176,7 +176,7 @@ PS_OUT PS_MAIN(PS_IN In) Out.vDiffuse = vMtrlDiffuse; Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); - Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f); + Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / 500.f, 0.0f, 1.f); return Out; } @@ -336,7 +336,7 @@ technique11 MeshTechnique11 { pass MeshPass // 0 { - SetRasterizerState(RS_Default); + SetRasterizerState(RS_Nocull); SetDepthStencilState(DSS_Default, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); @@ -442,7 +442,7 @@ technique11 MeshTechnique11 pass MapToolPass // 11 { - SetRasterizerState(RS_Default); + SetRasterizerState(RS_Nocull); SetDepthStencilState(DSS_Default, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index e7ed24253..8f15dadeb 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -160,6 +160,7 @@ + @@ -174,6 +175,9 @@ + + + @@ -222,6 +226,7 @@ + @@ -236,6 +241,9 @@ + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 959aee4d6..882f752d3 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -190,6 +190,18 @@ {fbe2856d-a829-4563-a9f1-00adc4029c65} + + {e6df1c15-e857-4d34-8857-e6d6f1113948} + + + {95042c6d-04ae-46a5-9f52-0b7688c7ee4b} + + + {dc6d3d82-0ee7-4c5f-a561-591e257b441e} + + + {12d17342-7cb4-46be-8243-9e1864496338} + @@ -381,6 +393,18 @@ 02.GameObjects\Dummys\DummyPhysX\PhysXPlayable + + 02.GameObjects\Env\03.MapElement + + + 02.GameObjects\Env\03.MapElement\Static + + + 02.GameObjects\Env\03.MapElement\Interactable + + + 02.GameObjects\Dummys\DummySkyBox + @@ -568,6 +592,18 @@ 02.GameObjects\Dummys\DummyPhysX\PhysXPlayable + + 02.GameObjects\Env\03.MapElement + + + 02.GameObjects\Env\03.MapElement\Static + + + 02.GameObjects\Env\03.MapElement\Interactable + + + 02.GameObjects\Dummys\DummySkyBox + diff --git a/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp b/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp new file mode 100644 index 000000000..2b65039ea --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp @@ -0,0 +1,154 @@ +#include "pch.h" +#include "DummySkyBox.h" + +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Layer.h" + +CDummySkyBox::CDummySkyBox(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CGameObject{ pDevice, pContext } +{ +} + +CDummySkyBox::CDummySkyBox(const CDummySkyBox& rhs) + : CGameObject(rhs) +{ +} + +HRESULT CDummySkyBox::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDummySkyBox::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + + return S_OK; +} + +void CDummySkyBox::Priority_Update(_float fTimeDelta) +{ + +} + +void CDummySkyBox::Update(_float fTimeDelta) +{ + m_pTransformCom->Set_State(STATE::POSITION, m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_CAMERA)->Get_Object()->Get_WorldPostion()); +} + +void CDummySkyBox::Late_Update(_float fTimeDelta) +{ + _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]); + m_pGameInstance->Add_RenderGroup(RENDER::PRIORITY, this, *vPos, 0.f); +} + +HRESULT CDummySkyBox::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SKYBOX)))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + + return S_OK; +} + +HRESULT CDummySkyBox::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_SkyboxModel"), + 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 CDummySkyBox::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; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + return S_OK; +} + +CDummySkyBox* CDummySkyBox::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDummySkyBox* pInstance = new CDummySkyBox(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDummySkyBox"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDummySkyBox::Clone(void* pArg, CGameObject* pOwner) +{ + CDummySkyBox* pInstance = new CDummySkyBox(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDummySkyBox"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDummySkyBox::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pModelCom); + SAFE_RELEASE(m_pShaderCom); +} + +void CDummySkyBox::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index f4f0c684e..c5ec32bd2 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -7,6 +7,7 @@ #include "Terrain.h" #include "MapObject_Manager.h" #include "BuildingContainer.h" +#include "DummySkyBox.h" CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -34,6 +35,9 @@ HRESULT CLevel_MapViewer::Initialize() if (FAILED(Ready_Layer_Camera(LAYER_CAMERA))) { return E_FAIL; } + if (FAILED(Ready_Layer_Background(TEXT("Layer_SkyBox")))) { + return E_FAIL; + } if (FAILED(Ready_Layer_Terrain(TEXT("Layer_Terrain")))) { return E_FAIL; @@ -85,6 +89,14 @@ HRESULT CLevel_MapViewer::Ready_Layer_Camera(const _wstring& strLayerTag) return S_OK; } +HRESULT CLevel_MapViewer::Ready_Layer_Background(const _wstring& strLayerTag) +{ + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + return E_FAIL; + + return S_OK; +} + HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 68736fa15..98f059290 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -13,6 +13,7 @@ #include "Body.h" #include "Hair.h" #include "Dummy_Goblin.h" +#include "DummySkyBox.h" #include "DummyObject.h" #include @@ -219,6 +220,7 @@ HRESULT CLoader::Loading_For_Logo() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDebugCamera::Create(m_pDevice, m_pContext)))) { return E_FAIL; } + m_strMessage = TEXT("Loading Success!"); m_isFinished = true; @@ -782,10 +784,17 @@ HRESULT CLoader::Loading_For_MapViewer() m_strMessage = TEXT("모ë�¸ë¥¼(ì�„) 로딩 중 입니다."); + /* For.Prototype_Component_SkyboxModel */ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SkyboxModel"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.fbx", XMMatrixIdentity())))) + return E_FAIL; + vector<_wstring> ModelPrototypeTags = {}; vector ModelPrototypePath = {}; - for (const auto& file : filesystem::directory_iterator("C:\\Users\\kimnuri\\Desktop\\Hogwart\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain")) + //for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes")) + for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogwarts\\SUB_GreatHall\\Static_Mesh\\Kit_INT")) + //for (const auto& file : filesystem::directory_iterator("C:\\Users\\kimnuri\\Desktop\\Hogwart\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain")) { if (file.is_directory()) continue; @@ -836,6 +845,11 @@ HRESULT CLoader::Loading_For_MapViewer() CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) return E_FAIL; + /* For.Prototype_GameObject_SkyBox */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummySkyBox::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; diff --git a/Jusin154_Team3D/Editor/Private/MapElement.cpp b/Jusin154_Team3D/Editor/Private/MapElement.cpp new file mode 100644 index 000000000..499097f8a --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement.cpp @@ -0,0 +1,67 @@ +#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(); +} + +void CMapElement::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp new file mode 100644 index 000000000..1b44bfded --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp @@ -0,0 +1,196 @@ +#include "pch.h" +#include "MapElement_Interactable.h" + +#include "GameInstance.h" + +CMapElement_Interactable::CMapElement_Interactable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Interactable::CMapElement_Interactable(const CMapElement_Interactable& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Interactable::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Interactable::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + return S_OK; +} + +void CMapElement_Interactable::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapElement_Interactable::Update(_float fTimeDelta) +{ +} + +void CMapElement_Interactable::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +#endif + + _float4 vPos; + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapElement_Interactable::Render() +{ + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + if (m_bSelected) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } + } + else + { + 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_Interactable::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Interactable::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; +} + +CMapElement_Interactable* CMapElement_Interactable::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Interactable* pInstance = new CMapElement_Interactable(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Interactable"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Interactable::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Interactable* pInstance = new CMapElement_Interactable(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Interactable"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Interactable::Free() +{ + __super::Free(); +} + +void CMapElement_Interactable::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + GUI::Text("----- Transfrom ----"); + GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + + /*if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + }*/ + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + if (GUI::Button("Delete")) + m_bDead = true; + + m_bSelected = true; +} diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp new file mode 100644 index 000000000..26d7d3b37 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp @@ -0,0 +1,195 @@ +#include "pch.h" +#include "MapElement_Static.h" + +#include "GameInstance.h" + +CMapElement_Static::CMapElement_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Static::CMapElement_Static(const CMapElement_Static& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Static::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Static::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + return S_OK; +} + +void CMapElement_Static::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapElement_Static::Update(_float fTimeDelta) +{ +} + +void CMapElement_Static::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +#endif + + _float4 vPos; + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapElement_Static::Render() +{ + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + if (m_bSelected) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } + } + else + { + 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_Static::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Static::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; +} + +CMapElement_Static* CMapElement_Static::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Static* pInstance = new CMapElement_Static(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Static::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Static* pInstance = new CMapElement_Static(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Static::Free() +{ + __super::Free(); +} + +void CMapElement_Static::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + GUI::Text("----- Transfrom ----"); + GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + + /*if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + }*/ + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + if (GUI::Button("Delete")) + m_bDead = true; + + m_bSelected = true; +} diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index eeac3dcd7..5437ff436 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -140,7 +140,7 @@ HRESULT CMapObject_Manager::Bind_ShaderResources() { return S_OK; } - +#pragma region SAVE & LOAD HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) { tinyxml2::XMLDocument doc; @@ -649,6 +649,8 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch return S_OK; } +#pragma endregion + void CMapObject_Manager::Update_PrototypeList() { @@ -768,6 +770,8 @@ void CMapObject_Manager::Update_ObjectList() void CMapObject_Manager::Update_Edit() { GUI::Begin("Edit"); + if (m_pGameInstance->Mouse_Down(DIM_4)) + m_pSelectObject = nullptr; if (nullptr != m_pSelectObject) { diff --git a/Jusin154_Team3D/Editor/Public/DummySkyBox.h b/Jusin154_Team3D/Editor/Public/DummySkyBox.h new file mode 100644 index 000000000..df368f9af --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/DummySkyBox.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Editor_Define.h" +#include "GameObject.h" + +NS_BEGIN(Engine) +class CModel; +class CShader; +NS_END + +NS_BEGIN(Editor) + +class CDummySkyBox final : public CGameObject +{ +private: + CDummySkyBox(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDummySkyBox(const CDummySkyBox& rhs); + virtual ~CDummySkyBox() = 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: + CModel* m_pModelCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + + +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 CDummySkyBox* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 4a0455f58..42c99a567 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -15,6 +15,7 @@ namespace Editor enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP,UI, EFFECT, PHYSX, 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 SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, END }; enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, END }; diff --git a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h index 94a6dfeae..3891c2585 100644 --- a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h @@ -19,6 +19,7 @@ class CLevel_MapViewer final : public CLevel virtual HRESULT Initialize() override; HRESULT Ready_Layer_Light(); HRESULT Ready_Layer_Camera(const _wstring& strLayerTag); + HRESULT Ready_Layer_Background(const _wstring& strLayerTag); HRESULT Ready_Layer_Terrain(const _wstring& strLayerTag); HRESULT Ready_Layer_BuildingContainer(const _wstring& strLayerTag); HRESULT Ready_Layer_MapObjectManager(const _wstring& strLayerTag); diff --git a/Jusin154_Team3D/Editor/Public/MapElement.h b/Jusin154_Team3D/Editor/Public/MapElement.h new file mode 100644 index 000000000..f4ff533ae --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement.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 CMapElement abstract : public CGameObject +{ +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: + _bool m_bSelected = { false }; + _uint m_iMaxLodLevel = {}; + _uint m_iLodIndex = {}; + + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs; + vector<_wstring> m_ModelPrototypeTags; + + +#ifdef _DEBUG + _float3 m_vPosition = {}; + _float3 m_vRotation = {}; + _float3 m_vScale = {}; +#endif // _DEBUG + + +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; + void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h new file mode 100644 index 000000000..fea0da680 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h @@ -0,0 +1,37 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapElement.h" + +NS_BEGIN(Editor) + +class CMapElement_Interactable : public CMapElement +{ +private: + CMapElement_Interactable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Interactable(const CMapElement_Interactable& rhs); + virtual ~CMapElement_Interactable() = 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: + _uint m_iSaveIndex = {}; // ¿ø·¡ À§Ä¡ ¹Þ¾Æ¿Ã¶§ ÇÊ¿äÇÑ À妽º + +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_Interactable* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Static.h b/Jusin154_Team3D/Editor/Public/MapElement_Static.h new file mode 100644 index 000000000..41b5dc8cc --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapElement_Static.h @@ -0,0 +1,34 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapElement.h" + +NS_BEGIN(Editor) + +class CMapElement_Static : public CMapElement +{ +private: + CMapElement_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Static(const CMapElement_Static& rhs); + virtual ~CMapElement_Static() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + +public: + static CMapElement_Static* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 8ccb5fe54..9ea7d5551 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -256,6 +256,8 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType eTexture = aiTextureType::aiTextureType_NORMALS; else if (!strcmp(FileType.c_str(), "normal")) eTexture = aiTextureType::aiTextureType_NORMALS; + else if (!strcmp(FileType.c_str(), "n")) + eTexture = aiTextureType::aiTextureType_NORMALS; else if (!strcmp(FileType.c_str(), "MRO")) eTexture = aiTextureType::aiTextureType_METALNESS; else if (!strcmp(FileType.c_str(), "MROH")) diff --git a/Jusin154_Team3D/Engine/Private/PipeLine.cpp b/Jusin154_Team3D/Engine/Private/PipeLine.cpp index d66d8f09d..4dd54a78c 100644 --- a/Jusin154_Team3D/Engine/Private/PipeLine.cpp +++ b/Jusin154_Team3D/Engine/Private/PipeLine.cpp @@ -37,7 +37,7 @@ void CPipeLine::Update() XMStoreFloat4x4(&m_TransformStateMatrices[i], XMMatrixInverse(nullptr, Get_Transform_Matrix(static_cast(i-2)))); } - memcpy(&m_vCamPosition, &m_TransformStateMatrices[ENUM_CLASS(D3DTS::VIEW)].m[3], sizeof(_float4)); + memcpy(&m_vCamPosition, &m_TransformStateMatrices[ENUM_CLASS(D3DTS::VIEW_INV)].m[3], sizeof(_float4)); } CPipeLine* CPipeLine::Create() diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index ab9d56085..f73cf03e9 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -683,12 +683,12 @@ HRESULT CRenderer::Initialize() XMStoreFloat4x4(&m_ProjMatrix, XMMatrixOrthographicLH(Viewport.Width, Viewport.Height, 0.f, 1.f)); #ifdef _DEBUG - //if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Diffuse"), 75.f, 75.f, 150.0f, 150.0f))) { - // return E_FAIL; - //} - //if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Normal"), 75.f, 225.f, 150.0f, 150.0f))) { - // return E_FAIL; - //} + if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Diffuse"), 75.f, 75.f, 150.0f, 150.0f))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Normal"), 75.f, 225.f, 150.0f, 150.0f))) { + return E_FAIL; + } //if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Shade"), 225.f, 75.f, 150.0f, 150.0f))) { // return E_FAIL; //} @@ -696,9 +696,9 @@ HRESULT CRenderer::Initialize() // return E_FAIL; //} - if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Color"), 375.f, 225.f, 450.f, 450.0f))) { - return E_FAIL; - } + //if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Color"), 375.f, 225.f, 450.f, 450.0f))) { + // return E_FAIL; + //} //if (FAILED(m_pGameInstance->Ready_RenderTarget_Debug(TEXT("Target_Shadow"), Viewport.Width - 150.0f, 150.0f, 300.f, 300.f))) { // return E_FAIL; diff --git a/Jusin154_Team3D/Jusin154_Team3D.sln b/Jusin154_Team3D/Jusin154_Team3D.sln index 78e5e4dca..3030ee6cc 100644 --- a/Jusin154_Team3D/Jusin154_Team3D.sln +++ b/Jusin154_Team3D/Jusin154_Team3D.sln @@ -8,6 +8,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01.Editor", "01.Editor", "{8F2ABBAF-8EC5-4CF8-8AD2-B09FB2AC9B14}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.Engine", "03.Engine", "{C8D5274F-AC00-46C7-1F8D-E88E81087A52}" + ProjectSection(SolutionItems) = preProject + Editor\public\DummySkyBox.h = Editor\public\DummySkyBox.h + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "98.Batch", "98.Batch", "{15C374FB-70F1-426A-AF16-1922F28ABE5D}" ProjectSection(SolutionItems) = preProject