#include "pch.h" #include "Loader.h" #include "GameInstance.h" #include "MainApp.h" #include "Light_Main.h" #include "Camera_Debug.h" #include "Client_Struct.h" #include "Model.h" #pragma region UI #include "GamePlay_Canvas.h" #include "Loading_Panel.h" #include "LoadingWidget.h" #include "Action_Panel.h" #include "MiniMap_Panel.h" #include "MiniMap_TrimBorder.h" #include "NoMountIcon.h" #include "Mission_Panel.h" #pragma endregion #include "Player.h" #include "Camera_Gaze.h" #include "CamPosition_Socket.h" #include "CamPosition_Target.h" #include "CamPosition_Shoulder.h" #include "CamPosition_Arm.h" #include "Wand.h" #include "SkyBox.h" #include "Broom.h" #include "Goblin.h" #pragma region PHYSX #include "Dummy_PhysXWall.h" #include "Dummy_PhysXPlayable.h" #include "PhysXEffectHitBox.h" #pragma endregion #pragma region EFFECT #include "EffectParts.h" #include "Bombard.h" #include "TrailObject.h" #include "Instance_Model.h" #include "Trail.h" #pragma endregion #pragma region MAP #include "Terrain.h" #include "VIBuffer_Terrain.h" #include "BuildingContainer.h" #include "MapObject_Render.h" #include "MapObject_Collision.h" #pragma endregion CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : m_pDevice{ pDevice } , m_pContext{ pContext } , m_pGameInstance{ CGameInstance::GetInstance() } { SAFE_ADDREF(m_pGameInstance); SAFE_ADDREF(m_pDevice); SAFE_ADDREF(m_pContext); } unsigned int APIENTRY LoadingMain(void* pArg) { CLoader* pLoader = static_cast(pArg); if (FAILED(pLoader->Loading())) { assert(false); int a = 0; return 1; } return 0; } HRESULT CLoader::Initialize(LEVEL eNextLevelID) { m_eNextLevelID = eNextLevelID; m_pGameInstance->EnqueueJob(&LoadingMain, this); return S_OK; } HRESULT CLoader::Loading() { if (FAILED(CoInitializeEx(nullptr, 0))) { return E_FAIL; } HRESULT hr = {}; switch (m_eNextLevelID) { case LEVEL::LOGO: hr = Loading_For_Logo(); break; case LEVEL::GAMEPLAY: hr = Loading_For_GamePlay(); break; case LEVEL::FIELD: hr = Loading_For_Field(); break; case LEVEL::RESTART: hr = Loading_For_Restart(); break; default: break; } CoUninitialize(); if (FAILED(hr)){ return E_FAIL; } return S_OK; } void CLoader::Output() { SetWindowText(g_hWnd, m_strMessage.c_str()); } HRESULT CLoader::Loading_For_Logo() { m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); m_strMessage = TEXT("사운드를(을) 로딩 중 입니다."); m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Debug::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CLight_Main::Create(m_pDevice, m_pContext)))) { return E_FAIL; } m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; return S_OK; } HRESULT CLoader::Loading_For_GamePlay() { m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); #pragma region UI Asset_FileLoad("../Bin/Resources/Textures/Keyboard", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Action", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Cursor"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) { return E_FAIL; } Asset_FileLoad("../Bin/Resources/Textures/Mission", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Mission_Icon"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Mission/Mission_Icon_%d.png"), 2)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("ActiveMission_Icon"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Mission/ActiveMission_Icon_%d.png"), 2)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Megic_Metar"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Action/Megic_Meter%d.png"), 3)))) { return E_FAIL; } Asset_FileLoad("../Bin/Resources/Textures/MiniMap", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/HUD", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Loading", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Spells", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Spells/SpellMeters", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Potions", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/GadgetWheel", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Item"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/GadgetWheel/Item%d.png"), 8)))) { return E_FAIL; } #pragma endregion #pragma region TERRAIN_TEXTURE /* Terrain_Diffuse */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Terrain_Diffuse"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Terrain/Terrain_D_%d.dds"), 4)))) { return E_FAIL; } /* Terrain_Normal */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Terrain_Normal"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Terrain/Terrain_N_%d.dds"), 4)))) { return E_FAIL; } /* Terrain_MRO */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Terrain_MRO"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Textures/Terrain/Terrain_MRO_%d.dds"), 4)))) { return E_FAIL; } /* Terrain_AlphaMap */ if(FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("HogsmeadeAlphaMap"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Terrain/Hogsmeade_AlphaMap.dds"), 0)))) { return E_FAIL; } #pragma endregion Asset_FileLoad("../Bin/Resources/Textures/Effect/Noises", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Effect/Diffuse", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Effect/Flipbooks", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); Asset_FileLoad("../Bin/Resources/Textures/Effect/Gradients", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; } return S_OK; }); m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_MESH, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl"), VTXMESH::Elements, VTXMESH::iNumElements)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_ANIMMESH, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl"), VTXANIMMESH::Elements, VTXANIMMESH::iNumElements)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_POSTEX, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl"), VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_NORTEX, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl"), VTXNORTEX::Elements, VTXNORTEX::iNumElements)))) { return E_FAIL; } m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_UIEDITOR, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl"), VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_INSTANCE_MODEL, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl"), VTX_MODEL_INSTANCE_PARTICLE::Elements, VTX_MODEL_INSTANCE_PARTICLE::iNumElements)))) { return E_FAIL; } // Heavy Wall CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; { Desc.eType = ACTOR::BOX; Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; Desc.fContactOffset = { 0.05f }; Desc.vhalfGeometryInfo = { 2.5f, 4.5f, 3.5f }; Desc.fDensity = 10.f; Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { 100.f, 100.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { return E_FAIL; } 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.01f, 0.01f, 0.01f) * XMMatrixIdentity())))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Npc_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/Npc.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Wand_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Broom_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixIdentity())))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; /* 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.bin", XMMatrixIdentity())))) return E_FAIL; m_strMessage = TEXT("이펙트를(을) 로딩 중 입니다."); if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrail::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CEffectParts::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTrailObject::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(NEXT_LEVEL, CBombard::Create(m_pDevice, m_pContext)))) { return E_FAIL; } m_strMessage = TEXT("Model Loading.."); 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.bin", XMMatrixIdentity())))) return E_FAIL; Asset_FileLoad("../Bin/Resources/Models/Effect/ParticleMesh", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) { if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0)))) return E_FAIL; return S_OK; }); Asset_FileLoad("../Bin/Resources/Models/Effect/Goo", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) { if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0)))) return E_FAIL; return S_OK; }); Asset_FileLoad("../Bin/Resources/Models/Effect/NomalMesh", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) { if (FAILED(m_pGameInstance->Add_Asset_Prototype(NEXT_LEVEL, wstrFileName, CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0)))) return E_FAIL; return S_OK; }); #pragma region MAP_MODELS vector> jobFutures; _uint iLoadCount = 5; vector*> Contents(iLoadCount); { /* Terrain */ jobFutures.emplace_back(Deferred_FolderLoad( "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Collision/Terrain", ".bin", false, &Contents[jobFutures.size()] )); jobFutures.emplace_back(Deferred_FolderLoad( "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Terrain", ".bin", false, &Contents[jobFutures.size()] )); } { /* Ollivanders*/ jobFutures.emplace_back(Deferred_FolderLoad( "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Meshes", ".bin", false, &Contents[jobFutures.size()] )); jobFutures.emplace_back(Deferred_FolderLoad( "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Ollivanders/Collision", ".bin", false, &Contents[jobFutures.size()] )); } { /* Gatehouse*/ jobFutures.emplace_back(Deferred_FolderLoad( "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_Gatehouse/Meshes", ".bin", false, &Contents[jobFutures.size()] )); } for (auto& jobFuture : jobFutures) { jobFuture.get(); } for (_uint i = 0; i < Contents.size(); ++i) { for (_uint j = 0; j < (Contents[i])->size(); ++j) { FOLDER_LOAD* pContents = (*Contents[i])[j]; if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, pContents->pModelTag, pContents->pLoadedModel))) { return E_FAIL; } for (_uint k = 0; k < pContents->pRigidBodyTags.size(); ++k) { if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, pContents->pRigidBodyTags[k], pContents->LoadedRigidBody[k]))) { return E_FAIL; } } } } for (_uint i = 0; i < Contents.size(); ++i) { for (_uint j = 0; j < (Contents[i])->size(); ++j) { Safe_Delete((*Contents[i])[j]); } Safe_Delete(Contents[i]); } #pragma endregion m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); /* For.Prototype_GameObject_GamePlay_Canvas*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGamePlay_Canvas::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_Action_Panel*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CAction_Panel::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_Loading_Panel*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CLoading_Panel::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_Mission_Panel*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMission_Panel::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_MiniMap_TrimBorder*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMiniMap_TrimBorder::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_NoMountIcon*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CNoMountIcon::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_Minimap_Panel*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMiniMap_Panel::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_LoadingWidget*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CLoadingWidget::Create(m_pDevice, m_pContext)))) { return E_FAIL; } /* For.Prototype_GameObject_SkyBox */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSkyBox::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_Component_VIBuffer_Terrain */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "Hogsmeade_HeightMap.bin", 512, 512)))) return E_FAIL; /* For.Prototype_GameObject_Terrain */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CBuildingContainer */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBuildingContainer::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CMapObject_Render */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Render::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CMapObject_Collision */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Collision::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_Component_FSM */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CFSM::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Player */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPlayer::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Camera_Gaze */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Gaze::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CamPosition_Player */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Socket::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CamPosition_Shoulder */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Shoulder::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CamPosition_Target */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Target::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_CamPosition_Arm */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Arm::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Wand */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Broom */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Goblin */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin::Create(m_pDevice, m_pContext)))) return E_FAIL; if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXWall::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXPlayable::Create(m_pDevice, m_pContext)))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPhysXEffectHitBox::Create(m_pDevice, m_pContext)))) { return E_FAIL; } m_strMessage = TEXT("정보를 불러오는 중입니다."); m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; return S_OK; } HRESULT CLoader::Loading_For_Field() { m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); m_strMessage = TEXT("이펙트를(을) 로딩 중 입니다."); m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); m_strMessage = TEXT("정보를 불러오는 중입니다."); m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; return S_OK; } HRESULT CLoader::Loading_For_Restart() { m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); m_strMessage = TEXT("이펙트를(을) 로딩 중 입니다."); m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); m_strMessage = TEXT("정보를 불러오는 중입니다."); m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; return S_OK; } HRESULT CLoader::Asset_FileLoad(const _char* pDirectoryPath, const _tchar* pPreName, function AddPrototypeEvent) { for (const auto& file : filesystem::directory_iterator(pDirectoryPath)) { if (file.is_directory()) continue; string ext = file.path().extension().string(); if (!strcmp(ext.c_str(), ".txt") || !strcmp(ext.c_str(), ".fbx")){ continue; } _char szFilePath[MAX_PATH] = {}; strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); wstring wstrFileName = pPreName + file.path().stem().wstring(); AddPrototypeEvent(wstrFileName, szFilePath); } return S_OK; } void APIENTRY Deferred_FolderLoad_Main(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pDirectoryPath, const _char* pFileExt, _bool bUseTag, vector** OutContents) { if (FAILED(CoInitializeEx(nullptr, 0))) { return; } *OutContents = new vector; for (const auto& file : filesystem::directory_iterator(pDirectoryPath)) { if (file.is_directory()) { continue; } if (strcmp(file.path().extension().string().c_str(), pFileExt)) { continue; } FOLDER_LOAD* pContents = new FOLDER_LOAD; pContents->bLoadTags = bUseTag; { // FOLDER_LOAD _char szFilePath[MAX_PATH] = {}; strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str()); _wstring wstrFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); CModel* pModel = CModel::Create(pDevice, pContext, MODEL::ENVIROMENT, szFilePath); _uint iNumMesh = pModel->Get_NumMeshes(); { pContents->pModelTag = wstrFileName; pContents->pathModel = file.path(); pContents->pLoadedModel = pModel; pContents->pRigidBodyTags.reserve(iNumMesh); pContents->LoadedRigidBody.reserve(iNumMesh); } CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{}; for (_uint i = 0; i < iNumMesh; ++i) { { Desc.eType = ACTOR::TRIANGLEMESH; Desc.ePxRigidBodyFlags = {}; Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; Desc.ePxMaterialTypes = PXMATERIAL::DEFAULT; Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f); Desc.fContactOffset = 0.f; } pContents->pRigidBodyTags.emplace_back(CMyTools::ToWstring(pModel->Get_MeshName(i) + to_string(i)).c_str()); pContents->LoadedRigidBody.emplace_back(CRigidBody_Static::Create(pDevice, pContext, Desc)); } } (*OutContents)->emplace_back(pContents); } (*OutContents)->shrink_to_fit(); CoUninitialize(); return; } future CLoader::Deferred_FolderLoad(const _char* pDirectoryPath, const _char* pFileExt, _bool bUseTag, vector** OutContents) { return m_pGameInstance->EnqueueJob(&Deferred_FolderLoad_Main, m_pDevice, m_pContext, pDirectoryPath, pFileExt, bUseTag, OutContents); } pair<_wstring, CModel*>* APIENTRY Deferred_ModelLoad_Main(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const _char* pDirectoryPath, const _tchar* pPrototypeTag, _fmatrix PreTransform) { if (FAILED(CoInitializeEx(nullptr, 0))) { assert(false); return nullptr; } CModel* pModel = CModel::Create(pDevice, pContext, eType, pDirectoryPath, PreTransform); CoUninitialize(); pair<_wstring, CModel*>* Out = new pair<_wstring, CModel*>(pPrototypeTag, pModel); return Out; } future*> CLoader::Deferred_ModelLoad(MODEL eType, const _char* pDirectoryPath, _fmatrix PreTransform, const _tchar* pPrototypeTag) { return m_pGameInstance->EnqueueJob(&Deferred_ModelLoad_Main, m_pDevice, m_pContext, eType, pDirectoryPath, pPrototypeTag, PreTransform); } CLoader* CLoader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eNextLevelID) { CLoader* pInstance = new CLoader(pDevice, pContext); if (FAILED(pInstance->Initialize(eNextLevelID))) { MSG_BOX("Failed to Created : CLoader"); SAFE_RELEASE(pInstance); } return pInstance; } void CLoader::Free() { __super::Free(); SAFE_RELEASE(m_pGameInstance); SAFE_RELEASE(m_pDevice); SAFE_RELEASE(m_pContext); }