From a83842ed92dbe739713e6eef6e491efec2c147d0 Mon Sep 17 00:00:00 2001 From: JinhoBa <127280695+JinhoBa@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:29:55 +0900 Subject: [PATCH] [add] MapData Load and Save [add] MapContainerObject [add] MapPartObject NonLod and Lod --- .../Bin/Resources/Data/Map/ContainerTest.xml | 311 ++++++++ .../Editor/Bin/Resources/Data/Map/Test.xml | 320 ++++++++ .../Resources/ShaderFiles/Shader_VtxMesh.hlsl | 16 +- .../Editor/Default/Editor.vcxproj.filters | 30 + .../Editor/Private/BuildingContainer.cpp | 66 +- .../Editor/Private/Level_MapViewer.cpp | 4 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 29 +- .../Editor/Private/MapContainer.cpp | 62 ++ Jusin154_Team3D/Editor/Private/MapObject.cpp | 68 +- .../Editor/Private/MapObject_LOD.cpp | 37 +- .../Editor/Private/MapObject_Manager.cpp | 726 +++++++++++++++--- .../Editor/Private/MapObject_Static.cpp | 49 +- .../Editor/Public/BuildingContainer.h | 2 + Jusin154_Team3D/Editor/Public/Editor_Define.h | 2 +- Jusin154_Team3D/Editor/Public/MapContainer.h | 21 + Jusin154_Team3D/Editor/Public/MapObject.h | 5 + Jusin154_Team3D/Editor/Public/MapObject_LOD.h | 10 +- .../Editor/Public/MapObject_Manager.h | 15 +- .../Editor/Public/MapObject_Static.h | 5 +- .../Engine/Private/GameInstance.cpp | 2 +- Jusin154_Team3D/Engine/Private/Material.cpp | 4 +- 21 files changed, 1579 insertions(+), 205 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml new file mode 100644 index 000000000..245aedd90 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -0,0 +1,311 @@ + + + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_decals + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Dormer_Wood_Slats + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_walls + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_fireplace + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod1 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod2 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_L + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_DoorFrame + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod1 + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass + Prototype_GameObject_SM_HM_3Broom_Window_Glass_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod3 + + + + + + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Bar + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_floors + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_A + Prototype_GameObject_SM_HM_3Broom_int_stairs_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_B + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_D + Prototype_GameObject_SM_HM_3Broom_int_stairs_D_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows + Prototype_GameObject_SM_HM_3Broom_int_windows_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_C + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod2 + + + + + + Prototype_GameObject_SM_Broom_01 + Prototype_GameObject_SM_Broom_01_Lod1 + Prototype_GameObject_SM_Broom_01_Lod2 + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml new file mode 100644 index 000000000..114aea18a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Test.xml @@ -0,0 +1,320 @@ + + + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_decals + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_decals_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_chimneys_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_barrels_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign + Prototype_GameObject_SM_HM_3Broom_ext_barrels_sign_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A + Prototype_GameObject_SM_HM_3Broom_ext_Decals_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_DoorFrame + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod1 + Prototype_GameObject_SM_HM_3Broom_DoorFrame_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_Dormer_Wood_Slats + + + + + + Prototype_GameObject_SM_HM_3Broom_fireplace + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod1 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod2 + Prototype_GameObject_SM_HM_3Broom_fireplace_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_roof_copper_tops_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals + Prototype_GameObject_SM_HM_3Broom_ext_roof_decals_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_side_garden_box_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod2 + Prototype_GameObject_SM_HM_3Broom_ext_trim_stone_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_walls + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_ext_walls_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_R_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels + Prototype_GameObject_SM_HM_3Broom_ext_wood_Corbels_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_L + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod1 + Prototype_GameObject_SM_HM_3Broom_Door_L_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass + Prototype_GameObject_SM_HM_3Broom_Window_Glass_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Lod3 + + + + + + Prototype_GameObject_SM_DSkull + Prototype_GameObject_SM_DSkull_Lod1 + Prototype_GameObject_SM_DSkull_Lod2 + Prototype_GameObject_SM_DSkull_Lod3 + + + + + + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_A + Prototype_GameObject_SM_HM_3Broom_int_stairs_A_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Bar + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Bar_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_floors + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_B + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_stairs_B_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows + Prototype_GameObject_SM_HM_3Broom_int_windows_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_stairs_D + Prototype_GameObject_SM_HM_3Broom_int_stairs_D_Lod1 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors_Lod2 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_walls_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_B_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_C + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod2 + Prototype_GameObject_SM_HM_3Broom_int_wood_C_Lod3 + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod1 + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs_Lod2 + + + + + + Prototype_GameObject_SM_Broom_01 + Prototype_GameObject_SM_Broom_01_Lod1 + Prototype_GameObject_SM_Broom_01_Lod2 + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index a32c3c669..b2618d4ee 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -164,7 +164,7 @@ PS_OUT PS_MAIN(PS_IN In) PS_OUT Out; vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - if (vMtrlDiffuse.a < 0.4f) + if (vMtrlDiffuse.a < 0.1f) { discard; } @@ -180,7 +180,7 @@ PS_OUT PS_MAIN(PS_IN In) return Out; } -PS_OUT PS_MAIN_OUTLINE(PS_IN In) +PS_OUT PS_MAIN_SELECT(PS_IN In) { PS_OUT Out; @@ -195,7 +195,7 @@ PS_OUT PS_MAIN_OUTLINE(PS_IN In) float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); - Out.vDiffuse = vMtrlDiffuse; + Out.vDiffuse = vMtrlDiffuse * float4(0.f, 1.f, 1.f, 0.3f); 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; @@ -439,4 +439,14 @@ technique11 MeshTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_EFFECT_UVMOVE(); } + + pass MapToolPass // 11 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_SELECT(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 9239be701..73ced753d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -354,6 +354,21 @@ 02.GameObjects\Env\02.MapObject\LOD + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + @@ -523,6 +538,21 @@ 02.GameObjects\Env\02.MapObject\LOD + + 02.GameObjects\Env\01.MapContainer + + + 02.GameObjects\Env\01.MapContainer\BuildingContainer + + + 02.GameObjects\Env\02.MapObject + + + 02.GameObjects\Env\02.MapObject\Static + + + 02.GameObjects\Env\02.MapObject\LOD + diff --git a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp index 755750fc7..08a091a3e 100644 --- a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp @@ -1,6 +1,9 @@ #include "pch.h" #include "BuildingContainer.h" #include "PartObject.h" +#include "Terrain.h" +#include "Layer.h" +#include "VIBuffer_Terrain.h" CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CMapContainer(pDevice, pContext) @@ -15,6 +18,8 @@ CBuildingContainer::CBuildingContainer(const CBuildingContainer& rhs) void CBuildingContainer::Priority_Update(_float fTimeDelta) { __super::Priority_Update(fTimeDelta); + + m_bSelected = false; } void CBuildingContainer::Update(_float fTimeDelta) @@ -24,6 +29,13 @@ void CBuildingContainer::Update(_float fTimeDelta) void CBuildingContainer::Late_Update(_float fTimeDelta) { + if (m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } + __super::Late_Update(fTimeDelta); } @@ -43,10 +55,22 @@ HRESULT CBuildingContainer::Initialize(void* pArg) return E_FAIL; } - if (FAILED(__super::Ready_Components(pArg))) { + if (FAILED(Ready_Components(pArg))) { return E_FAIL; } + MAP_CONTAINER_DESC* pDesc = static_cast(pArg); + + m_strName = pDesc->strName; + + m_vPosition = pDesc->vPosition; + m_vScale = pDesc->vScale; + m_vRotation = pDesc->vRotation; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + return S_OK; } @@ -97,4 +121,44 @@ void CBuildingContainer::Free() void CBuildingContainer::Describe_Entity() { + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Text(m_strName.c_str()); + GUI::Text("----- Transfrom ----"); + GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + + if (GUI::Button("Delete")) + m_bDead = true; + + m_bSelected = true; } diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index 6b52cdbb3..9c53bbcad 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -95,8 +95,8 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) HRESULT CLevel_MapViewer::Ready_Layer_BuildingContainer(const _wstring& strLayerTag) { - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) - return E_FAIL; + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + // return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index dbf95ca29..f6c12a3e8 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -661,15 +661,13 @@ HRESULT CLoader::Loading_For_MapViewer() vector<_wstring> ModelPrototypeTags; 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(), ".fbx")) - + if (strcmp(ext.c_str(), ".bin")) continue; _char szFilePath[MAX_PATH] = {}; @@ -680,12 +678,35 @@ HRESULT CLoader::Loading_For_MapViewer() /*For Prototype_Component_Model_*/ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, - CModel::Create(m_pDevice, m_pContext,szFilePath, MODEL::ENVIROMENT, XMMatrixIdentity(), 0)))) + CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath)))) return E_FAIL; ModelPrototypeTags.push_back(strFileName); } + 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("ì‰�ì�´ë�”를(ì�„) 로딩 중 입니다."); diff --git a/Jusin154_Team3D/Editor/Private/MapContainer.cpp b/Jusin154_Team3D/Editor/Private/MapContainer.cpp index d195c2192..cfa35c6e8 100644 --- a/Jusin154_Team3D/Editor/Private/MapContainer.cpp +++ b/Jusin154_Team3D/Editor/Private/MapContainer.cpp @@ -2,6 +2,9 @@ #include "MapContainer.h" #include "PartObject.h" +#include "MapObject_LOD.h" +#include "MapObject_Static.h" + CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CContainerObject(pDevice, pContext) { @@ -22,6 +25,7 @@ HRESULT CMapContainer::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) { return E_FAIL; } + return S_OK; } @@ -54,6 +58,64 @@ HRESULT CMapContainer::Render() return S_OK; } +HRESULT CMapContainer::Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container) +{ + for (auto& piar : m_PartObjects) + { + CMapObject* pMapObject = dynamic_cast(piar.second); + + if (nullptr == pMapObject) + return E_FAIL; + + // + tinyxml2::XMLElement* PartObject = Doc.NewElement("PartObject"); + PartObject->SetAttribute("Lod_Level", pMapObject->Get_LodLevel()); + Container->InsertEndChild(PartObject); + + for (_uint i = 0; i < pMapObject->Get_LodLevel() + 1; ++i) + { + // ÅØ½ºÆ® + tinyxml2::XMLElement* proto = Doc.NewElement("PrototypeTag"); + proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag(i)).c_str()); + PartObject->InsertEndChild(proto); + } + + // + tinyxml2::XMLElement* PositionElem = Doc.NewElement("Position"); + + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pMapObject->Get_Component()->Get_State(STATE::POSITION)); + + PositionElem->SetAttribute("x", vPosition.x); + PositionElem->SetAttribute("y", vPosition.y); + PositionElem->SetAttribute("z", vPosition.z); + PartObject->InsertEndChild(PositionElem); + + // + tinyxml2::XMLElement* ScaleElem = Doc.NewElement("Scale"); + + _float3 pScale = pMapObject->Get_Component()->Get_Scale(); + ScaleElem->SetAttribute("x", pScale.x); + ScaleElem->SetAttribute("y", pScale.y); + ScaleElem->SetAttribute("z", pScale.z); + PartObject->InsertEndChild(ScaleElem); + + // + tinyxml2::XMLElement* RotationElem = Doc.NewElement("Rotation"); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); + + RotationElem->SetAttribute("x", vRotation.x); + RotationElem->SetAttribute("y", vRotation.y); + RotationElem->SetAttribute("z", vRotation.z); + PartObject->InsertEndChild(RotationElem); + + } + + return S_OK; +} + void CMapContainer::Free() { __super::Free(); diff --git a/Jusin154_Team3D/Editor/Private/MapObject.cpp b/Jusin154_Team3D/Editor/Private/MapObject.cpp index 1385f0f6c..1f8c74daf 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject.cpp @@ -49,30 +49,6 @@ void CMapObject::Late_Update(_float fTimeDelta) HRESULT CMapObject::Render() { - if (FAILED(Bind_ShaderResources())) { - return E_FAIL; - } - - //_uint iNumMeshes = m_pModelCom->Get_NumMeshes(); - - //for (_uint i = 0; i < iNumMeshes; i++) - //{ - // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { - // return E_FAIL; - // } - // if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { - // return E_FAIL; - // } - - // if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - // return E_FAIL; - // } - - // if (FAILED(m_pModelCom->Render(i))) { - // return E_FAIL; - // } - //} - return S_OK; } @@ -91,9 +67,6 @@ HRESULT CMapObject::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; - if (FAILED(Ready_Components())) - return E_FAIL; - #ifdef _DEBUG m_bSelected = false; m_vPosition = _float3(0.f, 0.f, 0.f); @@ -104,6 +77,32 @@ HRESULT CMapObject::Initialize(void* pArg) return S_OK; } +_wstring CMapObject::Get_PrototypeTag(_uint iLodIndex) +{ + return _wstring(); +} + + return S_OK; +} + +HRESULT CMapObject::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + +#ifdef _DEBUG + m_bSelected = false; + m_vPosition = _float3(0.f, 0.f, 0.f); + m_vRotation = _float3(0.f, 0.f, 0.f); + m_vScale = _float3(1.f, 1.f, 1.f); +#endif // _DEBUG + + //if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + // return E_FAIL; + //} HRESULT CMapObject::Ready_Components() { __super::Ready_Components(nullptr); @@ -116,6 +115,21 @@ HRESULT CMapObject::Bind_ShaderResources() return S_OK; } + return pInstance; +} + +CGameObject* CMapObject::Clone(void* pArg, CGameObject* pOwner) +{ + CMapObject* pInstance = new CMapObject(*this); + + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject"); + Safe_Release(pInstance); + } + + return pInstance; +} void CMapObject::Free() { diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp index f872a7bb9..34ca2a9f7 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -41,9 +41,13 @@ HRESULT CMapObject_LOD::Initialize(void* pArg) #ifdef _DEBUG m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); + m_vPosition = pDesc->vPosition; + m_vScale = pDesc->vScale; + m_vRotation = pDesc->vRotation; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); #endif // _DEBUG return S_OK; @@ -72,8 +76,11 @@ void CMapObject_LOD::Late_Update(_float fTimeDelta) } #endif + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + _float4 vPos; - XMStoreFloat4(&vPos, Get_WorldPostion()); + //XMStoreFloat4(&vPos, Get_WorldPostion()); + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); } @@ -83,7 +90,7 @@ HRESULT CMapObject_LOD::Render() return E_FAIL; } - _uint iNumMeshes = m_pModelComs[0]->Get_NumMeshes(); + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); for (_uint i = 0; i < iNumMeshes; i++) { @@ -93,10 +100,19 @@ HRESULT CMapObject_LOD::Render() if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { return E_FAIL; } - - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; + if (m_bSelected) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } } + else + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } + } + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { return E_FAIL; @@ -122,6 +138,8 @@ HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag) reinterpret_cast(&pModel)))) return E_FAIL; + m_ModelPrototypeTags.push_back(pModelPrototypeTag); + ++m_iMaxLodLevel; m_pModelComs.push_back(pModel); @@ -154,9 +172,10 @@ HRESULT CMapObject_LOD::Ready_Components() HRESULT CMapObject_LOD::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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; } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 19ac803a6..03f1e3c63 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -43,27 +43,45 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; - m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); + if (FAILED(Ready_Components())) + return E_FAIL; - SAFE_ADDREF(m_pContainer); + m_iContainerObjectIndex = 99; + //m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); return S_OK; } void CMapObject_Manager::Priority_Update(_float fTimeDelta) { - + for (auto* pObject : m_MapObjects) + { + pObject->Priority_Update(fTimeDelta); + } } void CMapObject_Manager::Update(_float fTimeDelta) { GUI::Begin("File"); - - if (GUI::Button("Save_XML")) + if (GUI::Button("Save_Map")) { Save_MapData("Test"); + + } + if (GUI::Button("Load_Map")) + { + Load_MapData("Test"); + + } + GUI::InputText("Containter Name", m_szSaveContainerName, MAX_PATH); + if (GUI::Button("Save_Container")) + { + Save_ContainerData("ContainerTest", m_szSaveContainerName); + } + if (GUI::Button("Load_Container")) + { + Load_ContainerData("ContainerTest", m_szSaveContainerName); } - GUI::End(); Update_PrototypeList(); @@ -72,11 +90,31 @@ void CMapObject_Manager::Update(_float fTimeDelta) Update_Edit(); + Update_ContainerObject(); + + for (auto* pObject : m_MapObjects) + { + pObject->Update(fTimeDelta); + } } void CMapObject_Manager::Late_Update(_float fTimeDelta) { - + auto iter = m_MapObjects.begin(); + for (; iter != m_MapObjects.end();) + { + if ((*iter)->isDead()) + { + SAFE_RELEASE(*iter); + iter = m_MapObjects.erase(iter); + } + else + { + (*iter)->Late_Update(fTimeDelta); + ++iter; + } + + } } HRESULT CMapObject_Manager::Render() @@ -86,6 +124,8 @@ HRESULT CMapObject_Manager::Render() HRESULT CMapObject_Manager::Ready_Components() { + __super::Ready_Components(nullptr); + return S_OK; } @@ -96,72 +136,224 @@ HRESULT CMapObject_Manager::Bind_ShaderResources() HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) { - //const list* pObjectList = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"))->Get_Objects(); + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; - //if (nullptr == pObjectList) - // return E_FAIL; + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); - //tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* land = {}; + tinyxml2::XMLElement* container = {}; - //doc.InsertFirstChild(doc.NewDeclaration()); + if (loadResult != tinyxml2::XML_SUCCESS) + { + doc.InsertFirstChild(doc.NewDeclaration()); - //tinyxml2::XMLElement* land = doc.NewElement("Land"); - //doc.InsertEndChild(land); + land = doc.NewElement("Land"); + doc.InsertEndChild(land); - //for (auto& pObjcet : *pObjectList) - //{ - // CMapObject* pMapObject = dynamic_cast(pObjcet); + } + else + { + land = doc.FirstChildElement("Land"); + } - // if (nullptr == pMapObject) - // continue; + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); - // // - // tinyxml2::XMLElement* model = doc.NewElement("Model"); - // land->InsertEndChild(model); + if (nullptr == pLayer) + return E_FAIL; + + const list* pList = pLayer->Get_Objects(); - // // ÅØ½ºÆ® - // tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); - // proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag()).c_str()); - // model->InsertEndChild(proto); - // // - // tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); + for (auto pGamObject : *pList) + { + CBuildingContainer* pContainerObject = dynamic_cast(pGamObject); - // _float3 vPosition = {}; - // XMStoreFloat3(&vPosition, pMapObject->Get_WorldPostion()); - // - // PositionElem->SetAttribute("x", vPosition.x); - // PositionElem->SetAttribute("y", vPosition.y); - // PositionElem->SetAttribute("z", vPosition.z); - // model->InsertEndChild(PositionElem); + if (nullptr == pContainerObject) + return E_FAIL; - // // - // tinyxml2::XMLElement* ScaleElem = doc.NewElement("Scale"); + string strName = pContainerObject->Get_Name(); - // _float3 pScale = pMapObject->Get_Component()->Get_Scale(); - // ScaleElem->SetAttribute("x", pScale.x); - // ScaleElem->SetAttribute("y", pScale.y); - // ScaleElem->SetAttribute("z", pScale.z); - // model->InsertEndChild(ScaleElem); + tinyxml2::XMLElement* container = doc.NewElement("Container"); + container->SetAttribute("Name", strName.c_str()); + land->InsertEndChild(container); - // // - // tinyxml2::XMLElement* RotationElem = doc.NewElement("Rotation"); + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pGamObject->Get_Component()->Get_State(STATE::POSITION)); - // _float3 vRotation = {}; - // XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); - // - // RotationElem->SetAttribute("x", vRotation.x); - // RotationElem->SetAttribute("y", vRotation.y); - // RotationElem->SetAttribute("z", vRotation.z); - // model->InsertEndChild(RotationElem); + _float3 vScale = pGamObject->Get_Component()->Get_Scale(); - //} - //string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pGamObject->Get_Component()->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); - //// ÀúÀå - //if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { - // return E_FAIL; - //} + +#pragma region CONTAINER_TRANSFORM + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + container->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + container->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + container->InsertEndChild(Rotation); +#pragma endregion + + + +#pragma region SAVE_PARTOBJECT + + if (FAILED(pContainerObject->Save_PartObjects(doc, container))) + return E_FAIL; + } +#pragma endregion + + // ÀúÀå + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + else + { + MSG_BOX("Succeed to Save File"); + } + + return S_OK; + + + + + return S_OK; +} + +HRESULT CMapObject_Manager::Save_ContainerData(const _char* pFileName, const _char* pContainerName) +{ + if (true == m_MapObjects.empty()) + return E_FAIL; + + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + tinyxml2::XMLElement* land = {}; + tinyxml2::XMLElement* container = {}; + + if (loadResult != tinyxml2::XML_SUCCESS) + { + doc.InsertFirstChild(doc.NewDeclaration()); + + land = doc.NewElement("Land"); + doc.InsertEndChild(land); + + container = doc.NewElement("Container"); + container->SetAttribute("Name", pContainerName); + land->InsertEndChild(container); + } + else + { + land = doc.FirstChildElement("Land"); + container = doc.NewElement("Container"); + container->SetAttribute("Name", pContainerName); + land->InsertEndChild(container); + } + +#pragma region CONTAINER_DEFAULT_TRANSFORM + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", 0.f); + Position->SetAttribute("y", 0.f); + Position->SetAttribute("z", 0.f); + container->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", 1.f); + Scale->SetAttribute("y", 1.f); + Scale->SetAttribute("z", 1.f); + container->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", 0.f); + Rotation->SetAttribute("y", 0.f); + Rotation->SetAttribute("z", 0.f); + container->InsertEndChild(Rotation); +#pragma endregion + +#pragma region SAVE_PARTOBJECT + for (auto& pMapObject : m_MapObjects) + { + // + tinyxml2::XMLElement* PartObject = doc.NewElement("PartObject"); + PartObject->SetAttribute("Lod_Level", pMapObject->Get_LodLevel()); + container->InsertEndChild(PartObject); + + for (_uint i = 0; i < pMapObject->Get_LodLevel() + 1; ++i) + { + // ÅØ½ºÆ® + tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); + proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag(i)).c_str()); + PartObject->InsertEndChild(proto); + } + + //m_pMapObjects = pLayer->Get_Objects(); + + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pMapObject->Get_Component()->Get_State(STATE::POSITION)); + + PositionElem->SetAttribute("x", vPosition.x); + PositionElem->SetAttribute("y", vPosition.y); + PositionElem->SetAttribute("z", vPosition.z); + PartObject->InsertEndChild(PositionElem); + + if (false == m_MapObjects.empty()) + { + for (auto pMapObject : m_MapObjects) + { + CMapObject* pCurrentMapObject = static_cast(pMapObject); + + _float3 pScale = pMapObject->Get_Component()->Get_Scale(); + ScaleElem->SetAttribute("x", pScale.x); + ScaleElem->SetAttribute("y", pScale.y); + ScaleElem->SetAttribute("z", pScale.z); + PartObject->InsertEndChild(ScaleElem); + + wstring strPrototypeTag = pCurrentMapObject->Get_PrototypeTag(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pMapObject->Get_Component()->Get_RollPitchYawVector()); + + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + RotationElem->SetAttribute("x", vRotation.x); + RotationElem->SetAttribute("y", vRotation.y); + RotationElem->SetAttribute("z", vRotation.z); + PartObject->InsertEndChild(RotationElem); + + SAFE_RELEASE(pMapObject); + } + m_MapObjects.clear(); + m_pSelectObject = nullptr; +#pragma endregion + + // ÀúÀå + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + else + { + MSG_BOX("Succeed to Save File"); + } return S_OK; } @@ -180,51 +372,277 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) if (nullptr == root) { MSG_BOX("Failed to Find root"); - return E_FAIL; + return S_OK; } - ///* Map */ - //MAP_DATA Map_Data = {}; + /* Container */ + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; - //for (auto* land = root->FirstChildElement("Model"); land; land = land->NextSiblingElement("Model")) - //{ - // tinyxml2::XMLElement* protoElem = land->FirstChildElement("PrototypeTag"); + Container->QueryStringAttribute("Name", &pName); +#pragma region ADD_CONTAINER_OBJECT - // const _char* pPrototypeTag = protoElem->GetText(); + CBuildingContainer* pContainerObject = { nullptr }; + CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; - // if (nullptr != pPrototypeTag) - // { - // string strPtotoypeTag = pPrototypeTag; - // Map_Data.strPrototypeTag = CMyTools::ToWstring(strPtotoypeTag); - // } - // else - // { - // Map_Data.strPrototypeTag = L""; - // } + auto* ContainerPosition = Container->FirstChildElement("Position"); + ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); + ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); + ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); - // protoElem = land->FirstChildElement("Position"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vPosition.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vPosition.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vPosition.z); + auto* ContainerScale = Container->FirstChildElement("Scale"); + ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); + ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); + ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); - // protoElem = land->FirstChildElement("Scale"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vScale.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vScale.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vScale.z); + auto* ContainerRotation = Container->FirstChildElement("Rotation"); + ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); + ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); + ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); - // protoElem = land->FirstChildElement("Rotation"); - // if (nullptr == protoElem) - // return E_FAIL; - // protoElem->QueryFloatAttribute("x", &Map_Data.vRotation.x); - // protoElem->QueryFloatAttribute("y", &Map_Data.vRotation.y); - // protoElem->QueryFloatAttribute("z", &Map_Data.vRotation.z); + ContainerDesc.strName = string(pName); + + m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); +#pragma endregion + +#pragma region ADD_PARTOBJECT + for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) + { + _uint iLodLevel = {}; + + PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel); + +#pragma region MAPOBJECT_STATIC + if (0 == iLodLevel) /* MapObject_Static */ + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + string strTag = {}; + auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); + + strTag = PrototypeTag->GetText(); + + Desc.strModelPrototypeTag = CMyTools::ToWstring(strTag); + + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + +#pragma region MAPOBJECT_LOD + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + string strTag = {}; + for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + + } +#pragma endregion + + } + + return S_OK; +} + +HRESULT CMapObject_Manager::Load_ContainerData(const _char* pFileName, const _char* pContainerName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Land"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + tinyxml2::XMLElement* TargetContainer = { nullptr }; + + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; + + Container->QueryStringAttribute("Name", &pName); + + if (!strcmp(pContainerName, pName)) + { + TargetContainer = Container; + break; + } + } + + /* Failed to find Container */ + if (nullptr == TargetContainer) + { + xmlDoc.Clear(); + MSG_BOX("Failed to find Container"); + return S_OK; + } +#pragma region ADD_CONTAINER_OBJECT + + CBuildingContainer* pContainerObject = { nullptr }; + CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; + + auto* ContainerPosition = TargetContainer->FirstChildElement("Position"); + ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); + ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); + ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); + + auto* ContainerScale = TargetContainer->FirstChildElement("Scale"); + ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); + ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); + ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); + + auto* ContainerRotation = TargetContainer->FirstChildElement("Rotation"); + ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); + ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); + ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); + + ContainerDesc.strName = string(pContainerName); + + m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, reinterpret_cast(&pContainerObject)); +#pragma endregion + +#pragma region ADD_PARTOBJECT + for (auto* PartObject = TargetContainer->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) + { + _uint iLodLevel = {}; + + PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel); + +#pragma region MAPOBJECT_STATIC + if (0 == iLodLevel) /* MapObject_Static */ + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + string strTag = {}; + auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); + + strTag = PrototypeTag->GetText(); + + Desc.strModelPrototypeTag = CMyTools::ToWstring(strTag); + Desc.iMaxLodLevel = iLodLevel; + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + +#pragma region MAPOBJECT_LOD + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + string strTag = {}; + for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + Desc.iMaxLodLevel = iLodLevel; + Desc.pParentTransform = pContainerObject->Get_Component(); + const string strKey = strTag; + + /* Position */ + tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + /* Scale */ + tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + /* Rotation */ + tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc); + } +#pragma endregion + + } +#pragma endregion - // m_MapDatas.push_back(Map_Data); - //} return S_OK; } @@ -232,7 +650,6 @@ HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) void CMapObject_Manager::Update_PrototypeList() { GUI::Begin("Model Prototype List"); - GUI::Checkbox("bLOD", &m_bLOD); for (auto& Tag : m_ModelPrototypeTags) { if (_wstring::npos != Tag.find(L"Lod")) @@ -240,16 +657,25 @@ void CMapObject_Manager::Update_PrototypeList() if (ImGui::Button(CMyTools::ToString(Tag).c_str())) { - if(false == m_bLOD) + _uint iNumLodModel = {}; + + if(false == Find_Lod_Prototype(Tag, &iNumLodModel)) { CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; - Desc.pModelPrototypeTag = Tag.c_str(); - Desc.pParentTransform = m_pContainer->Get_Component(); + 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); CMapObject_Static* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); - m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + /* if(FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + break;*/ m_MapObjects.push_back(pMapObject); } @@ -257,45 +683,34 @@ void CMapObject_Manager::Update_PrototypeList() { CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; - vector PrototypeTags; + vector<_wstring> PrototypeTags; - PrototypeTags.push_back(Tag.c_str()); + PrototypeTags.push_back(Tag); Desc.iMaxLodLevel = 0; Desc.ModelPrototypeTags = PrototypeTags; - Desc.pParentTransform = m_pContainer->Get_Component(); + 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); - CMapObject_Static* pMapObject = { nullptr }; + CMapObject_LOD* pMapObject = { nullptr }; const string strKey = CMyTools::ToString(Tag); - m_pContainer->Add_Part(strKey, 0, nullptr, &Desc); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + //if (FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + // break; m_MapObjects.push_back(pMapObject); - } - } - } - GUI::End(); - - GUI::Begin("LOD Model Prototype List"); - for (auto& Tag : m_LODModelPrototypeTags) - { - if (ImGui::Button(CMyTools::ToString(Tag).c_str())) - { - if (nullptr != m_pSelectObject) - { - CMapObject_LOD* pLodObject = dynamic_cast(m_pSelectObject); - - if (nullptr != pLodObject) + for (_uint i = 0; i < iNumLodModel; ++i) { - pLodObject->Add_LodModel(Tag.c_str()); - } - else - { - MSG_BOX("Failed to Add Lod Model"); - } - - if (m_pSelectObject->isDead()) - m_pSelectObject = nullptr; + _wstring strLodTag = Tag + L"_Lod" + to_wstring(i + 1); + pMapObject->Add_LodModel(strLodTag.c_str()); + } + + } } } @@ -355,6 +770,58 @@ void CMapObject_Manager::Update_Edit() GUI::End(); } +void CMapObject_Manager::Update_ContainerObject() +{ + GUI::Begin("Edit Container"); + + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); + + if (nullptr == pLayer) + { + GUI::End(); + return; + } + const list* pList = pLayer->Get_Objects(); + + _uint iIndex = {}; + + if (false == (*pList).empty()) + { + CGameObject* pSelectObject = { nullptr }; + + for (auto& pObject : (*pList)) + { + if (GUI::Button((dynamic_cast(pObject)->Get_Name().c_str()))) + { + m_iContainerObjectIndex = iIndex; + } + + if (iIndex == m_iContainerObjectIndex) + pSelectObject = pObject; + + ++iIndex; + } + + if (nullptr != pSelectObject) + pSelectObject->Describe_Entity(); + } + + GUI::End(); +} + +_bool CMapObject_Manager::Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount) +{ + for (auto& Tag : m_LODModelPrototypeTags) + { + if (_wstring::npos != Tag.find(strPrototypeTag)) + (*iCount)++; + } + if (0 < *iCount) + return true; + + return false; +} + CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags) { @@ -386,6 +853,11 @@ void CMapObject_Manager::Free() { __super::Free(); + for (auto& pObject : m_MapObjects) + { + SAFE_RELEASE(pObject); + } + SAFE_RELEASE(m_pContainer); } diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp index b3a82059b..9872827b3 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp @@ -40,8 +40,10 @@ void CMapObject_Static::Late_Update(_float fTimeDelta) } #endif + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + _float4 vPos; - XMStoreFloat4(&vPos, Get_WorldPostion()); + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); } @@ -62,8 +64,17 @@ HRESULT CMapObject_Static::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { - return E_FAIL; + if (m_bSelected) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } + } + else + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } } if (FAILED(m_pModelCom->Render(i))) { @@ -81,9 +92,11 @@ HRESULT CMapObject_Static::Initialize_Prototype() HRESULT CMapObject_Static::Initialize(void* pArg) { + m_iMaxLodLevel = 0; + MAPOBJECT_STATIC_DESC* pDesc = static_cast(pArg); - m_strModelPrototypeTag = pDesc->pModelPrototypeTag; + m_strModelPrototypeTag = pDesc->strModelPrototypeTag; if (FAILED(__super::Initialize(pArg))) return E_FAIL; @@ -94,9 +107,13 @@ HRESULT CMapObject_Static::Initialize(void* pArg) #ifdef _DEBUG m_bSelected = false; - m_vPosition = _float3(0.f, 0.f, 0.f); - m_vRotation = _float3(0.f, 0.f, 0.f); - m_vScale = _float3(1.f, 1.f, 1.f); + m_vPosition = pDesc->vPosition; + m_vScale = pDesc->vScale; + m_vRotation = pDesc->vRotation; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); #endif // _DEBUG return S_OK; @@ -126,7 +143,7 @@ HRESULT CMapObject_Static::Ready_Components() HRESULT CMapObject_Static::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + 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)))) { @@ -139,21 +156,7 @@ HRESULT CMapObject_Static::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { return E_FAIL; } - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_bRimLight", &m_bRimLight, sizeof(_bool)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fRimLightStrength, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { - // return E_FAIL; - //} - //if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float3)))) { - // return E_FAIL; - //} + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Public/BuildingContainer.h b/Jusin154_Team3D/Editor/Public/BuildingContainer.h index bf4694f2d..3dcd25980 100644 --- a/Jusin154_Team3D/Editor/Public/BuildingContainer.h +++ b/Jusin154_Team3D/Editor/Public/BuildingContainer.h @@ -7,6 +7,8 @@ NS_BEGIN(Editor) class CBuildingContainer final : public CMapContainer { + + public: CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CBuildingContainer(const CBuildingContainer& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index f8b31c8d5..90d479c48 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -16,7 +16,7 @@ namespace Editor enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, END }; enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, END }; - enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, END }; + enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL ,END }; enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, END }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END }; diff --git a/Jusin154_Team3D/Editor/Public/MapContainer.h b/Jusin154_Team3D/Editor/Public/MapContainer.h index e5edb84ab..57095b7d3 100644 --- a/Jusin154_Team3D/Editor/Public/MapContainer.h +++ b/Jusin154_Team3D/Editor/Public/MapContainer.h @@ -7,6 +7,14 @@ NS_BEGIN(Editor) class CMapContainer abstract : public CContainerObject { +public: + typedef struct tagMapContainerDesc + { + _string strName; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; + }MAP_CONTAINER_DESC; public: CMapContainer(ID3D11Device * pDevice, ID3D11DeviceContext * pContext); CMapContainer(const CMapContainer& rhs); @@ -17,11 +25,24 @@ class CMapContainer abstract : public CContainerObject virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + virtual _string& Get_Name() { return m_strName; } + virtual HRESULT Save_PartObjects(tinyxml2::XMLDocument& Doc, tinyxml2::XMLElement* Container); + protected: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; virtual HRESULT Ready_Components(void* pArg) override; +protected: + _string m_strName = {}; + _bool m_bSelected = {}; + + _uint m_iMaxLodLevel = {}; + + _float3 m_vPosition = {}; + _float3 m_vRotation = {}; + _float3 m_vScale = {}; + public: virtual void Free() override; }; diff --git a/Jusin154_Team3D/Editor/Public/MapObject.h b/Jusin154_Team3D/Editor/Public/MapObject.h index cb9af64cf..cd10f0da4 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject.h +++ b/Jusin154_Team3D/Editor/Public/MapObject.h @@ -25,6 +25,7 @@ class CMapObject abstract : public CPartObject public: virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + virtual _uint Get_LodLevel() { return m_iMaxLodLevel; } protected: @@ -35,7 +36,11 @@ class CMapObject abstract : public CPartObject HRESULT Ready_Components(); #ifdef _DEBUG +protected: _bool m_bSelected = {}; + + _uint m_iMaxLodLevel = {}; + _float3 m_vPosition = {}; _float3 m_vRotation = {}; _float3 m_vScale = {}; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h index 81a98cfb8..81d3d4b03 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -11,7 +11,10 @@ class CMapObject_LOD final : public CMapObject typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC { _uint iMaxLodLevel{}; - vector ModelPrototypeTags; + vector<_wstring> ModelPrototypeTags; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; }MAPOBJECT_LOD_DESC; private: @@ -38,8 +41,13 @@ class CMapObject_LOD final : public CMapObject _uint m_iMaxLodLevel = {}; _uint m_iLodIndex = {}; + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs; vector<_wstring> m_ModelPrototypeTags; + + + private: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index 7f2be7252..bc8bc4451 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -27,22 +27,31 @@ class CMapObject_Manager final : public CGameObject private: class CMapObject* m_pSelectObject = { nullptr }; - list m_MapObjects = { nullptr }; + list m_MapObjects = {}; vector<_wstring> m_ModelPrototypeTags; vector<_wstring> m_LODModelPrototypeTags; - _bool m_bLOD = { false }; - class CBuildingContainer* m_pContainer = { nullptr }; + _uint m_iContainerObjectIndex = {}; + class CBuildingContainer* m_pContainer = { nullptr }; + _char m_szSaveContainerName[MAX_PATH] = {}; private: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); + +#pragma region SAVE_LOAD HRESULT Save_MapData(const _char* pFileName); + HRESULT Save_ContainerData(const _char* pFileName, const _char* pContainerName); HRESULT Load_MapData(const _char* pFileName); + HRESULT Load_ContainerData(const _char* pFileName, const _char* pContainerName); +#pragma endregion void Update_PrototypeList(); void Update_ObjectList(); void Update_Edit(); + void Update_ContainerObject(); + + _bool Find_Lod_Prototype(_wstring strPrototypeTag, _uint* iCount); public: static CMapObject_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, vector<_wstring>& ModelPrototypeTags); diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Static.h b/Jusin154_Team3D/Editor/Public/MapObject_Static.h index 6fe460bc7..c2c32d05d 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Static.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Static.h @@ -11,7 +11,10 @@ class CMapObject_Static final : public CMapObject typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC { _uint iMaxLodLevel{}; - const _tchar* pModelPrototypeTag; + _wstring strModelPrototypeTag; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; }MAPOBJECT_STATIC_DESC; private: diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 1070a60d9..2ccf4fe07 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -104,7 +104,7 @@ void CGameInstance::Update_Engine(_float fTimeDelta) m_pMouse_Manager->Update(); //m_pSound_Manager->Update(); - m_pPicking->Update(); + //m_pPicking->Update(); m_pObject_Manager->Priority_Update(fTimeDelta); diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 7ad016816..6971c8a06 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -464,8 +464,8 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _ _splitpath_s(pModelFilePath, szDrive, MAX_PATH, szDir, MAX_PATH, nullptr, 0, nullptr, 0); char szFullPath[MAX_PATH] = {}; - strcpy_s(szFullPath, szDrive); - strcat_s(szFullPath, path.c_str()); + //(szFullPath, szDrive); + strcpy_s(szFullPath, path.c_str()); _tchar szPerfectPath[MAX_PATH] = {}; MultiByteToWideChar(CP_ACP, 0, szFullPath, -1, szPerfectPath, MAX_PATH);