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..e8082d594 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -0,0 +1,340 @@ + + + + + + + + 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 + + + + + + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrel_stands + + + + + + Prototype_GameObject_SM_HM_3Broom_ext_barrels + + + + + + Prototype_GameObject_SM_HM_3Broom_Door_R + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml new file mode 100644 index 000000000..98d8b1513 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/MapTest.xml @@ -0,0 +1,123 @@ + + + + Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Entry_Base_Stones.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Side_Stone_Steps.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Icicles.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Snow.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Decal.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Decal.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Roof_Snow_Winter.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Window_Glass.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Wood_Steps_B.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_Wood_Steps_C.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_A.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_B.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_windows.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_walls.mo + + + + + + Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors.mo + + + + + 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 b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index ab2d009b2..2fa1ba95d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -153,6 +153,7 @@ + @@ -163,8 +164,11 @@ + + + @@ -210,6 +214,7 @@ + @@ -220,8 +225,11 @@ + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 5d5cb53ea..73ced753d 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -145,9 +145,6 @@ {44a3ddc2-3993-48d6-840c-3da09daeab70} - - {584466e9-fe1a-4a7d-a4ba-54d62ee1a7c1} - {943a760b-2861-45b7-87b8-462e1309c172} @@ -166,6 +163,24 @@ {15a9dfe7-f3f7-4906-8bd4-91734f4ddc92} + + {584466e9-fe1a-4a7d-a4ba-54d62ee1a7c1} + + + {d925c13c-6d66-4632-8bef-172baa566920} + + + {9643531b-3b64-4a3b-9ba7-e372b4e4ddba} + + + {702dfe26-f6b0-4aa0-b8d5-79385c0191d1} + + + {bc80fcba-1ebd-497c-a40d-973e44ad3ef8} + + + {34fa4d78-8091-44cf-b4b4-59db9fd56d98} + @@ -303,14 +318,11 @@ 01.Level\30.MapViewer - - 02.GameObjects\Env - 02.GameObjects\Terrain - 02.GameObjects\Env\Manger + 02.GameObjects\Env\00.Manger 01.Level\60.PhysXLab @@ -327,6 +339,36 @@ 02.GameObjects\Dummys\DummyObject + + 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 + + + 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 + @@ -445,14 +487,11 @@ 01.Level\30.MapViewer - - 02.GameObjects\Env - 02.GameObjects\Terrain - 02.GameObjects\Env\Manger + 02.GameObjects\Env\00.Manger 01.Level\60.PhysXLab @@ -484,6 +523,36 @@ 02.GameObjects\Dummys\DummyObject + + 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 + + + 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 new file mode 100644 index 000000000..08a091a3e --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp @@ -0,0 +1,164 @@ +#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) +{ +} + +CBuildingContainer::CBuildingContainer(const CBuildingContainer& rhs) + :CMapContainer(rhs) +{ +} + +void CBuildingContainer::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); + + m_bSelected = false; +} + +void CBuildingContainer::Update(_float fTimeDelta) +{ + __super::Update(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); +} + +HRESULT CBuildingContainer::Render() +{ + return S_OK; +} + +HRESULT CBuildingContainer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CBuildingContainer::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + 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; +} + +HRESULT CBuildingContainer::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CBuildingContainer::Bind_ShaderResources() +{ + return S_OK; +} + +CBuildingContainer* CBuildingContainer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CBuildingContainer* pInstance = new CBuildingContainer(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CBuildingContainer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CBuildingContainer::Clone(void* pArg, CGameObject* pOwner) +{ + CBuildingContainer* pInstance = new CBuildingContainer(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CBuildingContainer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CBuildingContainer::Free() +{ + __super::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 6b69a4dbc..9c53bbcad 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -6,6 +6,7 @@ #include "DebugCamera.h" #include "Terrain.h" #include "MapObject_Manager.h" +#include "BuildingContainer.h" CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } @@ -38,7 +39,7 @@ HRESULT CLevel_MapViewer::Initialize() return E_FAIL; } - if (FAILED(Ready_Layer_MapObjects(TEXT("Layer_MapObject")))) { + if (FAILED(Ready_Layer_BuildingContainer(TEXT("Layer_Building")))) { return E_FAIL; } @@ -92,12 +93,9 @@ HRESULT CLevel_MapViewer::Ready_Layer_Terrain(const _wstring& strLayerTag) return S_OK; } -HRESULT CLevel_MapViewer::Ready_Layer_MapObjects(const _wstring& strLayerTag) +HRESULT CLevel_MapViewer::Ready_Layer_BuildingContainer(const _wstring& strLayerTag) { - //CMapObject::MAPOBJECT_DESC Desc = {}; - //Desc.pModelPrototypeTag = TEXT("Prototype_GameObject_SM_HW_ClockTower_Courtyard_BaseWall_A"); - - //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL,strLayerTag, &Desc))) + //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 dee279c41..472206311 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -47,7 +47,9 @@ #pragma region MAP_HEADER #include "VIBuffer_Terrain.h" #include "Terrain.h" -#include "MapObject.h" +#include "BuildingContainer.h" +#include "MapObject_Static.h" +#include "MapObject_LOD.h" #include "MapObject_Manager.h" #pragma endregion @@ -659,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] = {}; @@ -676,14 +676,37 @@ HRESULT CLoader::Loading_For_MapViewer() _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - /*For Prototype_Component_Model_Auro*/ + /*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("ì‰�ì�´ë�”를(ì�„) 로딩 중 입니다."); @@ -694,8 +717,16 @@ HRESULT CLoader::Loading_For_MapViewer() CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100)))) return E_FAIL; - /* For.Prototype_GameObject_MapObject */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject::Create(m_pDevice, m_pContext)))) + /* For.Prototype_GameObject_BuildingContainer */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBuildingContainer::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapObject_Static */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Static::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapObject_LOD */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_LOD::Create(m_pDevice, m_pContext)))) return E_FAIL; /* For.Prototype_GameObject_Terrain */ diff --git a/Jusin154_Team3D/Editor/Private/MapContainer.cpp b/Jusin154_Team3D/Editor/Private/MapContainer.cpp new file mode 100644 index 000000000..484d616cb --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapContainer.cpp @@ -0,0 +1,122 @@ +#include "pch.h" +#include "MapContainer.h" +#include "PartObject.h" + +#include "MapObject_LOD.h" +#include "MapObject_Static.h" + +CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CContainerObject(pDevice, pContext) +{ +} + +CMapContainer::CMapContainer(const CMapContainer& rhs) + :CContainerObject(rhs) +{ +} + +HRESULT CMapContainer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapContainer::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapContainer::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +void CMapContainer::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CMapContainer::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); +} + +void CMapContainer::Late_Update(_float fTimeDelta) +{ + __super::Late_Update(fTimeDelta); +} + +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 ace0588d0..183b29636 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject.cpp @@ -4,18 +4,59 @@ #include "GameInstance.h" #include "DebugCamera.h" #include "Layer.h" -//#include "Terrain.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" CMapObject::CMapObject(ID3D11Device * pDevice, ID3D11DeviceContext * pContext) - : CGameObject(pDevice, pContext) + : CPartObject(pDevice, pContext) { } CMapObject::CMapObject(const CMapObject& Prototype) - : CGameObject(Prototype) + : CPartObject(Prototype) { } + + +void CMapObject::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapObject::Update(_float fTimeDelta) +{ + +} + +void CMapObject::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if(m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +#endif + + _float4 vPos; + XMStoreFloat4(&vPos, Get_WorldPostion()); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapObject::Render() +{ + return S_OK; +} + +_wstring CMapObject::Get_PrototypeTag(_uint iLodIndex) +{ + return _wstring(); +} + HRESULT CMapObject::Initialize_Prototype() { return S_OK; @@ -23,17 +64,9 @@ HRESULT CMapObject::Initialize_Prototype() HRESULT CMapObject::Initialize(void* pArg) { - MAPOBJECT_DESC* pDesc = static_cast(pArg); - - m_strModelPrototypeTag = pDesc->pModelPrototypeTag; - 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); @@ -44,182 +77,23 @@ HRESULT CMapObject::Initialize(void* pArg) return S_OK; } -void CMapObject::Priority_Update(_float fTimeDelta) -{ -#ifdef _DEBUG - m_bSelected = false; -#endif -} - -void CMapObject::Update(_float fTimeDelta) -{ -#ifdef _DEBUG - 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 -} - -void CMapObject::Late_Update(_float fTimeDelta) -{ - _float4 vPos; - XMStoreFloat4(&vPos, Get_WorldPostion()); - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); -} - -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; -} - HRESULT CMapObject::Ready_Components() { __super::Ready_Components(nullptr); - /* Com_Model */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, - reinterpret_cast(&m_pModelCom)))) - return E_FAIL; - - /* Com_Shader */ - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, - reinterpret_cast(&m_pShaderCom)))) - return E_FAIL; - return S_OK; } HRESULT CMapObject::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { - return E_FAIL; - } - - if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { - return E_FAIL; - } - //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; } -CMapObject* CMapObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) -{ - CMapObject* pInstance = new CMapObject(pDevice, pContext); - - if (FAILED(pInstance->Initialize_Prototype())) - { - MSG_BOX("Failed to Created : CMapObject"); - Safe_Release(pInstance); - } - - 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() { __super::Free(); - - Safe_Release(m_pShaderCom); - Safe_Release(m_pModelCom); } void CMapObject::Describe_Entity() { - if (m_bDead) - return; - if (nullptr == m_pGameInstance) - return; - - ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str()); - ImGui::Text("----- Transfrom ----"); - ImGui::InputFloat("X##Position", &m_vPosition.x, 1.f, 10.f); - ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); - ImGui::InputFloat("Z##Position", &m_vPosition.z, 1.f, 10.f); - - if (m_pGameInstance->Mouse_Down(DIM_4)) - { - /*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); - }*/ - - } - - ImGui::Text("----- Rotation ----"); - ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); - ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); - ImGui::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); - - ImGui::Text("----- Scale ----"); - ImGui::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); - ImGui::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); - ImGui::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 (ImGui::Button("Delete")) - m_bDead = true; - - m_bSelected = true; } \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp new file mode 100644 index 000000000..34ca2a9f7 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp @@ -0,0 +1,275 @@ +#include "pch.h" +#include "MapObject_LOD.h" + +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Layer.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" + +CMapObject_LOD::CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapObject(pDevice, pContext) +{ +} + +CMapObject_LOD::CMapObject_LOD(const CMapObject_LOD& Prototype) + : CMapObject(Prototype), m_iLodIndex{ 0 } +{ +} + +HRESULT CMapObject_LOD::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapObject_LOD::Initialize(void* pArg) +{ + MAPOBJECT_LOD_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + +#ifdef _DEBUG + m_bSelected = false; + 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; +} + +void CMapObject_LOD::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapObject_LOD::Update(_float fTimeDelta) +{ + +} + +void CMapObject_LOD::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +#endif + + 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); +} + +HRESULT CMapObject_LOD::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + if (m_bSelected) + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { + return E_FAIL; + } + } + else + { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { + return E_FAIL; + } + } + + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +_wstring CMapObject_LOD::Get_PrototypeTag(_uint iLodIndex) +{ + if (m_iMaxLodLevel < iLodIndex) + return m_ModelPrototypeTags[0]; + + return m_ModelPrototypeTags[iLodIndex]; +} + +HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag) +{ + CModel* pModel = { nullptr }; + + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pModelPrototypeTag, + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_ModelPrototypeTags.push_back(pModelPrototypeTag); + + ++m_iMaxLodLevel; + m_pModelComs.push_back(pModel); + + return S_OK; +} + +HRESULT CMapObject_LOD::Ready_Components() +{ + __super::Ready_Components(); + + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + CModel* pModel = { nullptr }; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i], + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_pModelComs.push_back(pModel); + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapObject_LOD::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +CMapObject_LOD* CMapObject_LOD::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapObject_LOD* pInstance = new CMapObject_LOD(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapObject_LOD"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapObject_LOD::Clone(void* pArg, CGameObject * pOwner) +{ + CMapObject_LOD* pInstance = new CMapObject_LOD(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject_LOD"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapObject_LOD::Free() +{ + __super::Free(); + + Safe_Release(m_pShaderCom); + + for(auto& pModel : m_pModelComs) + Safe_Release(pModel); + m_pModelComs.clear(); +} + +void CMapObject_LOD::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); + GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); + m_iLodIndex = max(0, m_iLodIndex); + m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + GUI::Text("----- Transfrom ----"); + GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) + { + CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); + if (nullptr != pTerrain) + { + pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition); + } + + } + + GUI::Text("----- Rotation ----"); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + GUI::Text("----- Scale ----"); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + + m_vScale.x = max(0.01f, m_vScale.x); + m_vScale.y = max(0.01f, m_vScale.y); + m_vScale.z = max(0.01f, m_vScale.z); + + + if (GUI::Button("Delete")) + m_bDead = true; + + m_bSelected = true; +} \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 65acf60aa..83937fcc8 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -5,6 +5,9 @@ #include "DebugCamera.h" #include "Layer.h" #include "MapObject.h" +#include "MapObject_LOD.h" +#include "MapObject_Static.h" +#include "BuildingContainer.h" CMapObject_Manager::CMapObject_Manager(ID3D11Device * pDevice, ID3D11DeviceContext * pContext) @@ -12,15 +15,25 @@ CMapObject_Manager::CMapObject_Manager(ID3D11Device * pDevice, ID3D11DeviceConte { } -CMapObject_Manager::CMapObject_Manager(const CMapObject_Manager& Prototype) - : CGameObject(Prototype) - , m_ModelPrototypeTags{ Prototype.m_ModelPrototypeTags } +CMapObject_Manager::CMapObject_Manager(const CMapObject_Manager& rhs) + : CGameObject(rhs) + , m_ModelPrototypeTags{ rhs.m_ModelPrototypeTags } + , m_LODModelPrototypeTags{ rhs.m_LODModelPrototypeTags } { } HRESULT CMapObject_Manager::Initialize_Prototype(vector<_wstring>& ModelPrototypeTags) { - m_ModelPrototypeTags = ModelPrototypeTags; + for (auto& Tag : ModelPrototypeTags) + { + if (_wstring::npos != Tag.find(L"Lod")) + { + m_LODModelPrototypeTags.push_back(Tag); + } + + m_ModelPrototypeTags.push_back(Tag); + + } return S_OK; } @@ -30,51 +43,695 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; + if (FAILED(Ready_Components())) + return E_FAIL; + 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("Model Prototype List"); - - for (auto& Tag : m_ModelPrototypeTags) + GUI::Begin("File"); + if (GUI::Button("Save_Map")) { - if (ImGui::Button(CMyTools::ToString(Tag).c_str())) + 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(); + + Update_ObjectList(); + + 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()) { - CMapObject::MAPOBJECT_DESC Desc = {}; - Desc.pModelPrototypeTag = Tag.c_str(); + SAFE_RELEASE(*iter); + iter = m_MapObjects.erase(iter); + } + else + { + (*iter)->Late_Update(fTimeDelta); + ++iter; + } + + } +} - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"), &Desc))) +HRESULT CMapObject_Manager::Render() +{ + return S_OK; +} + +HRESULT CMapObject_Manager::Ready_Components() +{ + __super::Ready_Components(nullptr); + + return S_OK; +} + +HRESULT CMapObject_Manager::Bind_ShaderResources() +{ + return S_OK; +} + +HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) +{ + 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); + + } + else + { + land = doc.FirstChildElement("Land"); + } + + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); + + if (nullptr == pLayer) + return E_FAIL; + + const list* pList = pLayer->Get_Objects(); + + + for (auto pGamObject : *pList) + { + CBuildingContainer* pContainerObject = dynamic_cast(pGamObject); + + if (nullptr == pContainerObject) + return E_FAIL; + + string strName = pContainerObject->Get_Name(); + + tinyxml2::XMLElement* container = doc.NewElement("Container"); + container->SetAttribute("Name", strName.c_str()); + land->InsertEndChild(container); + + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, pGamObject->Get_Component()->Get_State(STATE::POSITION)); + + _float3 vScale = pGamObject->Get_Component()->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, pGamObject->Get_Component()->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + +#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); + } + + // + 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()); + + 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; +} + +HRESULT CMapObject_Manager::Load_MapData(const _char* pFileName) +{ + 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; + } + + /* Container */ + for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) + { + const _char* pName = {}; + + Container->QueryStringAttribute("Name", &pName); +#pragma region ADD_CONTAINER_OBJECT + + CBuildingContainer* pContainerObject = { nullptr }; + CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; + + auto* ContainerPosition = Container->FirstChildElement("Position"); + ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); + ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); + ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); + + auto* ContainerScale = Container->FirstChildElement("Scale"); + ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); + ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); + ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); + + auto* ContainerRotation = Container->FirstChildElement("Rotation"); + ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); + ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); + ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); + + ContainerDesc.strName = string(pName); + + m_pGameInstance->Add_GameObject_ToLayer( + g_iStaticLevel, ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"), &ContainerDesc, nullptr, &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, (CBuildingContainer**)(&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 + SAFE_RELEASE(pContainerObject); + + return S_OK; +} + +void CMapObject_Manager::Update_PrototypeList() +{ + GUI::Begin("Model Prototype List"); + for (auto& Tag : m_ModelPrototypeTags) + { + if (_wstring::npos != Tag.find(L"Lod")) + continue; + + if (ImGui::Button(CMyTools::ToString(Tag).c_str())) + { + _uint iNumLodModel = {}; + + if(false == Find_Lod_Prototype(Tag, &iNumLodModel)) + { + CMapObject_Static::MAPOBJECT_STATIC_DESC Desc = {}; + + Desc.strModelPrototypeTag = Tag; + Desc.pParentTransform = m_pTransformCom; + Desc.vPosition = _float3(0.f, 0.f, 0.f); + Desc.vRotation = _float3(0.f, 0.f, 0.f); + Desc.vScale = _float3(1.f, 1.f, 1.f); + + CMapObject_Static* pMapObject = { nullptr }; + const string strKey = CMyTools::ToString(Tag); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + /* if(FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + break;*/ + + m_MapObjects.push_back(pMapObject); + } + else + { + CMapObject_LOD::MAPOBJECT_LOD_DESC Desc = {}; + + vector<_wstring> PrototypeTags; + + PrototypeTags.push_back(Tag); + Desc.iMaxLodLevel = 0; + Desc.ModelPrototypeTags = PrototypeTags; + 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_LOD* pMapObject = { nullptr }; + const string strKey = CMyTools::ToString(Tag); + + pMapObject = m_pGameInstance->Clone_Prototype(g_iStaticLevel, &Desc); + + //if (FAILED(m_pContainer->Add_Part(strKey, 0, &pMapObject, &Desc))) + // break; + + m_MapObjects.push_back(pMapObject); + + for (_uint i = 0; i < iNumLodModel; ++i) + { + _wstring strLodTag = Tag + L"_Lod" + to_wstring(i + 1); + + pMapObject->Add_LodModel(strLodTag.c_str()); + } + + + } + } + } GUI::End(); + +} - CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject")); +void CMapObject_Manager::Update_ObjectList() +{ + //CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject")); - if (nullptr == pLayer) - return; + //if (nullptr == pLayer) + // return; - m_pMapObjects = pLayer->Get_Objects(); + //m_pMapObjects = pLayer->Get_Objects(); GUI::Begin("MapObject List"); _uint iObjectIndex = {}; string strSrc; - if (nullptr != m_pMapObjects) + if (false == m_MapObjects.empty()) { - for (auto pMapObject : (*m_pMapObjects)) + for (auto pMapObject : m_MapObjects) { CMapObject* pCurrentMapObject = static_cast(pMapObject); @@ -93,7 +750,10 @@ void CMapObject_Manager::Update(_float fTimeDelta) } GUI::End(); +} +void CMapObject_Manager::Update_Edit() +{ GUI::Begin("Edit"); if (nullptr != m_pSelectObject) @@ -101,103 +761,62 @@ void CMapObject_Manager::Update(_float fTimeDelta) m_pSelectObject->Describe_Entity(); if (m_pSelectObject->isDead()) m_pSelectObject = nullptr; + } GUI::End(); - } -void CMapObject_Manager::Late_Update(_float fTimeDelta) +void CMapObject_Manager::Update_ContainerObject() { + GUI::Begin("Edit Container"); -} + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building")); -HRESULT CMapObject_Manager::Render() -{ - return S_OK; -} - -HRESULT CMapObject_Manager::Ready_Components() -{ - return S_OK; -} - -HRESULT CMapObject_Manager::Bind_ShaderResources() -{ - return S_OK; -} - -HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) -{ - const list* pObjectList = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_MapObject"))->Get_Objects(); - - if (nullptr == pObjectList) - return E_FAIL; - - tinyxml2::XMLDocument doc; - - doc.InsertFirstChild(doc.NewDeclaration()); - - tinyxml2::XMLElement* land = doc.NewElement("Land"); - doc.InsertEndChild(land); - - for (auto& pObjcet : *pObjectList) + if (nullptr == pLayer) { - CMapObject* pMapObject = dynamic_cast(pObjcet); - - if (nullptr == pMapObject) - continue; - - // - tinyxml2::XMLElement* model = doc.NewElement("Model"); - land->InsertEndChild(model); - - // ÅØ½ºÆ® - tinyxml2::XMLElement* proto = doc.NewElement("PrototypeTag"); - proto->SetText(CMyTools::ToString(pMapObject->Get_PrototypeTag()).c_str()); - model->InsertEndChild(proto); - - // - tinyxml2::XMLElement* PositionElem = doc.NewElement("Position"); - - _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); - - // - 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); - model->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); - model->InsertEndChild(RotationElem); - + GUI::End(); + return; } - string strPath = "../Bin/Resources/Data/" + string(pFileName) + ".xml"; + const list* pList = pLayer->Get_Objects(); - // ÀúÀå - if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + _uint iIndex = {}; - return E_FAIL; + 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(); } - return S_OK; + 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; } @@ -231,6 +850,12 @@ void CMapObject_Manager::Free() { __super::Free(); + for (auto& pObject : m_MapObjects) + { + SAFE_RELEASE(pObject); + } + + SAFE_RELEASE(m_pContainer); } void CMapObject_Manager::Describe_Entity() diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp new file mode 100644 index 000000000..9872827b3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp @@ -0,0 +1,239 @@ +#include "pch.h" +#include "MapObject_Static.h" + +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Layer.h" +#include "Terrain.h" +#include "VIBuffer_Terrain.h" + +CMapObject_Static::CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapObject(pDevice, pContext) +{ +} + +CMapObject_Static::CMapObject_Static(const CMapObject_Static& Prototype) + : CMapObject(Prototype) +{ +} + +void CMapObject_Static::Priority_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + m_bSelected = false; +#endif +} + +void CMapObject_Static::Update(_float fTimeDelta) +{ + +} + +void CMapObject_Static::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + if (m_bSelected) + { + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); + m_pTransformCom->Set_Scale(m_vScale); + m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); + } +#endif + + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + + _float4 vPos; + XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION)); + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f); +} + +HRESULT CMapObject_Static::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 (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))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapObject_Static::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapObject_Static::Initialize(void* pArg) +{ + m_iMaxLodLevel = 0; + + MAPOBJECT_STATIC_DESC* pDesc = static_cast(pArg); + + m_strModelPrototypeTag = pDesc->strModelPrototypeTag; + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components())) + return E_FAIL; + + +#ifdef _DEBUG + m_bSelected = false; + 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; +} + +_wstring CMapObject_Static::Get_PrototypeTag(_uint iLodIndex) +{ + return m_strModelPrototypeTag; +} + +HRESULT CMapObject_Static::Ready_Components() +{ + __super::Ready_Components(); + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, + reinterpret_cast(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapObject_Static::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +CMapObject_Static* CMapObject_Static::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapObject_Static* pInstance = new CMapObject_Static(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapObject_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapObject_Static::Clone(void* pArg, CGameObject* pOwner) +{ + CMapObject_Static* pInstance = new CMapObject_Static(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapObject_Static"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapObject_Static::Free() +{ + __super::Free(); + + Safe_Release(m_pShaderCom); + Safe_Release(m_pModelCom); +} + +void CMapObject_Static::Describe_Entity() +{ + if (m_bDead) + return; + if (nullptr == m_pGameInstance) + return; + + //ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str()); + ImGui::Text("----- Transfrom ----"); + ImGui::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); + ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); + ImGui::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); + } + + } + + ImGui::Text("----- Rotation ----"); + ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); + ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); + ImGui::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + + ImGui::Text("----- Scale ----"); + ImGui::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); + ImGui::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); + ImGui::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 (ImGui::Button("Delete")) + m_bDead = true; + + m_bSelected = true; +} \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/BuildingContainer.h b/Jusin154_Team3D/Editor/Public/BuildingContainer.h new file mode 100644 index 000000000..3dcd25980 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/BuildingContainer.h @@ -0,0 +1,42 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapContainer.h" + +NS_BEGIN(Editor) + +class CBuildingContainer final : public CMapContainer +{ + + +public: + CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CBuildingContainer(const CBuildingContainer& rhs); + ~CBuildingContainer() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +public: + template + HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) { + return Add_PartObject(strPartKey, iPrototypeLevelIndex, ppOut, pArg); + } + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources()override; + +public: + static CBuildingContainer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner = nullptr)override; + virtual void Free() override; + virtual void Describe_Entity()override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 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/Level_MapViewer.h b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h index 84319b5fe..94a6dfeae 100644 --- a/Jusin154_Team3D/Editor/Public/Level_MapViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_MapViewer.h @@ -20,7 +20,7 @@ class CLevel_MapViewer final : public CLevel HRESULT Ready_Layer_Light(); HRESULT Ready_Layer_Camera(const _wstring& strLayerTag); HRESULT Ready_Layer_Terrain(const _wstring& strLayerTag); - HRESULT Ready_Layer_MapObjects(const _wstring& strLayerTag); + HRESULT Ready_Layer_BuildingContainer(const _wstring& strLayerTag); HRESULT Ready_Layer_MapObjectManager(const _wstring& strLayerTag); diff --git a/Jusin154_Team3D/Editor/Public/MapContainer.h b/Jusin154_Team3D/Editor/Public/MapContainer.h new file mode 100644 index 000000000..57095b7d3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapContainer.h @@ -0,0 +1,50 @@ +#pragma once + +#include "Editor_Define.h" +#include "ContainerObject.h" + +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); + ~CMapContainer() = default; +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + + 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; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapObject.h b/Jusin154_Team3D/Editor/Public/MapObject.h index b830e36ff..cd10f0da4 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject.h +++ b/Jusin154_Team3D/Editor/Public/MapObject.h @@ -1,7 +1,7 @@ #pragma once #include "Editor_Define.h" -#include "GameObject.h" +#include "PartObject.h" NS_BEGIN(Engine) class CShader; @@ -10,50 +10,46 @@ NS_END NS_BEGIN(Editor) -class CMapObject final : public CGameObject +class CMapObject abstract : public CPartObject { -public: - typedef struct tagMapObjectDesc - { - const _tchar* pModelPrototypeTag; - }MAPOBJECT_DESC; - -private: +protected: CMapObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CMapObject(const CMapObject& Prototype); virtual ~CMapObject() = default; public: - virtual HRESULT Initialize_Prototype() override; - virtual HRESULT Initialize(void* pArg) override; virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; public: - _wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; } + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + virtual _uint Get_LodLevel() { return m_iMaxLodLevel; } -private: - CShader* m_pShaderCom = { nullptr }; - CModel* m_pModelCom = { nullptr }; +protected: - _wstring m_strModelPrototypeTag; + +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + HRESULT Ready_Components(); #ifdef _DEBUG - _bool m_bSelected = {}; - _float3 m_vPosition = {}; - _float3 m_vRotation = {}; - _float3 m_vScale = {}; +protected: + _bool m_bSelected = {}; + + _uint m_iMaxLodLevel = {}; + + _float3 m_vPosition = {}; + _float3 m_vRotation = {}; + _float3 m_vScale = {}; #endif // _DEBUG private: - HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); public: - static CMapObject* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; virtual void Free() override; virtual void Describe_Entity() override; }; diff --git a/Jusin154_Team3D/Editor/Public/MapObject_LOD.h b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h new file mode 100644 index 000000000..ec7acf8c8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapObject_LOD.h @@ -0,0 +1,60 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapObject.h" + +NS_BEGIN(Editor) + +class CMapObject_LOD final : public CMapObject +{ +public: + typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC + { + _uint iMaxLodLevel{}; + vector<_wstring> ModelPrototypeTags; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; + }MAPOBJECT_LOD_DESC; + +private: + CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapObject_LOD(const CMapObject_LOD& Prototype); + virtual ~CMapObject_LOD() = default; + +public: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +public: + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + HRESULT Add_LodModel(const _tchar* pModelPrototypeTag); + +private: + CShader* m_pShaderCom = { nullptr }; + vector m_pModelComs; + + _uint m_iMaxLodLevel = {}; + _uint m_iLodIndex = {}; + + vector<_wstring> m_ModelPrototypeTags; + + + + +private: + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + +public: + static CMapObject_LOD* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; + virtual void Describe_Entity() override; +}; + +NS_END \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index c38516be3..bc8bc4451 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -26,14 +26,32 @@ class CMapObject_Manager final : public CGameObject virtual HRESULT Render() override; private: - class CMapObject* m_pSelectObject = { nullptr }; - const list* m_pMapObjects = { nullptr }; + class CMapObject* m_pSelectObject = { nullptr }; + list m_MapObjects = {}; vector<_wstring> m_ModelPrototypeTags; + vector<_wstring> m_LODModelPrototypeTags; + _uint m_iContainerObjectIndex = {}; + + class CBuildingContainer* m_pContainer = { nullptr }; + _char m_szSaveContainerName[MAX_PATH] = {}; private: - HRESULT Ready_Components(); - HRESULT Bind_ShaderResources(); - HRESULT Save_MapData(const _char* pFileName); + 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 new file mode 100644 index 000000000..c2c32d05d --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/MapObject_Static.h @@ -0,0 +1,54 @@ +#pragma once + +#include "Editor_Define.h" +#include "MapObject.h" + +NS_BEGIN(Editor) + +class CMapObject_Static final : public CMapObject +{ +public: + typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC + { + _uint iMaxLodLevel{}; + _wstring strModelPrototypeTag; + _float3 vPosition; + _float3 vScale; + _float3 vRotation; + }MAPOBJECT_STATIC_DESC; + +private: + CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapObject_Static(const CMapObject_Static& Prototype); + virtual ~CMapObject_Static() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +public: + virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0); + +private: + CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + + _wstring m_strModelPrototypeTag; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + +public: + static CMapObject_Static* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; + virtual void Describe_Entity() override; +}; + +NS_END \ No newline at end of file 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);