diff --git a/assets/voxygen/voxel/object_manifest.ron b/assets/voxygen/voxel/object_manifest.ron new file mode 100644 index 0000000000..d379e65561 --- /dev/null +++ b/assets/voxygen/voxel/object_manifest.ron @@ -0,0 +1,380 @@ +({ + Arrow: ( + bone0: ( + offset: (-0.5, -6.0, -1.5), + central: ("weapon.projectile.simple-arrow"), + ) + ), + Bomb: ( + bone0: ( + offset: (-5.5, -5.5, 0.0), + central: ("object.bomb"), + ) + ), + FireworkBlue: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_blue-0"), + ) + ), + FireworkGreen: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_green-0"), + ) + ), + FireworkPurple: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_purple-0"), + ) + ), + FireworkRed: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_red-0"), + ) + ), + FireworkYellow: ( + bone0: ( + offset: (0.0, 0.0, 0.0), + central: ("weapon.projectile.fireworks_yellow-0"), + ) + ), + Scarecrow: ( + bone0: ( + offset: (-9.5, -4.0, 0.0), + central: ("object.scarecrow"), + ) + ), + Cauldron: ( + bone0: ( + offset: (-10.0, -10.0, 0.0), + central: ("object.cauldron"), + ) + ), + ChestVines: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_vines"), + ) + ), + Chest: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest"), + ) + ), + ChestDark: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_dark"), + ) + ), + ChestDemon: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_demon"), + ) + ), + ChestGold: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_gold"), + ) + ), + ChestLight: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_light"), + ) + ), + ChestOpen: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_open"), + ) + ), + ChestSkull: ( + bone0: ( + offset: (-7.5, -6.0, 0.0), + central: ("object.chest_skull"), + ) + ), + Pumpkin: ( + bone0: ( + offset: (-5.5, -4.0, 0.0), + central: ("object.pumpkin"), + ) + ), + Pumpkin2: ( + bone0: ( + offset: (-5.0, -4.0, 0.0), + central: ("object.pumpkin_2"), + ) + ), + Pumpkin3: ( + bone0: ( + offset: (-5.0, -4.0, 0.0), + central: ("object.pumpkin_3"), + ) + ), + Pumpkin4: ( + bone0: ( + offset: (-5.0, -4.0, 0.0), + central: ("object.pumpkin_4"), + ) + ), + Pumpkin5: ( + bone0: ( + offset: (-4.0, -5.0, 0.0), + central: ("object.pumpkin_5"), + ) + ), + Campfire: ( + bone0: ( + offset: (-9.0, -10.0, 0.0), + central: ("object.campfire"), + ) + ), + CampfireLit: ( + bone0: ( + offset: (-9.0, -10.0, 0.0), + central: ("object.campfire_lit"), + ) + ), + LanternGround: ( + bone0: ( + offset: (-3.5, -3.5, 0.0), + central: ("object.lantern_ground"), + ) + ), + LanternGroundOpen: ( + bone0: ( + offset: (-3.5, -3.5, 0.0), + central: ("object.lantern_ground_open"), + ) + ), + LanternStanding: ( + bone0: ( + offset: (-7.5, -3.5, 0.0), + central: ("object.lantern_standing"), + ) + ), + LanternStanding2: ( + bone0: ( + offset: (-11.5, -3.5, 0.0), + central: ("object.lantern_standing_2"), + ) + ), + PotionRed: ( + bone0: ( + offset: (-2.0, -2.0, 0.0), + central: ("object.potion_red"), + ) + ), + PotionBlue: ( + bone0: ( + offset: (-2.0, -2.0, 0.0), + central: ("object.potion_blue"), + ) + ), + PotionGreen: ( + bone0: ( + offset: (-2.0, -2.0, 0.0), + central: ("object.potion_green"), + ) + ), + Crate: ( + bone0: ( + offset: (-7.0, -7.0, 0.0), + central: ("object.crate"), + ) + ), + Tent: ( + bone0: ( + offset: (-18.5, -19.5, 0.0), + central: ("object.tent"), + ) + ), + WindowSpooky: ( + bone0: ( + offset: (-15.0, -1.5, -1.0), + central: ("object.window_spooky"), + ) + ), + DoorSpooky: ( + bone0: ( + offset: (-15.0, -4.5, 0.0), + central: ("object.door_spooky"), + ) + ), + Table: ( + bone0: ( + offset: (-12.0, -8.0, 0.0), + central: ("object.table"), + ) + ), + Table2: ( + bone0: ( + offset: (-8.0, -8.0, 0.0), + central: ("object.table_2"), + ) + ), + Table3: ( + bone0: ( + offset: (-10.0, -10.0, 0.0), + central: ("object.table_3"), + ) + ), + Drawer: ( + bone0: ( + offset: (-11.0, -7.5, 0.0), + central: ("object.drawer"), + ) + ), + BedBlue: ( + bone0: ( + offset: (-11.0, -15.0, 0.0), + central: ("object.bed_human_blue"), + ) + ), + Anvil: ( + bone0: ( + offset: (-3.0, -7.0, 0.0), + central: ("object.anvil"), + ) + ), + Gravestone: ( + bone0: ( + offset: (-5.0, -2.0, 0.0), + central: ("object.gravestone"), + ) + ), + Gravestone2: ( + bone0: ( + offset: (-8.5, -3.0, 0.0), + central: ("object.gravestone_2"), + ) + ), + Chair: ( + bone0: ( + offset: (-5.0, -4.5, 0.0), + central: ("object.chair"), + ) + ), + Chair2: ( + bone0: ( + offset: (-5.0, -4.5, 0.0), + central: ("object.chair_2"), + ) + ), + Chair3: ( + bone0: ( + offset: (-5.0, -4.5, 0.0), + central: ("object.chair_3"), + ) + ), + Bench: ( + bone0: ( + offset: (-8.8, -5.0, 0.0), + central: ("object.bench"), + ) + ), + Carpet: ( + bone0: ( + offset: (-14.0, -14.0, -0.5), + central: ("object.carpet"), + ) + ), + Bedroll: ( + bone0: ( + offset: (-11.0, -19.5, -0.5), + central: ("object.bedroll"), + ) + ), + CarpetHumanRound: ( + bone0: ( + offset: (-14.0, -14.0, -0.5), + central: ("object.carpet_human_round"), + ) + ), + CarpetHumanSquare: ( + bone0: ( + offset: (-13.5, -14.0, -0.5), + central: ("object.carpet_human_square"), + ) + ), + CarpetHumanSquare2: ( + bone0: ( + offset: (-13.5, -14.0, -0.5), + central: ("object.carpet_human_square_2"), + ) + ), + CarpetHumanSquircle: ( + bone0: ( + offset: (-21.0, -21.0, -0.5), + central: ("object.carpet_human_squircle"), + ) + ), + Pouch: ( + bone0: ( + offset: (-5.5, -4.5, 0.0), + central: ("object.pouch"), + ) + ), + CraftingBench: ( + bone0: ( + offset: (-9.5, -7.0, 0.0), + central: ("object.crafting_bench"), + ) + ), + ArrowSnake: ( + bone0: ( + offset: (-1.5, -6.5, 0.0), + central: ("weapon.projectile.snake-arrow"), + ) + ), + BoltFire: ( + bone0: ( + offset: (-3.0, -5.5, -3.0), + central: ("weapon.projectile.fire-bolt-0"), + ) + ), + BoltFireBig: ( + bone0: ( + offset: (-6.0, -6.0, -6.0), + central: ("weapon.projectile.fire-bolt-1"), + ) + ), + TrainingDummy: ( + bone0: ( + offset: (-7.0, -5.0, 0.0), + central: ("object.training_dummy"), + ) + ), + MultiArrow: ( + bone0: ( + offset: (-4.0, -9.5, -5.0), + central: ("weapon.projectile.multi-arrow"), + ) + ), + BoltNature: ( + bone0: ( + offset: (-6.0, -6.0, -6.0), + central: ("weapon.projectile.nature-bolt"), + ) + ), + MeatDrop: ( + bone0: ( + offset: (-3.5, -8.0, 0.0), + central: ("object.meat_drop"), + ) + ), + Steak: ( + bone0: ( + offset: (-3.5, -6.0, 0.0), + central: ("object.steak"), + ) + ), +}) \ No newline at end of file diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index c4b69a1134..5241f9e860 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -3744,12 +3744,30 @@ impl QuadrupedLowLateralSpec { } //// + +#[derive(Deserialize)] +struct ObjectCentralSpec(HashMap); + +#[derive(Deserialize)] +struct SidedObjectCentralVoxSpec { + bone0: ObjectCentralSubSpec, +} +#[derive(Deserialize)] +struct ObjectCentralSubSpec { + offset: [f32; 3], // Should be relative to initial origin + central: VoxSimple, +} + make_vox_spec!( object::Body, - struct ObjectSpec {}, - |FigureKey { body, .. }, _spec| { + struct ObjectSpec { + central: ObjectCentralSpec = "voxygen.voxel.object_manifest", + }, + |FigureKey { body, .. }, spec| { [ - Some(mesh_object(body)), + Some(spec.central.asset.mesh_bone0( + body, + )), None, None, None, @@ -3769,97 +3787,17 @@ make_vox_spec!( }, ); -fn mesh_object(obj: &object::Body) -> BoneMeshes { - use object::Body; +impl ObjectCentralSpec { + fn mesh_bone0(&self, obj: &object::Body) -> BoneMeshes { + let spec = match self.0.get(&obj) { + Some(spec) => spec, + None => { + error!("No specification exists for {:?}", obj); + return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5)); + }, + }; + let central = graceful_load_segment(&spec.bone0.central.0); - let (name, offset) = match obj { - Body::Arrow => ( - "weapon.projectile.simple-arrow", - Vec3::new(-0.5, -6.0, -1.5), - ), - Body::Bomb => ("object.bomb", Vec3::new(-5.5, -5.5, 0.0)), - Body::FireworkBlue => ( - "weapon.projectile.fireworks_blue-0", - Vec3::new(0.0, 0.0, 0.0), - ), - Body::FireworkGreen => ( - "weapon.projectile.fireworks_green-0", - Vec3::new(0.0, 0.0, 0.0), - ), - Body::FireworkPurple => ( - "weapon.projectile.fireworks_purple-0", - Vec3::new(0.0, 0.0, 0.0), - ), - Body::FireworkRed => ( - "weapon.projectile.fireworks_red-0", - Vec3::new(0.0, 0.0, 0.0), - ), - Body::FireworkYellow => ( - "weapon.projectile.fireworks_yellow-0", - Vec3::new(0.0, 0.0, 0.0), - ), - Body::Scarecrow => ("object.scarecrow", Vec3::new(-9.5, -4.0, 0.0)), - Body::Cauldron => ("object.cauldron", Vec3::new(-10.0, -10.0, 0.0)), - Body::ChestVines => ("object.chest_vines", Vec3::new(-7.5, -6.0, 0.0)), - Body::Chest => ("object.chest", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestDark => ("object.chest_dark", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestDemon => ("object.chest_demon", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestGold => ("object.chest_gold", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestLight => ("object.chest_light", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestOpen => ("object.chest_open", Vec3::new(-7.5, -6.0, 0.0)), - Body::ChestSkull => ("object.chest_skull", Vec3::new(-7.5, -6.0, 0.0)), - Body::Pumpkin => ("object.pumpkin", Vec3::new(-5.5, -4.0, 0.0)), - Body::Pumpkin2 => ("object.pumpkin_2", Vec3::new(-5.0, -4.0, 0.0)), - Body::Pumpkin3 => ("object.pumpkin_3", Vec3::new(-5.0, -4.0, 0.0)), - Body::Pumpkin4 => ("object.pumpkin_4", Vec3::new(-5.0, -4.0, 0.0)), - Body::Pumpkin5 => ("object.pumpkin_5", Vec3::new(-4.0, -5.0, 0.0)), - Body::Campfire => ("object.campfire", Vec3::new(-9.0, -10.0, 0.0)), - Body::CampfireLit => ("object.campfire_lit", Vec3::new(-9.0, -10.0, 0.0)), - Body::LanternGround => ("object.lantern_ground", Vec3::new(-3.5, -3.5, 0.0)), - Body::LanternGroundOpen => ("object.lantern_ground_open", Vec3::new(-3.5, -3.5, 0.0)), - Body::LanternStanding => ("object.lantern_standing", Vec3::new(-7.5, -3.5, 0.0)), - Body::LanternStanding2 => ("object.lantern_standing_2", Vec3::new(-11.5, -3.5, 0.0)), - Body::PotionRed => ("object.potion_red", Vec3::new(-2.0, -2.0, 0.0)), - Body::PotionBlue => ("object.potion_blue", Vec3::new(-2.0, -2.0, 0.0)), - Body::PotionGreen => ("object.potion_green", Vec3::new(-2.0, -2.0, 0.0)), - Body::Crate => ("object.crate", Vec3::new(-7.0, -7.0, 0.0)), - Body::Tent => ("object.tent", Vec3::new(-18.5, -19.5, 0.0)), - Body::WindowSpooky => ("object.window_spooky", Vec3::new(-15.0, -1.5, -1.0)), - Body::DoorSpooky => ("object.door_spooky", Vec3::new(-15.0, -4.5, 0.0)), - Body::Table => ("object.table", Vec3::new(-12.0, -8.0, 0.0)), - Body::Table2 => ("object.table_2", Vec3::new(-8.0, -8.0, 0.0)), - Body::Table3 => ("object.table_3", Vec3::new(-10.0, -10.0, 0.0)), - Body::Drawer => ("object.drawer", Vec3::new(-11.0, -7.5, 0.0)), - Body::BedBlue => ("object.bed_human_blue", Vec3::new(-11.0, -15.0, 0.0)), - Body::Anvil => ("object.anvil", Vec3::new(-3.0, -7.0, 0.0)), - Body::Gravestone => ("object.gravestone", Vec3::new(-5.0, -2.0, 0.0)), - Body::Gravestone2 => ("object.gravestone_2", Vec3::new(-8.5, -3.0, 0.0)), - Body::Chair => ("object.chair", Vec3::new(-5.0, -4.5, 0.0)), - Body::Chair2 => ("object.chair_2", Vec3::new(-5.0, -4.5, 0.0)), - Body::Chair3 => ("object.chair_3", Vec3::new(-5.0, -4.5, 0.0)), - Body::Bench => ("object.bench", Vec3::new(-8.8, -5.0, 0.0)), - Body::Carpet => ("object.carpet", Vec3::new(-14.0, -14.0, -0.5)), - Body::Bedroll => ("object.bedroll", Vec3::new(-11.0, -19.5, -0.5)), - Body::CarpetHumanRound => ("object.carpet_human_round", Vec3::new(-14.0, -14.0, -0.5)), - Body::CarpetHumanSquare => ("object.carpet_human_square", Vec3::new(-13.5, -14.0, -0.5)), - Body::CarpetHumanSquare2 => ( - "object.carpet_human_square_2", - Vec3::new(-13.5, -14.0, -0.5), - ), - Body::CarpetHumanSquircle => ( - "object.carpet_human_squircle", - Vec3::new(-21.0, -21.0, -0.5), - ), - Body::Pouch => ("object.pouch", Vec3::new(-5.5, -4.5, 0.0)), - Body::CraftingBench => ("object.crafting_bench", Vec3::new(-9.5, -7.0, 0.0)), - Body::ArrowSnake => ("weapon.projectile.snake-arrow", Vec3::new(-1.5, -6.5, 0.0)), - Body::BoltFire => ("weapon.projectile.fire-bolt-0", Vec3::new(-3.0, -5.5, -3.0)), - Body::BoltFireBig => ("weapon.projectile.fire-bolt-1", Vec3::new(-6.0, -6.0, -6.0)), - Body::TrainingDummy => ("object.training_dummy", Vec3::new(-7.0, -5.0, 0.0)), - Body::MultiArrow => ("weapon.projectile.multi-arrow", Vec3::new(-4.0, -9.5, -5.0)), - Body::BoltNature => ("weapon.projectile.nature-bolt", Vec3::new(-6.0, -6.0, -6.0)), - Body::MeatDrop => ("object.meat_drop", Vec3::new(-3.5, -8.0, 0.0)), - Body::Steak => ("object.steak", Vec3::new(-3.5, -6.0, 0.0)), - }; - load_mesh(name, offset) + (central, Vec3::from(spec.bone0.offset)) + } }