From ae4784e057b0fde873ef0755f0e43878e33d1946 Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Tue, 19 Jul 2022 16:57:09 +0700 Subject: [PATCH] refactoring --- Shooter.cpp | 2 +- Shooter.h | 2 +- ShooterConsts.h | 26 ++- obj/{ => items}/ability.obj | 0 obj/{ => items}/ak47.obj | 0 obj/{ => items}/gold_ak47.obj | 0 obj/{ => items}/gun.obj | 0 obj/{ => items}/hill.obj | 0 obj/{ => items}/rifle.obj | 0 obj/{ => items}/shotgun.obj | 0 obj/man/man.obj | 303 ------------------------------ {maps => obj/maps}/map1.obj | 0 {maps => obj/maps}/map2.obj | 0 {maps => obj/maps}/map_simple.obj | 0 {maps => obj/maps}/plane.obj | 0 obj/{ => other}/XYZ.obj | 0 obj/{ => other}/cube.obj | 0 obj/{ => other}/sphere.obj | 0 obj/{ => other}/vector.obj | 0 19 files changed, 14 insertions(+), 319 deletions(-) rename obj/{ => items}/ability.obj (100%) rename obj/{ => items}/ak47.obj (100%) rename obj/{ => items}/gold_ak47.obj (100%) rename obj/{ => items}/gun.obj (100%) rename obj/{ => items}/hill.obj (100%) rename obj/{ => items}/rifle.obj (100%) rename obj/{ => items}/shotgun.obj (100%) delete mode 100644 obj/man/man.obj rename {maps => obj/maps}/map1.obj (100%) rename {maps => obj/maps}/map2.obj (100%) rename {maps => obj/maps}/map_simple.obj (100%) rename {maps => obj/maps}/plane.obj (100%) rename obj/{ => other}/XYZ.obj (100%) rename obj/{ => other}/cube.obj (100%) rename obj/{ => other}/sphere.obj (100%) rename obj/{ => other}/vector.obj (100%) diff --git a/Shooter.cpp b/Shooter.cpp index 2455a01..b60caf5 100644 --- a/Shooter.cpp +++ b/Shooter.cpp @@ -334,7 +334,7 @@ void Shooter::addBonus(const string &bonusName, const Vec3D &position) { ObjectNameTag nameTag(bonusName); - world->addBody(std::make_shared(ObjectNameTag(bonusName), "obj/" + name + ".obj", Vec3D{3, 3, 3})); + world->addBody(std::make_shared(ObjectNameTag(bonusName), "obj/items/" + name + ".obj", Vec3D{3, 3, 3})); auto bonus = world->body(ObjectNameTag(bonusName)); diff --git a/Shooter.h b/Shooter.h index eadf5c6..a145ee4 100644 --- a/Shooter.h +++ b/Shooter.h @@ -19,7 +19,7 @@ class Shooter final : public Engine { private: std::shared_ptr player = std::make_shared(ObjectNameTag("Player"), ShooterConsts::CUBE_OBJ, - Vec3D{1.5, 1.2, 1.5}); + Vec3D{1.5, 1.8, 1.5}); std::shared_ptr playerController = std::make_shared(player, keyboard, mouse); Window mainMenu; diff --git a/ShooterConsts.h b/ShooterConsts.h index 1421148..35de1ad 100644 --- a/ShooterConsts.h +++ b/ShooterConsts.h @@ -19,37 +19,35 @@ namespace ShooterConsts { const std::string PLAYER_NAME = "Player"; const std::string PROJECT_NAME = "Shooter"; - const std::string ABILITY_OBJ = "obj/ability.obj"; - const std::string HILL_OBJ = "obj/hill.obj"; - const std::string GUN_OBJ = "obj/gun.obj"; + const std::string ABILITY_OBJ = "obj/items/ability.obj"; + const std::string HILL_OBJ = "obj/items/hill.obj"; + const std::string GUN_OBJ = "obj/items/gun.obj"; const std::string GUN_FIRE_SOUND = "sound/weapons/gun.ogg"; const std::string GUN_RELOAD_SOUND = "sound/weapons/reload_gun.ogg"; - const std::string AK47_OBJ = "obj/ak47.obj"; + const std::string AK47_OBJ = "obj/items/ak47.obj"; const std::string AK47_FIRE_SOUND = "sound/weapons/ak47.ogg"; const std::string AK47_RELOAD_SOUND = "sound/weapons/reload_ak47.ogg"; - const std::string GOLD_AK47_OBJ = "obj/gold_ak47.obj"; + const std::string GOLD_AK47_OBJ = "obj/items/gold_ak47.obj"; const std::string GOLD_AK47_FIRE_SOUND = "sound/weapons/ak47.ogg"; const std::string GOLD_AK47_RELOAD_SOUND = "sound/weapons/reload_ak47.ogg"; - const std::string RIFLE_OBJ = "obj/rifle.obj"; + const std::string RIFLE_OBJ = "obj/items/rifle.obj"; const std::string RIFLE_FIRE_SOUND = "sound/weapons/shotgun.ogg"; const std::string RIFLE_RELOAD_SOUND = "sound/weapons/reload_ak47.ogg"; - const std::string SHOTGUN_OBJ = "obj/shotgun.obj"; + const std::string SHOTGUN_OBJ = "obj/items/shotgun.obj"; const std::string SHOTGUN_FIRE_SOUND = "sound/weapons/shotgun.ogg"; const std::string SHOTGUN_RELOAD_SOUND = "sound/weapons/reload_shotgun.ogg"; - const std::string CUBE_OBJ = "obj/cube.obj"; - const std::string MAP_OBJ = "maps/map1.obj"; - const std::string MAP_NO_TRANS_OBJ = "maps/map1_no_transperent.obj"; - const std::string BIG_MAP_OBJ = "maps/map2.obj"; - const std::string SIMPLE_MAP_OBJ = "maps/map_simple.obj"; - const std::string PLANE_MAP_OBJ = "maps/plane.obj"; + const std::string CUBE_OBJ = "obj/other/cube.obj"; + const std::string MAP_OBJ = "obj/maps/map1.obj"; + const std::string BIG_MAP_OBJ = "obj/maps/map2.obj"; + const std::string SIMPLE_MAP_OBJ = "obj/maps/map_simple.obj"; + const std::string PLANE_MAP_OBJ = "obj/maps/plane.obj"; const std::string MAIN_MENU_BACK = "textures/back.png"; const std::string MAIN_MENU_GUI = "textures/gui.png"; const std::string HEAD_OBJ = "obj/man/head.obj"; const std::string BODY_OBJ = "obj/man/body.obj"; const std::string FOOT_OBJ = "obj/man/foot.obj"; - const std::string MAN_OBJ = "obj/man/man.obj"; const std::string CLICK_SOUND = "sound/click.ogg"; const std::string BACK_NOISE = "sound/backNoise.ogg"; diff --git a/obj/ability.obj b/obj/items/ability.obj similarity index 100% rename from obj/ability.obj rename to obj/items/ability.obj diff --git a/obj/ak47.obj b/obj/items/ak47.obj similarity index 100% rename from obj/ak47.obj rename to obj/items/ak47.obj diff --git a/obj/gold_ak47.obj b/obj/items/gold_ak47.obj similarity index 100% rename from obj/gold_ak47.obj rename to obj/items/gold_ak47.obj diff --git a/obj/gun.obj b/obj/items/gun.obj similarity index 100% rename from obj/gun.obj rename to obj/items/gun.obj diff --git a/obj/hill.obj b/obj/items/hill.obj similarity index 100% rename from obj/hill.obj rename to obj/items/hill.obj diff --git a/obj/rifle.obj b/obj/items/rifle.obj similarity index 100% rename from obj/rifle.obj rename to obj/items/rifle.obj diff --git a/obj/shotgun.obj b/obj/items/shotgun.obj similarity index 100% rename from obj/shotgun.obj rename to obj/items/shotgun.obj diff --git a/obj/man/man.obj b/obj/man/man.obj deleted file mode 100644 index c389806..0000000 --- a/obj/man/man.obj +++ /dev/null @@ -1,303 +0,0 @@ -# Blender v2.91.0 OBJ File: 'man.blend' -# www.blender.org -mtllib man.mtl -o Cube.001 -v 1.006158 4.372691 -1.494992 -v 0.386619 5.072635 0.362018 -v 1.006158 4.372690 1.494994 -v -0.756221 -0.090896 1.227844 -v 0.756221 -0.090896 1.227844 -v -1.006158 4.372690 1.494994 -v -0.756221 -0.090896 -1.227844 -v 0.756221 -0.090896 -1.227844 -v -1.006158 4.372691 -1.494992 -v -0.386619 5.072635 -0.362016 -v 0.386619 5.072635 -0.362016 -v -0.386619 5.072635 0.362018 -g Cube.001_Cube.001_Material.001 -usemtl Material.001 -s off -f 1 2 3 -f 3 4 5 -f 6 7 4 -f 8 4 7 -f 1 5 8 -f 9 8 7 -f 10 2 11 -f 9 11 1 -f 3 12 6 -f 6 10 9 -f 1 11 2 -f 3 6 4 -f 6 9 7 -f 8 5 4 -f 1 3 5 -f 9 1 8 -f 10 12 2 -f 9 10 11 -f 3 2 12 -f 6 12 10 -o Cube.002 -v -0.483757 0.506029 0.093912 -v 0.483757 0.506029 1.061425 -v 0.483757 0.506029 0.093912 -v -0.320470 -4.519009 0.898138 -v 0.320470 -4.519009 0.898138 -v -0.483757 0.506029 1.061425 -v -0.320470 -4.519009 0.257197 -v 0.320470 -4.519009 0.257197 -g Cube.002_Cube.002_Material.002 -usemtl Material.002 -s off -f 13 14 15 -f 14 16 17 -f 18 19 16 -f 20 16 19 -f 15 17 20 -f 13 20 19 -f 13 18 14 -f 14 18 16 -f 18 13 19 -f 20 17 16 -f 15 14 17 -f 13 15 20 -o Cube.003 -v -0.483757 0.506029 -1.126139 -v 0.483757 0.506029 -0.158626 -v 0.483757 0.506029 -1.126139 -v -0.320470 -4.519009 -0.321913 -v 0.320470 -4.519009 -0.321913 -v -0.483757 0.506029 -0.158626 -v -0.320470 -4.519009 -0.962854 -v 0.320470 -4.519009 -0.962854 -g Cube.003_Cube.003_Material.002 -usemtl Material.002 -s off -f 21 22 23 -f 22 24 25 -f 26 27 24 -f 28 24 27 -f 23 25 28 -f 21 28 27 -f 21 26 22 -f 22 26 24 -f 26 21 27 -f 28 25 24 -f 23 22 25 -f 21 23 28 -o Cube.004 -v -0.896299 6.931367 -0.896299 -v 0.896299 6.931367 0.896299 -v 0.896299 6.931367 -0.896299 -v -1.000000 5.891715 1.000000 -v 1.000000 5.891715 1.000000 -v -0.896299 6.931367 0.896299 -v -1.000000 5.891716 -1.000000 -v 1.000000 5.891716 -1.000000 -v -0.769924 4.970632 -0.551460 -v 0.769924 4.970632 -0.551460 -v -0.769924 4.970631 0.551460 -v 0.769924 4.970631 0.551460 -g Cube.004_Cube.004_Material.003 -usemtl Material.003 -s off -f 29 30 31 -f 30 32 33 -f 34 35 32 -f 36 37 35 -f 31 33 36 -f 29 36 35 -f 38 39 37 -f 32 40 33 -f 35 39 32 -f 33 38 36 -f 29 34 30 -f 30 34 32 -f 34 29 35 -f 36 38 37 -f 31 30 33 -f 29 31 36 -f 38 40 39 -f 32 39 40 -f 35 37 39 -f 33 40 38 -o Cube.005 -v 0.712293 7.597342 0.712293 -v -0.151956 7.894814 0.151956 -v -0.712293 7.597342 0.712293 -v -1.158729 7.189323 1.158729 -v 1.158729 7.189323 1.158729 -v -1.158729 7.189323 -1.158729 -v 1.221310 6.836089 1.221310 -v 0.712293 7.597342 -0.712293 -v 1.158729 7.189323 -1.158729 -v -0.712293 7.597342 -0.712293 -v -0.151956 7.894814 -0.151956 -v 0.151956 7.894814 0.151956 -v 0.151956 7.894814 -0.151956 -v 1.221310 6.836090 -1.221310 -v -1.221310 6.836089 1.221310 -v -1.221310 6.836090 -1.221310 -v 1.376278 6.967803 0.820424 -v 2.195129 6.845563 0.557544 -v 2.196907 6.927416 0.528975 -v 1.373520 6.840852 0.864734 -v 1.376278 6.967803 -0.820424 -v 1.373520 6.840853 -0.864734 -v 2.195129 6.845563 -0.557544 -v 2.196907 6.927417 -0.528975 -g Cube.005_Cube.005_Material.004 -usemtl Material.004 -s off -f 41 42 43 -f 41 44 45 -f 43 46 44 -f 44 47 45 -f 48 45 49 -f 50 49 46 -f 51 52 53 -f 43 51 50 -f 48 52 41 -f 50 53 48 -f 54 55 56 -f 46 55 44 -f 47 57 45 -f 49 56 46 -f 57 58 59 -f 54 60 47 -f 45 61 49 -f 54 61 62 -f 59 63 64 -f 57 64 61 -f 61 63 62 -f 62 58 60 -f 41 52 42 -f 41 43 44 -f 43 50 46 -f 44 55 47 -f 48 41 45 -f 50 48 49 -f 51 42 52 -f 43 42 51 -f 48 53 52 -f 50 51 53 -f 54 47 55 -f 46 56 55 -f 47 60 57 -f 49 54 56 -f 57 60 58 -f 54 62 60 -f 45 57 61 -f 54 49 61 -f 59 58 63 -f 57 59 64 -f 61 64 63 -f 62 63 58 -o Cylinder -v 0.962097 6.575150 0.181713 -v 1.078884 6.799692 0.487653 -v 1.078872 6.575145 0.181712 -v 0.962109 6.799696 0.487654 -v 1.078879 6.578115 0.795751 -v 0.962104 6.578118 0.795752 -v 1.078865 6.216624 0.680225 -v 0.962086 6.214793 0.300729 -v 0.962090 6.216629 0.680226 -v 1.078861 6.214789 0.300728 -g Cylinder_Cylinder_Material.005 -usemtl Material.005 -s off -f 65 66 67 -f 68 69 66 -f 70 71 69 -f 72 73 70 -f 73 74 71 -f 72 67 74 -f 66 71 74 -f 65 68 66 -f 68 70 69 -f 70 73 71 -f 70 68 65 -f 65 72 70 -f 73 72 74 -f 72 65 67 -f 74 67 66 -f 66 69 71 -o Cylinder.001 -v 0.962097 6.575150 -0.771303 -v 1.078884 6.799693 -0.465364 -v 1.078872 6.575146 -0.771305 -v 0.962109 6.799696 -0.465363 -v 1.078879 6.578115 -0.157266 -v 0.962104 6.578118 -0.157265 -v 1.078865 6.216624 -0.272792 -v 0.962086 6.214794 -0.652288 -v 0.962090 6.216629 -0.272791 -v 1.078861 6.214789 -0.652289 -g Cylinder.001_Cylinder.001_Material.005 -usemtl Material.005 -s off -f 75 76 77 -f 78 79 76 -f 80 81 79 -f 82 83 80 -f 83 84 81 -f 82 77 84 -f 76 81 84 -f 75 78 76 -f 78 80 79 -f 80 83 81 -f 80 78 75 -f 75 82 80 -f 83 82 84 -f 82 75 77 -f 84 77 76 -f 76 79 81 -o Cone -v 0.963230 5.877079 -0.304800 -v 1.290335 5.893193 -0.000014 -v 0.963254 5.877326 0.304970 -v 0.963207 6.405278 -0.000129 -g Cone_Cone_Material.006 -usemtl Material.006 -s off -f 85 86 87 -f 85 87 88 -f 87 86 88 -f 88 86 85 -o Cube.006 -v 0.889087 5.489478 -0.445975 -v 0.864723 5.408637 -0.439738 -v 0.883479 5.470870 0.440201 -v 0.907843 5.551713 0.433964 -v 0.949253 5.704751 0.648533 -v 0.988905 5.527282 0.433964 -v 0.964541 5.446440 0.440201 -v 0.945785 5.384206 -0.439738 -v 0.970149 5.465047 -0.445975 -v 0.953966 5.720388 0.626380 -v 0.975604 5.696810 0.648533 -v 0.980317 5.712446 0.626380 -g Cube.006_Cube.006_Material.007 -usemtl Material.007 -s off -f 89 90 91 -f 92 91 93 -f 94 95 96 -f 97 96 90 -f 95 91 90 -f 92 94 97 -f 98 93 99 -f 94 100 99 -f 91 95 99 -f 92 98 100 -f 89 91 92 -f 92 93 98 -f 94 96 97 -f 97 90 89 -f 95 90 96 -f 92 97 89 -f 98 99 100 -f 94 99 95 -f 91 99 93 -f 92 100 94 diff --git a/maps/map1.obj b/obj/maps/map1.obj similarity index 100% rename from maps/map1.obj rename to obj/maps/map1.obj diff --git a/maps/map2.obj b/obj/maps/map2.obj similarity index 100% rename from maps/map2.obj rename to obj/maps/map2.obj diff --git a/maps/map_simple.obj b/obj/maps/map_simple.obj similarity index 100% rename from maps/map_simple.obj rename to obj/maps/map_simple.obj diff --git a/maps/plane.obj b/obj/maps/plane.obj similarity index 100% rename from maps/plane.obj rename to obj/maps/plane.obj diff --git a/obj/XYZ.obj b/obj/other/XYZ.obj similarity index 100% rename from obj/XYZ.obj rename to obj/other/XYZ.obj diff --git a/obj/cube.obj b/obj/other/cube.obj similarity index 100% rename from obj/cube.obj rename to obj/other/cube.obj diff --git a/obj/sphere.obj b/obj/other/sphere.obj similarity index 100% rename from obj/sphere.obj rename to obj/other/sphere.obj diff --git a/obj/vector.obj b/obj/other/vector.obj similarity index 100% rename from obj/vector.obj rename to obj/other/vector.obj