diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 6594a5cd7..2a688741c 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -125,6 +125,10 @@ ../../EngineSDK/Lib/$(ConfigurationName);%(AdditionalLibraryDirectories) Engine.lib;fmod_vc.lib;%(AdditionalDependencies) + + + + @@ -147,6 +151,10 @@ ../../EngineSDK/Lib/$(ConfigurationName);%(AdditionalLibraryDirectories) Engine.lib;fmod_vc.lib;%(AdditionalDependencies) + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Box/Box.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Box/Box.bin index 81cc493b0..05a008add 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Models/Box/Box.bin and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Box/Box.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin index 2dddf309f..52517c590 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.fbx index b99879e86..a80846c04 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.fbx +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair2/Hair2.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:856e562b09f232b1c1130071a5ba6d2cc2b477961a4a53ee0a291358099bc23b -size 16798140 +oid sha256:d5bc331e0a4b2bcd2bf7e2da1c106174db1a49a53203374c181db736d3b9184e +size 174652060 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.bin new file mode 100644 index 000000000..5d9ecad9f Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.fbx new file mode 100644 index 000000000..2f0e0486b --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair3/Hair3.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e94916d6bcbe4f0a078c3c3e3092adc4138623c43a583d5e2820e7a7f38b555 +size 16765980 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair1/T_GHO_M_Hair_GHOHair01_WigTall_THV_MSK.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Mask0.png similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Hair1/T_GHO_M_Hair_GHOHair01_WigTall_THV_MSK.png rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Mask0.png diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Mask1.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Mask1.png new file mode 100644 index 000000000..7b7c0f76c Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Hair/Mask1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin new file mode 100644 index 000000000..27199e313 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.fbx new file mode 100644 index 000000000..4f92630d5 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4ff84fe112135ff197ff9a91ce8b391a17279c801e91343713c5ea5f063fa4b +size 201876508 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey_D.png new file mode 100644 index 000000000..0459d61ae Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_N.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_N.png new file mode 100644 index 000000000..f70b0b9a3 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_N.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Head.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Head.bin similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Head.bin rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Head.bin diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/T_NPC_Young_M_Head_Ivory_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/T_NPC_Young_M_Head_Ivory_D.png similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/T_NPC_Young_M_Head_Ivory_D.png rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/T_NPC_Young_M_Head_Ivory_D.png diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.bin similarity index 99% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.bin rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.bin index d994d20d0..c4caac3e2 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.bin and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.fbx similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.fbx rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.fbx diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index 0becaebec..53a0c18eb 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl @@ -11,10 +11,12 @@ float g_LifeRatio; float g_fRimStrength; float g_fRimPower; float3 g_vRimColor; +float4 g_TestColor; vector g_vCamPosition; Texture2D g_DiffuseTexture; Texture2D g_NormalTexture; +Texture2D g_MaskingTexture; matrix g_BoneMatrices[512]; @@ -272,6 +274,38 @@ PS_OUT_BLUR PS_MAIN_BLUR(PS_IN_BLUR In) return Out; } +PS_OUT PS_MAIN_TEST(PS_IN In) +{ + PS_OUT Out; + + float4 vMtrlDiffuse = g_TestColor; + + float4 vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord); + + float fAlpha = vMtrlMask.r; + + if (fAlpha < 0.1f) + discard; + + float4 vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); + + if (g_bRimLight) + { + float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength); + vMtrlDiffuse.rgb = lerp(vMtrlDiffuse.rgb, g_vRimColor.rgb, fRimLight); + } + + Out.vDiffuse = float4(vMtrlDiffuse.rgb * vMtrlMask.r, g_TestColor.a); + 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); + + return Out; +} + + + technique11 DefaultTechnique { @@ -313,4 +347,14 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN_BLUR(); } + + pass TestPass + { + 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(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_TEST(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index ab7438d1c..e7ed24253 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -110,7 +110,7 @@ Level3 true - EDITOR_PROJECT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + EDITOR_PROJECT;$(USERNAME);_DEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 ../../EngineSDK/Inc/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) @@ -125,6 +125,10 @@ ../../EngineSDK/Lib/$(ConfigurationName)/;../ThirdPartyLib/ZLib/$(ConfigurationName)/;%(AdditionalLibraryDirectories) Engine.lib;fmod_vc.lib;Crypt32.lib;assimp-vc145-mtd.lib;%(AdditionalDependencies) + + + + @@ -132,7 +136,7 @@ true true true - EDITOR_PROJECT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + EDITOR_PROJECT;$(USERNAME);NDEBUG;_WINDOWS;%(PreprocessorDefinitions);%(PreprocessorDefinitions) true stdcpp17 ../../EngineSDK/Inc/;../Public/;../../EngineSDK/Inc/DirectXTK/;../../EngineSDK/Inc/fMod/;../../EngineSDK/Inc/IMGUI/;../../EngineSDK/Inc/FX11/;%(AdditionalIncludeDirectories) @@ -147,6 +151,10 @@ ../../EngineSDK/Lib/$(ConfigurationName)/;../ThirdPartyLib/ZLib/$(ConfigurationName)/;%(AdditionalLibraryDirectories) Engine.lib;fmod_vc.lib;Crypt32.lib;assimp-vc145-mt.lib;%(AdditionalDependencies) + + + + diff --git a/Jusin154_Team3D/Editor/Private/Body.cpp b/Jusin154_Team3D/Editor/Private/Body.cpp index c37a1b1ca..97e0289c2 100644 --- a/Jusin154_Team3D/Editor/Private/Body.cpp +++ b/Jusin154_Team3D/Editor/Private/Body.cpp @@ -54,6 +54,7 @@ HRESULT CBody::Render() return S_OK; } + HRESULT CBody::Ready_Components() { if (m_strModelPrototypeTag != L"") diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp index d3a845edb..9bf8e5261 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp @@ -124,11 +124,6 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg) } } - /* Com_Model */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Steve_Model"), - reinterpret_cast(&m_pModelCom)))) - return E_FAIL; - /* Com_Shader */ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH, reinterpret_cast(&m_pShaderCom)))) diff --git a/Jusin154_Team3D/Editor/Private/Hair.cpp b/Jusin154_Team3D/Editor/Private/Hair.cpp index 402d702ce..5ad8984d5 100644 --- a/Jusin154_Team3D/Editor/Private/Hair.cpp +++ b/Jusin154_Team3D/Editor/Private/Hair.cpp @@ -49,7 +49,36 @@ void CHair::Late_Update(_float fTimeDelta) HRESULT CHair::Render() { - __super::Render(); + if (!m_pModelCom ||!m_pTextureCom) + return S_OK; + + 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_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } + + /*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(4))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } return S_OK; } @@ -65,9 +94,40 @@ HRESULT CHair::Ready_Components() } + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("MaskTexture1"), + reinterpret_cast(&m_pTextureCom)))) + return E_FAIL; + return S_OK; } +HRESULT CHair::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { + 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; + } + + if (FAILED(m_pTextureCom->Bind_ShaderResource(m_pShaderCom, "g_MaskingTexture", iTextureIndex))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_TestColor",&m_vColor,sizeof(_float4)))) { + return E_FAIL; + } + + return S_OK; +} CHair* CHair::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CHair* pInstance = new CHair(pDevice, pContext); @@ -98,8 +158,28 @@ void CHair::Free() { __super::Free(); + SAFE_RELEASE(m_pTextureCom); } void CHair::Describe_Entity() { + if (!m_pModelCom ) + return; + + for (_uint i = 0; i < dynamic_cast(m_pTextureCom)->Get_Size(); i++) + { + _char label[128]; + + sprintf_s(label, "%s%d","Mask",i); + + if (GUI::ImageButton(label, dynamic_cast(m_pTextureCom)->Get_SRV(i), ImVec2(48, 48))) + { + iTextureIndex = i; + } + } + + m_vColor = _float4(1.f, 0.f, 0.f, 1.f); + + GUI::DragFloat4("COLOR", (_float*)&m_vColor, 0.1f); + } diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 9c53bbcad..f4f0c684e 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -43,7 +43,7 @@ HRESULT CLevel_MapViewer::Initialize() return E_FAIL; } - if (FAILED(Ready_Layer_MapObjectManager(TEXT("Layer_MapObjectManager")))) { + if (FAILED(Ready_Layer_MapObjectManager(LAYER_MAPOBJECTMANAGER))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp index 924692483..0e2092626 100644 --- a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp @@ -72,34 +72,30 @@ void CLevel_ObjectViewer::Add_Object() void CLevel_ObjectViewer::Add_Human() { - if (GUI::BeginTabItem("Body")) + if (GUI::BeginTabItem("Head")) { - Category_PartsModelList("Human/Body","Body"); + Category_PartsModelList("Human/Head", "Head"); GUI::EndTabItem(); } - - if (GUI::BeginTabItem("Head")) + _bool bDisabled = {}; + if (m_HumanRoot) + bDisabled = (m_HumanRoot->Get_MainModel()); + if (!bDisabled) GUI::BeginDisabled(); + if (GUI::BeginTabItem("Body")) { - _bool bDisabled = (m_HumanRoot == nullptr); - if (bDisabled) GUI::BeginDisabled(); + Category_PartsModelList("Human/Body", "Body"); - Category_PartsModelList("Human/Head", "Head"); - - if (bDisabled) GUI::EndDisabled(); GUI::EndTabItem(); } if (GUI::BeginTabItem("Hair")) { - _bool bDisabled = (m_HumanRoot == nullptr); - if (bDisabled) GUI::BeginDisabled(); - Category_PartsModelList("Human/Hair", "Hair"); - if (bDisabled) GUI::EndDisabled(); GUI::EndTabItem(); } + if (!bDisabled) GUI::EndDisabled(); } void CLevel_ObjectViewer::Show_ModelFilePath() @@ -163,7 +159,8 @@ void CLevel_ObjectViewer::Category_PartsModelList(const _char* Category, const _ { if (!m_HumanRoot) { - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, TEXT("Layer_Root"), nullptr, nullptr, reinterpret_cast(&m_HumanRoot)))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, TEXT("Layer_Root"), + nullptr, nullptr, reinterpret_cast(&m_HumanRoot)))) return; } for (_uint i = 0; i < m_pGameInstance->BinaryModelFilePathCount(); i++) @@ -180,10 +177,19 @@ void CLevel_ObjectViewer::Category_PartsModelList(const _char* Category, const _ CDummyObject::PARTS_OBJECT_DESC Desc = {}; - Desc.pModelPrototypeTag = Save_ModelName(szCategory); + m_HumanRoot->Set_PrototypeModelName(Save_ModelName(szCategory)); - dynamic_cast(m_HumanRoot)->Set_PrototypeModelName(Desc.pModelPrototypeTag); - dynamic_cast(m_HumanRoot)->Set_ModelName(szCategory); + m_HumanRoot->Set_ModelName(szCategory); + + _uint iIndex = 0; + if (strstr(szCategory,"Head")) + iIndex = 0; + else if (strstr(szCategory,"Body")) + iIndex = 1; + else if (strstr(szCategory,"Hair")) + iIndex = 2; + + m_HumanRoot->Change_Model(iIndex); } } } @@ -206,14 +212,14 @@ void CLevel_ObjectViewer::Show_AnimList() } if (m_HumanRoot) { - CModel* pModel = dynamic_cast(m_HumanRoot)->Get_ModelParts(0)->Get_Component(); + CModel* pModel = m_HumanRoot->Get_MainModel(); if (pModel) { for (_uint i = 0; i < pModel->Get_AnimSize(); i++) { if (GUI::Button(pModel->Get_AnimList(i))) { - pModel->Set_AnimationIndex(i); + m_HumanRoot->Set_Animation(i); } } } @@ -263,7 +269,7 @@ void CLevel_ObjectViewer::Object_Setting() GUI::Begin("PartsObject_Info"); if (m_HumanRoot) { - CModel* pModel = dynamic_cast(m_HumanRoot)->Get_ModelParts(0)->Get_Component(); + CModel* pModel = m_HumanRoot->Get_MainModel(); if (pModel) { _float AnimTrack = pModel->Get_CurrentTrackPosition(); @@ -278,28 +284,39 @@ void CLevel_ObjectViewer::Object_Setting() { pModel->Set_PlayAnim(bPlayAnim); } + + if (GUI::Button("Add Event")) + { + ImDrawList* draw = ImGui::GetForegroundDrawList(); + ImVec2 center = ImGui::GetMainViewport()->GetCenter(); + float scale = 50.f; + + draw->AddLine(center, ImVec2(center.x + scale, center.y), IM_COL32(255, 0, 0, 255), 2.0f); + draw->AddLine(center, ImVec2(center.x, center.y - scale), IM_COL32(0, 255, 0, 255), 2.0f); + draw->AddLine(center, ImVec2(center.x + scale * 0.5f, center.y + scale * 0.5f), IM_COL32(0, 0, 255, 255), 2.0f); + } + if (GUI::Button("Delete")) { m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_Root"))->Clear_Layer(); m_HumanRoot = nullptr; } } + + if (m_HumanRoot) + m_HumanRoot->Get_ModelParts(2)->Describe_Entity(); } GUI::End(); } -void CLevel_ObjectViewer::Save_LayerName(const _char* Category) +void CLevel_ObjectViewer::Save_LayerName(const _char* Layer) { _wstring szLayer = TEXT("Layer_"); - _wchar szCategory[MAX_PATH]; + _wstring wstrPath = szLayer + CMyTools::ToWstring(Layer); - wcscpy_s(m_wszLayer, szLayer.c_str()); - - MultiByteToWideChar(CP_ACP, 0, Category, -1, szCategory, MAX_PATH); - - wcscat_s(m_wszLayer, szCategory); + wcscpy_s(m_wszLayer, wstrPath.c_str()); } _wchar* CLevel_ObjectViewer::Save_ModelName(const _char* Category) @@ -309,12 +326,8 @@ _wchar* CLevel_ObjectViewer::Save_ModelName(const _char* Category) _wstring szDir = TEXT("Prototype_Component_"); _wstring szDir2 = TEXT("_Model"); - _wchar wszName[MAX_PATH] = { 0 }; - - MultiByteToWideChar(CP_ACP, 0, m_szName, -1, wszName, MAX_PATH); - wcscpy_s(m_wszName, szDir.c_str()); - wcscat_s(m_wszName, wszName); + wcscat_s(m_wszName, CMyTools::ToWstring(m_szName).c_str()); wcscat_s(m_wszName, szDir2.c_str()); return m_wszName; @@ -326,7 +339,7 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Camera(const _wstring& strLayerTag) CameraDesc.fFovy = XMConvertToRadians(60.0f); CameraDesc.fNear = 0.1f; CameraDesc.fFar = 500.f; - CameraDesc.vEye = _float3(0.f, 50.f, -10.f); + CameraDesc.vEye = _float3(0.f, 30.f, -10.f); CameraDesc.vAt = _float3(0.f, 0.f, 0.f); CameraDesc.fSpeedPerSec = 5.f; CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f); @@ -362,8 +375,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_UI(const _wstring& strLayerTag) HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag) { - /*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))) - return E_FAIL;*/ + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))) + return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp index 5bd46b23c..344c79e51 100644 --- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp @@ -8,6 +8,8 @@ #include "Dummy_PhysXBox.h" #include "Dummy_PhysXPlayable.h" #include "Dummy_PhysXMesh.h" +#include "MapObject_Manager.h" +#include "BuildingContainer.h" CLevel_PhysXLab::CLevel_PhysXLab(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -85,38 +87,43 @@ HRESULT CLevel_PhysXLab::Ready_Layer_Camera(const _wstring& strLayerTag) HRESULT CLevel_PhysXLab::Ready_Layer_Terrain(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, LAYER_MAPOBJECTMANAGER))) + return E_FAIL; + return S_OK; } HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) { - for (int i = 0; i < 50; ++i) { - CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{}; - Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) }; - Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) }; + //for (int i = 0; i < 50; ++i) { + // CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{}; + // Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) }; + // Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) }; - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { - return E_FAIL; - } - } - - { - CDummy_PhysXPlayable::BOXSTARTPOS_DESC Desc{}; - Desc.vPos = { 0.f, 10.f, 0.f }; - Desc.vRotRPY = { 0.f, 0.f, 0.f }; - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) { - return E_FAIL; - } - } + // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { + // return E_FAIL; + // } + //} + // + //{ + // CDummy_PhysXPlayable::BOXSTARTPOS_DESC Desc{}; + // Desc.vPos = { 0.f, 10.f, 0.f }; + // Desc.vRotRPY = { 0.f, 0.f, 0.f }; + // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) { + // return E_FAIL; + // } + //} - { - CDummy_PhysXMesh::BOXSTARTPOS_DESC Desc{}; - Desc.vPos = { 0.f, 10.f, 0.f }; - Desc.vRotRPY = { 0.f, 0.f, 0.f }; - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CHUNK, &Desc))) { - return E_FAIL; - } - } + //{ + // CDummy_PhysXMesh::BOXSTARTPOS_DESC Desc{}; + // Desc.vPos = { 0.f, 10.f, 0.f }; + // Desc.vRotRPY = { 0.f, 0.f, 0.f }; + // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CHUNK, &Desc))) { + // return E_FAIL; + // } + //} return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 5421e9a67..420964812 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -13,7 +13,6 @@ #include "Body.h" #include "Hair.h" #include "Dummy_Goblin.h" -#include "Dummy_Goblin.h" #include "DummyObject.h" #include @@ -34,7 +33,6 @@ #include "Active_Icon.h" #include "MiniMap_Panel.h" -#include "MiniMap_TrimBorder.h" #include "Loading_Panel.h" #include "LoadingWidget.h" @@ -509,17 +507,71 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.tRigidDynamicDesc.vMatInfo = { 0.5f, 0.5f, 0.6f }; Desc.tRigidDynamicDesc.ePxShapeFlag = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; - m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc)); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"), - //CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){ - CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){ - return E_FAIL; - } + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"), + // //CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){ + // CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, "../Bin/Resources/Models/River/River.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){ + // return E_FAIL; + //} { - CModel* pModel = (CModel*)m_pGameInstance->Find_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model")); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + } + + m_strMessage = TEXT("Texture Loading.."); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) { + return E_FAIL; + } + m_strMessage = TEXT("Model Loading.."); + + + //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Box"), + // CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))){ + // return E_FAIL; + //} + +#ifdef 기무리 + vector<_wstring> ModelPrototypeTags = {}; + vector ModelPrototypePath = {}; + + //for (const auto& file : filesystem::directory_iterator("..\\Bin\\Resources\\Models\\MapMesh")) + for (const auto& file : filesystem::directory_iterator("C:\\Users\\kimnuri\\Desktop\\Hogwart\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain")) + { + if (file.is_directory()){ + continue; + } + + string ext = file.path().extension().string(); + + //if (strcmp(ext.c_str(), ".bin")) + // continue; + if (strcmp(ext.c_str(), ".fbx")) + continue; + + _char szFilePath[MAX_PATH] = {}; + + strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); + + _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); + + CModel* pModel = CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath); + + /*For Prototype_Component_Model_*/ + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, pModel ))){ + return E_FAIL; + } + + ModelPrototypeTags.push_back(strFileName); + ModelPrototypePath.push_back(file.path()); + _uint iNumMesh = pModel->Get_NumMeshes(); CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{}; @@ -532,49 +584,23 @@ HRESULT CLoader::Loading_For_PhysXLevel() } } } - { - m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)); - } - - m_strMessage = TEXT("Texture Loading.."); - - m_strMessage = TEXT("Model Loading.."); - -#ifdef 기무리 - for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes")) - { - if (file.is_directory()) - continue; - - string ext = file.path().extension().string(); - - if (strcmp(ext.c_str(), ".bin")) - continue; - - _char szFilePath[MAX_PATH] = {}; - - strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); - - _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - - /*For Prototype_Component_Model_*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) - return E_FAIL; - - ModelPrototypeTags.push_back(strFileName); - } -#endif // 기무리 - - - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Steve_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Steve/Steve.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))) + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Manager::Create(m_pDevice, m_pContext, ModelPrototypeTags, ModelPrototypePath)))){ return E_FAIL; + } + +#endif // 기무리 m_strMessage = TEXT("Shader Loading.."); m_strMessage = TEXT("Prototype Loading.."); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), + CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext)))) + return E_FAIL; + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXBox::Create(m_pDevice, m_pContext)))) { return E_FAIL; } @@ -585,6 +611,12 @@ HRESULT CLoader::Loading_For_PhysXLevel() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Static::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; + m_strMessage = TEXT("Loading Success!"); m_isFinished = true; @@ -644,7 +676,11 @@ HRESULT CLoader::Loading_For_ObjectViewer() return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Young_M_Head_Ivory_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_T_NPC_F_Head_Eye_Honey_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Hair1_Model"), @@ -655,6 +691,10 @@ HRESULT CLoader::Loading_For_ObjectViewer() CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Hair3_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Hair/Hair3/Hair3.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) + return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinHead_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/GoblinHead.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) return E_FAIL; @@ -671,6 +711,22 @@ HRESULT CLoader::Loading_For_ObjectViewer() CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Troll/Troll.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity())))) return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Desc_Box"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity())))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("MaskTexture1"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Models/Human/Hair/Mask%d.png"), 2)))) { + return E_FAIL; + } + + /*if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("MaskTexture2"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Models/Human/Hair/T_GHO_M_Hair_GHOHair01_WigTall_THV_MSK.png"), 0)))) { + return E_FAIL; + }*/ + + m_strMessage = TEXT("Shader Loading.."); m_strMessage = TEXT("Prototype Loading.."); @@ -718,17 +774,22 @@ HRESULT CLoader::Loading_For_MapViewer() m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); - vector<_wstring> ModelPrototypeTags; + vector<_wstring> ModelPrototypeTags = {}; + vector ModelPrototypePath = {}; - 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\\kimnuri\\Desktop\\Hogwart\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain")) { if (file.is_directory()) continue; string ext = file.path().extension().string(); - if (strcmp(ext.c_str(), ".fbx")) + //if (strcmp(ext.c_str(), ".bin")){ + // continue; + //} + if (strcmp(ext.c_str(), ".fbx")){ continue; + } _char szFilePath[MAX_PATH] = {}; @@ -736,36 +797,27 @@ HRESULT CLoader::Loading_For_MapViewer() _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); + CModel* pModel = CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath); + /*For Prototype_Component_Model_*/ - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, pModel))) return E_FAIL; ModelPrototypeTags.push_back(strFileName); + ModelPrototypePath.emplace_back(file.path()); + + _uint iNumMesh = pModel->Get_NumMeshes(); + + CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{}; + for (_uint i = 0; i < iNumMesh; ++i) { + Desc.eType = ACTOR::TRIANGLEMESH; + Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i); + Desc.tRigidStaticDesc.vMatInfo = _float3(0.5f, 0.5f, 0.6f); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(Desc.tRigidStaticDesc.szMeshName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + } } - //for (const auto& file : filesystem::directory_iterator("C:\\Users\\82103\\Desktop\\MapRe\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit")) - //{ - // if (file.is_directory()) - // continue; - - // string ext = file.path().extension().string(); - - // if (strcmp(ext.c_str(), ".fbx")) - // continue; - - // _char szFilePath[MAX_PATH] = {}; - - // strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); - - // _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - - // /*For Prototype_Component_Model_*/ - // if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - // CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) - // return E_FAIL; - - // ModelPrototypeTags.push_back(strFileName); - //} m_strMessage = TEXT("쉐이더를(을) 로딩 중 입니다."); @@ -793,9 +845,12 @@ HRESULT CLoader::Loading_For_MapViewer() return E_FAIL; /* For.Prototype_GameObject_MapObject_Manager */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Manager::Create(m_pDevice, m_pContext, ModelPrototypeTags)))) + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Manager::Create(m_pDevice, m_pContext, ModelPrototypeTags, ModelPrototypePath)))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXMesh::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp index 34ca2a9f7..cae66ff29 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -6,6 +6,7 @@ #include "Layer.h" #include "Terrain.h" #include "VIBuffer_Terrain.h" +#include "MapObject_Manager.h" CMapObject_LOD::CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CMapObject(pDevice, pContext) @@ -31,6 +32,7 @@ HRESULT CMapObject_LOD::Initialize(void* pArg) 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))) @@ -271,5 +273,41 @@ void CMapObject_LOD::Describe_Entity() if (GUI::Button("Delete")) m_bDead = true; + if (GUI::Button("Bake_StaticPhysXMesh")) { + GUI::OpenPopup("BakeStaticPhysXMesh##popup"); + } + + if (GUI::BeginPopup("BakeStaticPhysXMesh##popup")) { + if (GUI::Button("No")) { + GUI::CloseCurrentPopup(); + } + GUI::SameLine(); + if (GUI::Button("Bake!!!")) { + CMapObject_Manager* pManager = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_MAPOBJECTMANAGER)->Get_Object(); + for (_uint i = 0; i < (_uint)m_ModelPrototypeTags.size(); ++i) { + filesystem::path filePath = pManager->Get_PrototypePath(m_ModelPathIndices[i]); + + CModel* pModel = m_pModelComs[i]; + _uint iNumMesh = pModel->Get_NumMeshes(); + pModel->Save_PhysXTriMeshes(filePath.string().c_str()); + + + CRigidBody::RIGIDBODY_DESC Desc{}; + Desc.eType = ACTOR::TRIANGLEMESH; + + for (_uint i = 0; i < iNumMesh; ++i) + { // RIGID_BODY + Desc.tRigidStaticDesc.szMeshName = pModel->Get_MeshName(i); + + if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(pModel->Get_MeshName(i)).c_str(), nullptr, &Desc))) { + assert(false); + } + } + } + GUI::CloseCurrentPopup(); + } + GUI::EndPopup(); + } + m_bSelected = true; } \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 13fa89b1f..eeac3dcd7 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -19,26 +19,28 @@ CMapObject_Manager::CMapObject_Manager(const CMapObject_Manager& rhs) : CGameObject(rhs) , m_ModelPrototypeTags{ rhs.m_ModelPrototypeTags } , m_LODModelPrototypeTags{ rhs.m_LODModelPrototypeTags } + , m_ModelPrototypePaths{ rhs.m_ModelPrototypePaths } { } -HRESULT CMapObject_Manager::Initialize_Prototype(vector<_wstring>& ModelPrototypeTags) +HRESULT CMapObject_Manager::Initialize_Prototype(vector<_wstring>& ModelPrototypeTags, vector& ModelPrototypePaths) { - for (auto& Tag : ModelPrototypeTags) + //for (auto& Tag : ModelPrototypeTags) + for (_uint i = 0 ; i < ModelPrototypeTags.size(); ++i) { - if (_wstring::npos != Tag.find(L"Lod")) + if (_wstring::npos != ModelPrototypeTags[i].find(L"Lod")) { - m_LODModelPrototypeTags.push_back(Tag); + m_LODModelPrototypeTags.push_back(ModelPrototypeTags[i]); } - m_ModelPrototypeTags.push_back(Tag); - + m_ModelPrototypeTags.push_back(ModelPrototypeTags[i]); + m_ModelPrototypePaths.push_back(ModelPrototypePaths[i]); } return S_OK; } -HRESULT CMapObject_Manager::Initialize(void* pArg) +HRESULT CMapObject_Manager::Initialize(void* pArg) { if (FAILED(__super::Initialize(pArg))) return E_FAIL; @@ -122,6 +124,11 @@ HRESULT CMapObject_Manager::Render() return S_OK; } +const filesystem::path CMapObject_Manager::Get_PrototypePath(_uint iModelIndex) +{ + return m_ModelPrototypePaths[iModelIndex]; +} + HRESULT CMapObject_Manager::Ready_Components() { __super::Ready_Components(nullptr); @@ -416,7 +423,7 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) #pragma region MAPOBJECT_STATIC if (0 == iLodLevel) /* MapObject_Static */ { - CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + MAPOBJECT_STATIC_DESC Desc = {}; string strTag = {}; auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); @@ -452,7 +459,7 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) #pragma region MAPOBJECT_LOD else { - CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + MAPOBJECT_LOD_DESC Desc = {}; string strTag = {}; for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { @@ -567,7 +574,7 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch #pragma region MAPOBJECT_STATIC if (0 == iLodLevel) /* MapObject_Static */ { - CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + MAPOBJECT_STATIC_DESC Desc = {}; string strTag = {}; auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); @@ -603,7 +610,7 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch #pragma region MAPOBJECT_LOD else { - CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + MAPOBJECT_LOD_DESC Desc = {}; string strTag = {}; for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { @@ -646,24 +653,30 @@ HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _ch void CMapObject_Manager::Update_PrototypeList() { GUI::Begin("Model Prototype List"); - for (auto& Tag : m_ModelPrototypeTags) + + _uint iMaxSize = (_uint)m_ModelPrototypeTags.size(); + for (_uint i = 0; i < iMaxSize; ++i) { - if (_wstring::npos != Tag.find(L"Lod")) + auto& Tag = m_ModelPrototypeTags[i]; + + if (_wstring::npos != Tag.find(L"Lod")){ continue; + } if (ImGui::Button(CMyTools::ToString(Tag).c_str())) { - _uint iNumLodModel = {}; + vector<_uint> LodModelIndices; - if(false == Find_Lod_Prototype(Tag, &iNumLodModel)) + if(false == Find_Lod_Prototype(Tag, LodModelIndices)) { - CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + MAPOBJECT_STATIC_DESC Desc = {}; Desc.strModelPrototypeTag = Tag; Desc.pParentTransform = m_pTransformCom; Desc.vPosition = _float3(0.f, 0.f, 0.f); Desc.vRotation = _float3(0.f, 0.f, 0.f); Desc.vScale = _float3(1.f, 1.f, 1.f); + Desc.iModelPathIndex = i; CMapObject_Static* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); @@ -677,7 +690,7 @@ void CMapObject_Manager::Update_PrototypeList() } else { - CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + MAPOBJECT_LOD_DESC Desc = {}; vector<_wstring> PrototypeTags; @@ -688,6 +701,7 @@ void CMapObject_Manager::Update_PrototypeList() Desc.vPosition = _float3(0.f, 0.f, 0.f); Desc.vRotation = _float3(0.f, 0.f, 0.f); Desc.vScale = _float3(1.f, 1.f, 1.f); + Desc.pModelPathIndices = &LodModelIndices; CMapObject_LOD* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); @@ -699,7 +713,7 @@ void CMapObject_Manager::Update_PrototypeList() m_MapObjects.push_back(pMapObject); - for (_uint i = 0; i < iNumLodModel; ++i) + for (_uint i = 0; i < LodModelIndices.size(); ++i) { _wstring strLodTag = Tag + L"_Lod" + to_wstring(i + 1); @@ -805,25 +819,28 @@ void CMapObject_Manager::Update_ContainerObject() GUI::End(); } -_bool CMapObject_Manager::Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount) +_bool CMapObject_Manager::Find_Lod_Prototype(_wstring strPrototypeTag, vector<_uint>& LodModelIndices) { - for (auto& Tag : m_LODModelPrototypeTags) + // for (auto& Tag : m_LODModelPrototypeTags) + for(_uint i = 0 ; i < m_ModelPrototypeTags.size(); ++i) { - if (_wstring::npos != Tag.find(strPrototypeTag)) - (*iCount)++; + if (_wstring::npos != m_ModelPrototypeTags[i].find(strPrototypeTag)) + LodModelIndices.push_back(i); } - if (0 < *iCount) + if (0 < LodModelIndices.size()) { return true; - + } return false; + //if (0 < *iCount) + // return true; } -CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags) +CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags, vector& ModelPrototypePaths) { CMapObject_Manager* pInstance = new CMapObject_Manager(pDevice, pContext); - if (FAILED(pInstance->Initialize_Prototype(ModelPrototypeTags))) + if (FAILED(pInstance->Initialize_Prototype(ModelPrototypeTags, ModelPrototypePaths))) { MSG_BOX("Failed to Created : CMapObject_Manager"); Safe_Release(pInstance); diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp index 9872827b3..e54c46af8 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp @@ -6,6 +6,7 @@ #include "Layer.h" #include "Terrain.h" #include "VIBuffer_Terrain.h" +#include "MapObject_Manager.h" CMapObject_Static::CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CMapObject(pDevice, pContext) @@ -97,6 +98,7 @@ HRESULT CMapObject_Static::Initialize(void* pArg) MAPOBJECT_STATIC_DESC* pDesc = static_cast(pArg); m_strModelPrototypeTag = pDesc->strModelPrototypeTag; + m_iModelPathIndex = pDesc->iModelPathIndex; if (FAILED(__super::Initialize(pArg))) return E_FAIL; @@ -235,5 +237,37 @@ void CMapObject_Static::Describe_Entity() if (ImGui::Button("Delete")) m_bDead = true; + if (GUI::Button("Bake_StaticPhysXMesh")) { + GUI::OpenPopup("BakeStaticPhysXMesh##popup"); + } + + if (GUI::BeginPopup("BakeStaticPhysXMesh##popup")) { + if (GUI::Button("No")) { + GUI::CloseCurrentPopup(); + } + GUI::SameLine(); + if (GUI::Button("Bake!!!")) { + CMapObject_Manager* pManager = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_MAPOBJECTMANAGER)->Get_Object(); + + filesystem::path filePath = pManager->Get_PrototypePath(m_iModelPathIndex); + m_pModelCom->Save_PhysXTriMeshes(CMyTools::ToString(pManager->Get_PrototypePath(m_iModelPathIndex)).c_str()); + _uint iNumMesh = m_pModelCom->Get_NumMeshes(); + + CRigidBody::RIGIDBODY_DESC Desc{}; + Desc.eType = ACTOR::TRIANGLEMESH; + + for (_uint i = 0; i < iNumMesh; ++i) + { // RIGID_BODY + Desc.tRigidStaticDesc.szMeshName = m_pModelCom->Get_MeshName(i); + + if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(m_pModelCom->Get_MeshName(i)).c_str(), nullptr, &Desc))) { + assert(false); + } + } + GUI::CloseCurrentPopup(); + } + GUI::EndPopup(); + } + m_bSelected = true; } \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/ModelParts.cpp b/Jusin154_Team3D/Editor/Private/ModelParts.cpp index 33f174a9a..55933a3af 100644 --- a/Jusin154_Team3D/Editor/Private/ModelParts.cpp +++ b/Jusin154_Team3D/Editor/Private/ModelParts.cpp @@ -47,9 +47,6 @@ void CModelParts::Update(_float fTimeDelta) { XMStoreFloat4x4(&m_CombinedWorldMatrix, XMLoadFloat4x4(m_pTransformCom->Get_WorldMatrixPtr()) * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr())); - - Change_Model(); - } void CModelParts::Late_Update(_float fTimeDelta) @@ -92,53 +89,17 @@ HRESULT CModelParts::Render() return S_OK; } -void CModelParts::Change_Model() +void CModelParts::Change_Model(const _wchar* Prototype) { - if (dynamic_cast(m_pOwner)->Get_PrototypeModelName()) + if (m_pModelCom) { - if (m_strPreModelPrototypeTag != dynamic_cast(m_pOwner)->Get_PrototypeModelName()) - { - Set_Model("Body"); - Set_Model("Hair"); - Set_Model("Head"); - } - } -} - -void CModelParts::Set_Model(const _char* PartType) -{ - const _char* ObjectType = typeid(*this).name(); - const _char* ModelName = dynamic_cast(m_pOwner)->Get_ModelName(); - if (strstr(ObjectType, PartType)) - { - if (strstr(ModelName, PartType)) - { - if (m_pModelCom) - { - m_iAnimIndex = m_pModelCom->Get_AnimIndex(); - m_fTrackPosition = m_pModelCom->Get_CurrentTrackPosition(); - SAFE_RELEASE(m_pModelCom); - Remove_Component(); - } - - m_strModelPrototypeTag = dynamic_cast(m_pOwner)->Get_PrototypeModelName(); - - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, - reinterpret_cast(&m_pModelCom)))) - return; - - if (strstr(PartType,"Body")) - { - dynamic_cast(m_pOwner)->Set_MainModel(m_pModelCom); - } - - m_pModelCom->Set_AnimationIndex(m_iAnimIndex); - m_pModelCom->Set_CurrentTrackPosition(m_fTrackPosition); - - m_strPreModelPrototypeTag = m_strModelPrototypeTag; - } + Remove_Component(); + SAFE_RELEASE(m_pModelCom); } + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, Prototype, + reinterpret_cast(&m_pModelCom)))) + return; } HRESULT CModelParts::Ready_Components() diff --git a/Jusin154_Team3D/Editor/Private/RootModelPart.cpp b/Jusin154_Team3D/Editor/Private/RootModelPart.cpp index 162a74143..dab940de2 100644 --- a/Jusin154_Team3D/Editor/Private/RootModelPart.cpp +++ b/Jusin154_Team3D/Editor/Private/RootModelPart.cpp @@ -28,6 +28,9 @@ HRESULT CRootModelPart::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + if (FAILED(Ready_PartObjects())) return E_FAIL; @@ -58,22 +61,71 @@ HRESULT CRootModelPart::Render() void CRootModelPart::Update_Anim(_float fTimeDelta) { + if (!m_pMainModel) + return; + for (auto& ModelParts : m_ModelParts) { CModel* pModel = ModelParts->Get_Component(); if (pModel) { pModel->Set_PlayAnim(m_pMainModel->Get_PlayAnim()); - pModel->Set_AnimationIndex(m_pMainModel->Get_AnimIndex()); - pModel->Set_CurrentTrackPosition(m_pMainModel->Get_CurrentTrackPosition()); + pModel->Set_AnimSpeed(m_pMainModel->Get_AnimSpeed()); pModel->Play_Animation(fTimeDelta); } } } - -HRESULT CRootModelPart::Ready_Components() +void CRootModelPart::Set_MainModel(CModel* Model) { + if (m_pMainModel) + { + SAFE_RELEASE(m_pMainModel); + } + m_pMainModel = Model; +} + +void CRootModelPart::Change_Model(_uint iIndex) +{ + if (m_pMainModel) + { + m_iAnimIndex = m_pMainModel->Get_AnimIndex(); + m_fTrackPosition = m_pMainModel->Get_CurrentTrackPosition(); + } + + m_ModelParts[iIndex]->Change_Model(m_PrototypeModelName); + + CModel* pModel = m_ModelParts[iIndex]->Get_Component(); + + pModel->Set_AnimationIndex(m_iAnimIndex); + pModel->Set_CurrentTrackPosition(m_fTrackPosition); + pModel->Play_Animation(0.f); + + if (iIndex == 0) + { + Set_MainModel(m_ModelParts[iIndex]->Get_Component()); + } +} + +void CRootModelPart::Set_Animation(_uint iAnimIndex) +{ + m_pMainModel->Set_AnimationIndex(iAnimIndex); + + for (auto& PartObject : m_ModelParts) + { + CModel* pModel = PartObject->Get_Component(); + if (pModel) + { + pModel->Set_AnimationIndex(m_pMainModel->Get_AnimIndex()); + pModel->Set_CurrentTrackPosition(m_pMainModel->Get_CurrentTrackPosition()); + } + } +} + +HRESULT CRootModelPart::Ready_Components(void* pArg) +{ + __super::Ready_Components(pArg); + return S_OK; } @@ -86,12 +138,12 @@ HRESULT CRootModelPart::Ready_PartObjects() CModelParts* pModelPartsObject = { nullptr }; - if (FAILED(Add_PartObject("Human_Body", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast(&pModelPartsObject), &PartsDesc))) + if (FAILED(Add_PartObject("Human_Head", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast(&pModelPartsObject), &PartsDesc))) return E_FAIL; m_ModelParts.push_back(pModelPartsObject); - if (FAILED(Add_PartObject("Human_Head", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast(&pModelPartsObject), &PartsDesc))) + if (FAILED(Add_PartObject("Human_Body", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast(&pModelPartsObject), &PartsDesc))) return E_FAIL; m_ModelParts.push_back(pModelPartsObject); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 14cf3d69e..4a0455f58 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -3,6 +3,8 @@ #include #include "../Default/framework.h" #include "wincrypt.h" + +#include "Engine_Define.h" #include "Editor_Macro.h" #include "Editor_Struct.h" diff --git a/Jusin154_Team3D/Editor/Public/Editor_Macro.h b/Jusin154_Team3D/Editor/Public/Editor_Macro.h index e14d42a20..057790628 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Macro.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Macro.h @@ -51,6 +51,8 @@ namespace Editor { #define LAYER_CELL TEXT("Layer_Cell") #define LAYER_TRIGGER TEXT("Layer_Trigger") +#define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager") + #pragma endregion #pragma region MACRO_TEXTURE diff --git a/Jusin154_Team3D/Editor/Public/Editor_Struct.h b/Jusin154_Team3D/Editor/Public/Editor_Struct.h index 22430919b..f7cec534e 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Struct.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Struct.h @@ -1,5 +1,30 @@ #pragma once -namespace Editor { +NS_BEGIN(Engine) +class CTransform; +NS_END -} \ No newline at end of file +NS_BEGIN(Editor) + +typedef struct tagMapObject_Desc { + CTransform* pParentTransform = { nullptr }; + _float3 vScale; + _float3 vRotation; + _float3 vPosition; +}MAPOBJECT; + +typedef struct tagMapObjectStaticDesc : public tagMapObject_Desc +{ + _uint iMaxLodLevel{}; + _wstring strModelPrototypeTag; + _uint iModelPathIndex = { UINT_MAX }; +}MAPOBJECT_STATIC_DESC; + +typedef struct tagMapObjectLodDesc : public tagMapObject_Desc +{ + _uint iMaxLodLevel{}; + vector<_wstring> ModelPrototypeTags; + vector<_uint>* pModelPathIndices = { nullptr }; +}MAPOBJECT_LOD_DESC; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/Hair.h b/Jusin154_Team3D/Editor/Public/Hair.h index 8f35f5521..0ae891ab3 100644 --- a/Jusin154_Team3D/Editor/Public/Hair.h +++ b/Jusin154_Team3D/Editor/Public/Hair.h @@ -22,13 +22,13 @@ class CHair final : public CModelParts virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; - private: HRESULT Ready_Components(); - + HRESULT Bind_ShaderResources(); private: CTexture* m_pTextureCom = { nullptr }; - + _uint iTextureIndex = { 0 }; + _float4 m_vColor = {}; public: static CHair* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; diff --git a/Jusin154_Team3D/Editor/Public/Head.h b/Jusin154_Team3D/Editor/Public/Head.h index c4128d947..6afbfb83e 100644 --- a/Jusin154_Team3D/Editor/Public/Head.h +++ b/Jusin154_Team3D/Editor/Public/Head.h @@ -19,7 +19,6 @@ class CHead final : public CModelParts virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; - private: HRESULT Ready_Components(); diff --git a/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h b/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h index 1ee332543..849b16943 100644 --- a/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h @@ -34,20 +34,19 @@ class CLevel_ObjectViewer final : public CLevel void Show_AnimList(); void Show_ObjectList(); void Object_Setting(); - void Save_LayerName(const _char* Category); + void Save_LayerName(const _char* Layer); _wchar* Save_ModelName(const _char* Category); private: - vector m_Objects; - vector m_PartsObjects; - CGameObject* m_HumanRoot = { nullptr }; - _int m_iObjectIndex = { 0 }; - _int m_iPartsObjectIndex = { 0 }; - _char m_szName[MAX_PATH]; - _wchar m_wszName[MAX_PATH]; - _wchar m_wszLayer[MAX_PATH]; - _wchar m_wszPreLayer[MAX_PATH]; - + vector m_Objects; + vector m_PartsObjects; + class CRootModelPart* m_HumanRoot = { nullptr }; + _int m_iObjectIndex = { 0 }; + _int m_iPartsObjectIndex = { 0 }; + _char m_szName[MAX_PATH]; + _wchar m_wszName[MAX_PATH]; + _wchar m_wszLayer[MAX_PATH]; + _wchar m_wszPreLayer[MAX_PATH]; public: static CLevel_ObjectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID); diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h index ec7acf8c8..194fbb031 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -5,18 +5,8 @@ NS_BEGIN(Editor) -class CMapObject_LOD final : public CMapObject +class CMapObject_LOD final : public CMapObject // LOD Àִ ¾ֵé { -public: - typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC - { - _uint iMaxLodLevel{}; - vector<_wstring> ModelPrototypeTags; - _float3 vPosition; - _float3 vScale; - _float3 vRotation; - }MAPOBJECT_LOD_DESC; - private: CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CMapObject_LOD(const CMapObject_LOD& Prototype); @@ -42,6 +32,7 @@ class CMapObject_LOD final : public CMapObject _uint m_iLodIndex = {}; vector<_wstring> m_ModelPrototypeTags; + vector<_uint> m_ModelPathIndices = { }; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index bc8bc4451..5ca6933d7 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -18,18 +18,21 @@ class CMapObject_Manager final : public CGameObject virtual ~CMapObject_Manager() = default; public: - virtual HRESULT Initialize_Prototype(vector<_wstring>& ModelPrototypeTags); + virtual HRESULT Initialize_Prototype(vector<_wstring>& ModelPrototypeTags, vector& ModelPrototypePaths); virtual HRESULT Initialize(void* pArg) override; virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + const filesystem::path Get_PrototypePath(_uint iModelIndex); + private: class CMapObject* m_pSelectObject = { nullptr }; list m_MapObjects = {}; vector<_wstring> m_ModelPrototypeTags; vector<_wstring> m_LODModelPrototypeTags; + vector m_ModelPrototypePaths; _uint m_iContainerObjectIndex = {}; @@ -51,10 +54,10 @@ class CMapObject_Manager final : public CGameObject void Update_Edit(); void Update_ContainerObject(); - _bool Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount); + _bool Find_Lod_Prototype(_wstring strPrototypeTag, vector<_uint>& LodModelIndices); public: - static CMapObject_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags); + static CMapObject_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags, vector& ModelPrototypePaths); virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; virtual void Free() override; virtual void Describe_Entity() override; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Static.h b/Jusin154_Team3D/Editor/Public/MapObject_Static.h index c2c32d05d..067097ed5 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Static.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Static.h @@ -5,18 +5,8 @@ NS_BEGIN(Editor) -class CMapObject_Static final : public CMapObject +class CMapObject_Static final : public CMapObject // LOD ¸ðµ¨ÀÌ ¾ø´Â ¾ֵé { -public: - typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC - { - _uint iMaxLodLevel{}; - _wstring strModelPrototypeTag; - _float3 vPosition; - _float3 vScale; - _float3 vRotation; - }MAPOBJECT_STATIC_DESC; - private: CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CMapObject_Static(const CMapObject_Static& Prototype); @@ -36,6 +26,7 @@ class CMapObject_Static final : public CMapObject CModel* m_pModelCom = { nullptr }; _wstring m_strModelPrototypeTag; + _uint m_iModelPathIndex = { UINT_MAX }; private: virtual HRESULT Initialize_Prototype() override; diff --git a/Jusin154_Team3D/Editor/Public/ModelParts.h b/Jusin154_Team3D/Editor/Public/ModelParts.h index f0b45833f..e34d3834a 100644 --- a/Jusin154_Team3D/Editor/Public/ModelParts.h +++ b/Jusin154_Team3D/Editor/Public/ModelParts.h @@ -30,8 +30,7 @@ class CModelParts abstract : public CPartObject virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; - void Change_Model(); - void Set_Model(const _char*PartType); + virtual void Change_Model(const _wchar* Prototype); _wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; } protected: @@ -41,11 +40,8 @@ class CModelParts abstract : public CPartObject _float m_fRimLightPower = { 3.2f }; _float m_fRimLightStrength = { 3.04f }; _float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f }; - _float m_fTrackPosition = {}; - _uint m_iAnimIndex = {}; _wstring m_strModelPrototypeTag; - _wstring m_strPreModelPrototypeTag; protected: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); diff --git a/Jusin154_Team3D/Editor/Public/RootModelPart.h b/Jusin154_Team3D/Editor/Public/RootModelPart.h index 2be0fd1fd..0e5490722 100644 --- a/Jusin154_Team3D/Editor/Public/RootModelPart.h +++ b/Jusin154_Team3D/Editor/Public/RootModelPart.h @@ -10,6 +10,16 @@ NS_BEGIN(Editor) class CRootModelPart final : public CContainerObject { + +public: + void Set_PrototypeModelName(const _wchar* PrototypeModelName) { m_PrototypeModelName = PrototypeModelName; } + void Set_ModelName(const _char* Name) { m_ModelName = Name; } + const _wchar* Get_PrototypeModelName() { return m_PrototypeModelName; } + const _char* Get_ModelName() { return m_ModelName; } + class CModelParts* Get_ModelParts(_uint iIndex) { return m_ModelParts[iIndex]; } + class CModel* Get_MainModel() { return m_pMainModel; } + _uint Get_Index() { return m_iAnimIndex; } + private: CRootModelPart(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CRootModelPart(const CRootModelPart& Prototype); @@ -23,21 +33,20 @@ class CRootModelPart final : public CContainerObject virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; void Update_Anim(_float fTimeDelta); - void Set_AnimIndex(_uint iIndex) { m_iAnimIndex = iIndex; } - void Set_PrototypeModelName(const _wchar* PrototypeModelName) { m_PrototypeModelName = PrototypeModelName; } - void Set_ModelName(const _char* Name) { m_ModelName = Name; } - const _wchar* Get_PrototypeModelName() { return m_PrototypeModelName; } - const _char* Get_ModelName() { return m_ModelName; } - class CModelParts* Get_ModelParts(_uint iIndex) { return m_ModelParts[iIndex]; } - void Set_MainModel(class CModel* Model) { m_pMainModel = Model; } + void Set_MainModel(class CModel* Model); + void Change_Model(_uint iIndex); + void Set_Animation(_uint iAnimIndex); + private: - class CModel* m_pMainModel = { nullptr }; - vector m_ModelParts = {}; - _uint m_iAnimIndex = { 0 }; - const _wchar* m_PrototypeModelName = { 0 }; - const _char* m_ModelName = { 0 }; + class CModel* m_pMainModel = { nullptr }; + vector m_ModelParts = {}; + const _wchar* m_PrototypeModelName = { 0 }; + const _char* m_ModelName = { 0 }; + _uint m_iAnimIndex = { 0 }; + _float m_fTrackPosition = {}; + private: - HRESULT Ready_Components(); + virtual HRESULT Ready_Components(void*pArg); HRESULT Ready_PartObjects(); HRESULT Bind_ShaderResources(); diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj index 2a1aa5df0..090a89d1b 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj @@ -126,6 +126,16 @@ ../ThirdPartyLib/fMod/;../ThirdPartyLib/DirectXTK/;../ThirdPartyLib/FX11/;../ThirdPartyLib/Assimp/;../ThirdPartyLib/PhysX/PhysX_$(Configuration)/;%(AdditionalLibraryDirectories) d3d11.lib;fmod_vc.lib;dinput8.lib;LowLevel_static_64.lib;LowLevelAABB_static_64.lib;LowLevelDynamics_static_64.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;PhysXPvdSDK_static_64.lib;PhysXTask_static_64.lib;SceneQuery_static_64.lib;SimulationController_static_64.lib;PhysXCharacterKinematic_static_64.lib;DirectXTKd.lib;Effects11d.lib;assimp-vc145-mtd.lib;%(AdditionalDependencies);%(AdditionalDependencies) + + cd /d "$(SolutionDir)" +call CleanUp.bat + + + + cd /d "$(SolutionDir)" +call Update_Lib.bat + + @@ -133,7 +143,7 @@ true true true - EDITOR_PROJECT;ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;$(USERDOMAIN);NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + EDITOR_PROJECT;ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;$(USERNAME);NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true stdcpp17 ../Public/;%(AdditionalIncludeDirectories) @@ -149,6 +159,16 @@ ../ThirdPartyLib/fMod/;../ThirdPartyLib/DirectXTK/;../ThirdPartyLib/FX11/;../ThirdPartyLib/Assimp/;../ThirdPartyLib/PhysX/PhysX_$(Configuration)/;%(AdditionalLibraryDirectories) d3d11.lib;fmod_vc.lib;dinput8.lib;LowLevel_static_64.lib;LowLevelAABB_static_64.lib;LowLevelDynamics_static_64.lib;PhysX_64.lib;PhysXCommon_64.lib;PhysXCooking_64.lib;PhysXExtensions_static_64.lib;PhysXFoundation_64.lib;PhysXPvdSDK_static_64.lib;PhysXTask_static_64.lib;SceneQuery_static_64.lib;SimulationController_static_64.lib;PhysXCharacterKinematic_static_64.lib;DirectXTK.lib;Effects11.lib;assimp-vc145-mt.lib;%(AdditionalDependencies);%(AdditionalDependencies) + + cd /d "$(SolutionDir)" +call CleanUp.bat + + + + cd /d "$(SolutionDir)" +call Update_Lib.bat + + diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 8b23ee988..eb690b3bc 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -494,7 +494,7 @@ _bool CModel::SaveAssimpModel(const _char* filename) _splitpath_s(filename, nullptr, 0, nullptr, 0, nullptr, 0, szExt, MAX_PATH); strcat_s(szModel, sizeof(_char) * MAX_PATH, szExt); - _string savePath = filename; + _string savePath = filename; SaveModel modelData; modelData.MeshCount = m_pAIScene->mNumMeshes; @@ -504,8 +504,8 @@ _bool CModel::SaveAssimpModel(const _char* filename) { aiMesh* mesh = m_pAIScene->mMeshes[i]; SaveMesh saveMesh{}; - - saveMesh.MeshName = mesh->mName.C_Str(); + + saveMesh.MeshName = mesh->mName.C_Str(); saveMesh.MeshNameSize = (_int)saveMesh.MeshName.size() + 1; saveMesh.VertexCount = mesh->mNumVertices; saveMesh.IndexCount = mesh->mNumFaces * 3; @@ -713,7 +713,7 @@ _bool CModel::SaveAssimpModel(const _char* filename) for (auto& Anim : modelData.Animations) { fwrite(&Anim.AnimNameSize, sizeof(_uint), 1, fp); - fwrite(Anim.AnimName.data(), 1,Anim.AnimNameSize, fp); + fwrite(Anim.AnimName.data(), 1, Anim.AnimNameSize, fp); fwrite(&Anim.mDuration, sizeof(_float), 1, fp); fwrite(&Anim.mTicksPerSecond, sizeof(_float), 1, fp); fwrite(&Anim.ChannelCount, sizeof(_uint), 1, fp); @@ -756,7 +756,7 @@ _int CModel::SaveNodeRecursive(const aiNode* pAINode, std::vector& out { SaveNode node{}; node.NodeName = pAINode->mName.C_Str(); - node.NodeNameSize =(_uint)node.NodeName.size() + 1; + node.NodeNameSize = (_uint)node.NodeName.size() + 1; node.ParentIndex = parentIndex; const aiMatrix4x4& m = pAINode->mTransformation; @@ -811,17 +811,9 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma #pragma region Material if (MODEL::ENVIROMENT == eType) { -#ifdef 기무리 - if (FAILED(Ready_Materials(m_pAIScene, pModelFilePath))) { - return E_FAIL; - } -#endif // 기무리 -#ifndef 기무리 if (FAILED(Ready_Materials_FromFile(m_pAIScene, pModelFilePath))) { return E_FAIL; } -#endif // !기무리 - } else { @@ -870,21 +862,21 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _ return S_OK; } m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath); - + XMStoreFloat4x4(&m_PreTransformMatrix, PreTransformMatrix); Ready_Bones(m_pSaveModel->Nodes, 0, -1); - if (FAILED(Ready_Meshes())){ + if (FAILED(Ready_Meshes())) { return E_FAIL; } - if (FAILED(Ready_Materials(pModelFilePath))){ + if (FAILED(Ready_Materials(pModelFilePath))) { return E_FAIL; } - if (FAILED(Ready_Animations())){ + if (FAILED(Ready_Animations())) { return E_FAIL; } @@ -942,7 +934,7 @@ _bool CModel::LoadData(const _char* filename) fread(&mesh.Bones[i].OffsetMatrix, sizeof(XMFLOAT4X4), 1, fp); fread(&mesh.Bones[i].WeightsCount, sizeof(_uint), 1, fp); mesh.Bones[i].Weights.resize(mesh.Bones[i].WeightsCount); - for (size_t j = 0;j < mesh.Bones[i].WeightsCount; j++) + for (size_t j = 0; j < mesh.Bones[i].WeightsCount; j++) { fread(&mesh.Bones[i].Weights[j].VertexId, sizeof(_uint), 1, fp); fread(&mesh.Bones[i].Weights[j].Weight, sizeof(_float), 1, fp); @@ -1019,7 +1011,7 @@ _bool CModel::LoadData(const _char* filename) mat.Path[k][j] = temp; } } - + NewModel.Materials.push_back(mat); } @@ -1112,7 +1104,7 @@ HRESULT CModel::Ready_Animations() return S_OK; } -CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath,_fmatrix PreTransformMatrix) +CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix) { CModel* pInstance = new CModel(pDevice, pContext); diff --git a/Jusin154_Team3D/Engine/Public/Animation.h b/Jusin154_Team3D/Engine/Public/Animation.h index a5a26c873..717d565b9 100644 --- a/Jusin154_Team3D/Engine/Public/Animation.h +++ b/Jusin154_Team3D/Engine/Public/Animation.h @@ -28,7 +28,6 @@ class ENGINE_DLL CAnimation : public CBase void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; } _float Get_AnimSpeed() { return m_fAnimSpeed; } - #ifdef EDITOR_PROJECT private: HRESULT Initialize(const vector& Bones, const aiAnimation* pAIAnimation); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h index 7f2c7f48f..859a091fa 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h @@ -85,7 +85,7 @@ struct SaveBone XMFLOAT4X4 OffsetMatrix; int BoneIndex = {}; unsigned int WeightsCount = {}; - vectorWeights; + vectorWeights = {}; }; struct SaveNode diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index b84177e4e..d6b39de17 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -191,7 +191,7 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix); HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); - HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); + HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // ¸ðµ¨ ºҷ¯¿Դø °æ·ο¡ ±״ë·Î ÀÖÀ½ #pragma endregion