Merge branch 'christof/multi_model_vox' into 'master'

Support multiple models in one vox file, e.g. for figures

See merge request veloren/veloren!3830
This commit is contained in:
Christof Petig 2023-04-06 07:09:20 +00:00
commit 49e734fa0b
44 changed files with 531 additions and 389 deletions

View File

@ -2769,32 +2769,32 @@
),
//Orichalcum Set
Simple("common.items.armor.mail.orichalcum.chest"): VoxTrans(
"voxel.armor.mail.orichalcum.chest",
(0.0, 1.0, 0.0), (-120.0, 210.0,15.0), 1.1,
"voxel.armor.mail.orichalcum",
(0.0, 1.0, 0.0), (-120.0, 210.0,15.0), 1.1, 0,
),
Simple("common.items.armor.mail.orichalcum.pants"): VoxTrans(
"voxel.armor.mail.orichalcum.pants",
(0.0, 1.0, 0.0), (-120.0, 210.0,15.0), 0.9,
"voxel.armor.mail.orichalcum",
(0.0, 1.0, 0.0), (-120.0, 210.0,15.0), 0.9, 1,
),
Simple("common.items.armor.mail.orichalcum.belt"): VoxTrans(
"voxel.armor.mail.orichalcum.belt",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9,
"voxel.armor.mail.orichalcum",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9, 2,
),
Simple("common.items.armor.mail.orichalcum.foot"): VoxTrans(
"voxel.armor.mail.orichalcum.foot",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9,
"voxel.armor.mail.orichalcum",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9, 3,
),
Simple("common.items.armor.mail.orichalcum.hand"): VoxTrans(
"voxel.armor.mail.orichalcum.hand",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9,
"voxel.armor.mail.orichalcum",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9, 4,
),
Simple("common.items.armor.mail.orichalcum.shoulder"): VoxTrans(
"voxel.armor.mail.orichalcum.shoulder",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 1.0,
"voxel.armor.mail.orichalcum",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 1.0, 5,
),
Simple("common.items.armor.mail.orichalcum.back"): VoxTrans(
"voxel.armor.mail.orichalcum.back",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9,
"voxel.armor.mail.orichalcum",
(0.0, 0.0, 0.0), (-120.0, 210.0,15.0), 0.9, 6,
),
//misc
Simple("common.items.armor.misc.pants.hunting"): VoxTrans(

BIN
assets/voxygen/voxel/armor/alchemist.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/armor/mail/orichalcum.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -137,7 +137,7 @@
color: None
),
"common.items.armor.mail.orichalcum.back": (
vox_spec: ("armor.mail.orichalcum.back", (-5.0, -4.5, -12.0)),
vox_spec: ("armor.mail.orichalcum", (-5.0, -4.5, -12.0), 6),
color: None
),
"common.items.armor.merchant.back": (

View File

@ -117,7 +117,7 @@
color: None
),
"common.items.armor.alchemist.belt":(
vox_spec: ("armor.alchemist.belt", (-4.0, -4.0, 2.5)),
vox_spec: ("armor.alchemist", (-4.0, -4.0, 2.5), 2),
color: None
),
"common.items.armor.blacksmith.belt":(
@ -173,7 +173,7 @@
color: None
),
"common.items.armor.mail.orichalcum.belt":(
vox_spec: ("armor.mail.orichalcum.belt", (-4.0, -3.5, 1.0)),
vox_spec: ("armor.mail.orichalcum", (-4.0, -3.5, 1.0), 2),
color: None
),
"common.items.armor.cardinal.belt": (

View File

@ -187,7 +187,7 @@
color: None
),
"common.items.armor.alchemist.chest": (
vox_spec: ("armor.alchemist.chest", (-7.0, -4.0, 2.0)),
vox_spec: ("armor.alchemist", (-7.0, -4.0, 2.0), 1),
color: None
),
"common.items.armor.blacksmith.chest": (
@ -243,7 +243,7 @@
color: None
),
"common.items.armor.mail.orichalcum.chest": (
vox_spec: ("armor.mail.orichalcum.chest", (-7.0, -4.0, 1.0)),
vox_spec: ("armor.mail.orichalcum", (-7.0, -4.0, 1.0), 0),
color: None
),
"common.items.armor.cardinal.chest": (

View File

@ -161,7 +161,7 @@
color: None
),
"common.items.armor.mail.orichalcum.foot": (
vox_spec: ("armor.mail.orichalcum.foot", (-2.5, -3.5, -2.0)),
vox_spec: ("armor.mail.orichalcum", (-2.5, -3.5, -2.0), 3),
color: None
),
"common.items.armor.cardinal.foot": (

View File

@ -382,11 +382,11 @@
),
"common.items.armor.mail.orichalcum.hand": (
left: (
vox_spec: ("armor.mail.orichalcum.hand", (-4.5, -2.0, -4.0)),
vox_spec: ("armor.mail.orichalcum", (-4.5, -2.0, -4.0), 4),
color: None
),
right: (
vox_spec: ("armor.mail.orichalcum.hand", (-1.5, -2.0, -4.0)),
vox_spec: ("armor.mail.orichalcum", (-1.5, -2.0, -4.0), 4),
color: None
)
),

View File

@ -325,51 +325,51 @@
),
// Alchemist Goggles
(Human, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-4.0, 0.0, 1.0)),
vox_spec: ("armor.alchemist", (2.0, 9.0, 1.0), 0),
color: None
),
(Human, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-4.0, 1.0, 1.0)),
vox_spec: ("armor.alchemist", (2.0, 10.0, 1.0), 0),
color: None
),
(Elf, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-3.0, 0.0, 1.0)),
vox_spec: ("armor.alchemist", (3.0, 9.0, 1.0), 0),
color: None
),
(Elf, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-3.0, -1.0, 1.0)),
vox_spec: ("armor.alchemist", (3.0, 8.0, 1.0), 0),
color: None
),
(Dwarf, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-5.0, 1.0, 1.0)),
vox_spec: ("armor.alchemist", (1.0, 10.0, 1.0), 0),
color: None
),
(Dwarf, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-5.0, 1.0, 1.0)),
vox_spec: ("armor.alchemist", (1.0, 10.0, 1.0), 0),
color: None
),
(Danari, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-2.0, 0.0, 3.0)),
vox_spec: ("armor.alchemist", (4.0, 9.0, 3.0), 0),
color: None
),
(Danari, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-2.0, 1.0, 3.0)),
vox_spec: ("armor.alchemist", (4.0, 10.0, 3.0), 0),
color: None
),
(Draugr, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-6.0, 0.0, 3.0)),
vox_spec: ("armor.alchemist", (0.0, 9.0, 3.0), 0),
color: None
),
(Draugr, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-6.0, 0.0, 2.0)),
vox_spec: ("armor.alchemist", (0.0, 9.0, 2.0), 0),
color: None
),
(Orc, Male, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-3.0, 2.0, 4.0)),
vox_spec: ("armor.alchemist", (3.0, 11.0, 4.0), 0),
color: None
),
(Orc, Female, "common.items.armor.alchemist.hat"): (
vox_spec: ("armor.alchemist.hat", (-3.0, -1.0, 1.0)),
vox_spec: ("armor.alchemist", (3.0, 8.0, 1.0), 0),
color: None
),
// Chef hat

View File

@ -145,7 +145,7 @@
color: None
),
"common.items.armor.alchemist.pants": (
vox_spec: ("armor.alchemist.pants", (-5.0, -4.0, 0.5)),
vox_spec: ("armor.alchemist", (-5.0, -4.0, 0.5), 3),
color: None
),
"common.items.armor.blacksmith.pants": (
@ -201,7 +201,7 @@
color: None
),
"common.items.armor.mail.orichalcum.pants": (
vox_spec: ("armor.mail.orichalcum.pants", (-6.0, -4.0, 0.5)),
vox_spec: ("armor.mail.orichalcum", (-6.0, -4.0, 0.5), 1),
color: None
),
"common.items.armor.cardinal.pants": (

View File

@ -453,11 +453,11 @@
),
"common.items.armor.mail.orichalcum.shoulder": (
left: (
vox_spec: ("armor.mail.orichalcum.shoulder", (-7.5, -3.0 , -2.0)),
vox_spec: ("armor.mail.orichalcum", (-7.5, -3.0 , -2.0), 5),
color: None
),
right: (
vox_spec: ("armor.mail.orichalcum.shoulder", (-1.5, -3.0, -2.0)),
vox_spec: ("armor.mail.orichalcum", (-1.5, -3.0, -2.0), 5),
color: None
)
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/npc/llama/male/llama.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1922,61 +1922,73 @@
(Llama, Male): (
head: (
offset: (-3.0, -2.0, -3.5),
central: ("npc.llama.male.head"),
central: ("npc.llama.male.llama"),
),
neck: (
offset: (-3.0, -4.5, -9.5),
central: ("npc.llama.male.neck"),
central: ("npc.llama.male.llama"),
model_index: 1,
),
jaw: (
offset: (-2.0, 0.0, -2.0),
central: ("npc.llama.male.jaw"),
central: ("npc.llama.male.llama"),
model_index: 2,
),
torso_front: (
offset: (-6.0, -9.0, -6.0),
central: ("npc.llama.male.torso_front"),
central: ("npc.llama.male.llama"),
model_index: 3,
),
torso_back: (
offset: (-5.0, -12.0, -5.0),
central: ("npc.llama.male.torso_back"),
central: ("npc.llama.male.llama"),
model_index: 4,
),
ears: (
offset: (-4.0, -1.0, 0.0),
central: ("npc.llama.male.ears"),
central: ("npc.llama.male.llama"),
model_index: 5,
),
tail: (
offset: (-2.0, -5.0, -7.0),
central: ("npc.llama.male.tail"),
central: ("npc.llama.male.llama"),
model_index: 6,
),
),
(Llama, Female): (
head: (
offset: (-3.0, -2.0, -3.5),
central: ("npc.llama.male.head"),
central: ("npc.llama.male.llama"),
),
neck: (
offset: (-3.0, -4.5, -9.5),
central: ("npc.llama.male.neck"),
central: ("npc.llama.male.llama"),
model_index: 1,
),
jaw: (
offset: (-2.0, 0.0, -2.0),
central: ("npc.llama.male.jaw"),
central: ("npc.llama.male.llama"),
model_index: 2,
),
torso_front: (
offset: (-6.0, -9.0, -6.0),
central: ("npc.llama.male.torso_front"),
central: ("npc.llama.male.llama"),
model_index: 3,
),
torso_back: (
offset: (-5.0, -12.0, -5.0),
central: ("npc.llama.male.torso_back"),
central: ("npc.llama.male.llama"),
model_index: 4,
),
ears: (
offset: (-4.0, -1.0, 0.0),
central: ("npc.llama.male.ears"),
central: ("npc.llama.male.llama"),
model_index: 5,
),
tail: (
offset: (-2.0, -5.0, -7.0),
central: ("npc.llama.male.tail"),
central: ("npc.llama.male.llama"),
model_index: 6,
),
),
(Alpaca, Male): (

View File

@ -2178,69 +2178,85 @@
(Llama, Male): (
leg_fl: (
offset: (-2.0, -2.5, -6.0),
lateral: ("npc.llama.male.leg_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 7,
),
leg_fr: (
offset: (-2.0, -2.5, -6.0),
lateral: ("npc.llama.male.leg_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 7,
),
leg_bl: (
offset: (-2.0, -3.0, -5.0),
lateral: ("npc.llama.male.leg_br"),
lateral: ("npc.llama.male.llama"),
model_index: 8,
),
leg_br: (
offset: (-2.0, -3.0, -5.0),
lateral: ("npc.llama.male.leg_br"),
lateral: ("npc.llama.male.llama"),
model_index: 8,
),
foot_fl: (
offset: (-1.5, -2.0, -8.0),
lateral: ("npc.llama.male.foot_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 9,
),
foot_fr: (
offset: (-1.5, -2.0, -8.0),
lateral: ("npc.llama.male.foot_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 9,
),
foot_bl: (
offset: (-1.5, -2.5, -9.0),
lateral: ("npc.llama.male.foot_br"),
lateral: ("npc.llama.male.llama"),
model_index: 10,
),
foot_br: (
offset: (-1.5, -2.5, -9.0),
lateral: ("npc.llama.male.foot_br"),
lateral: ("npc.llama.male.llama"),
model_index: 10,
),
),
(Llama, Female): (
leg_fl: (
offset: (-2.0, -2.5, -6.0),
lateral: ("npc.llama.male.leg_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 7,
),
leg_fr: (
offset: (-2.0, -2.5, -6.0),
lateral: ("npc.llama.male.leg_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 7,
),
leg_bl: (
offset: (-2.0, -3.0, -5.0),
lateral: ("npc.llama.male.leg_br"),
lateral: ("npc.llama.male.llama"),
model_index: 8,
),
leg_br: (
offset: (-2.0, -3.0, -5.0),
lateral: ("npc.llama.male.leg_br"),
lateral: ("npc.llama.male.llama"),
model_index: 8,
),
foot_fl: (
offset: (-1.5, -2.0, -8.0),
lateral: ("npc.llama.male.foot_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 9,
),
foot_fr: (
offset: (-1.5, -2.0, -8.0),
lateral: ("npc.llama.male.foot_fr"),
lateral: ("npc.llama.male.llama"),
model_index: 9,
),
foot_bl: (
offset: (-1.5, -2.5, -9.0),
lateral: ("npc.llama.male.foot_br"),
lateral: ("npc.llama.male.llama"),
model_index: 10,
),
foot_br: (
offset: (-1.5, -2.5, -9.0),
lateral: ("npc.llama.male.foot_br"),
lateral: ("npc.llama.male.llama"),
model_index: 10,
),
),
(Alpaca, Male): (

View File

@ -175,6 +175,8 @@ pub mod figuredata {
pub offset: [f32; 3],
pub phys_offset: [f32; 3],
pub central: VoxSimple,
#[serde(default)]
pub model_index: u32,
}
/// manual instead of through `make_vox_spec!` so that it can be in `common`
@ -220,7 +222,11 @@ pub mod figuredata {
// need to load them in the server and sync them as an ECS resource.
let vox =
cache.load::<DotVoxAsset>(&["common.voxel.", &bone.central.0].concat())?;
let dyna = Dyna::<Cell, (), ColumnAccess>::from_vox(&vox.read().0, false);
let dyna = Dyna::<Cell, (), ColumnAccess>::from_vox(
&vox.read().0,
false,
bone.model_index as usize,
);
let dyna = dyna.map_into(|cell| {
if let Some(rgb) = cell.get_color() {
Block::new(BlockKind::Misc, rgb)

View File

@ -20,23 +20,23 @@ use vek::*;
/// Figures are used to represent things like characters, NPCs, mobs, etc.
pub type Segment = Dyna<Cell, ()>;
impl From<&DotVoxData> for Segment {
fn from(dot_vox_data: &DotVoxData) -> Self { Segment::from_vox(dot_vox_data, false) }
}
impl Segment {
/// Take a list of voxel data, offsets, and x-mirror flags, and assembled
/// them into a combined segment
pub fn from_voxes(data: &[(&DotVoxData, Vec3<i32>, bool)]) -> (Self, Vec3<i32>) {
let mut union = DynaUnionizer::new();
for (datum, offset, xmirror) in data.iter() {
union = union.add(Segment::from_vox(datum, *xmirror), *offset);
union = union.add(Segment::from_vox(datum, *xmirror, 0), *offset);
}
union.unify()
}
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool) -> Self {
if let Some(model) = dot_vox_data.models.get(0) {
pub fn from_vox_model_index(dot_vox_data: &DotVoxData, model_index: usize) -> Self {
Self::from_vox(dot_vox_data, false, model_index)
}
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool, model_index: usize) -> Self {
if let Some(model) = dot_vox_data.models.get(model_index) {
let palette = dot_vox_data
.palette
.iter()
@ -202,8 +202,12 @@ impl MatSegment {
})
}
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool) -> Self {
if let Some(model) = dot_vox_data.models.get(0) {
pub fn from_vox_model_index(dot_vox_data: &DotVoxData, model_index: usize) -> Self {
Self::from_vox(dot_vox_data, false, model_index)
}
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool, model_index: usize) -> Self {
if let Some(model) = dot_vox_data.models.get(model_index) {
let palette = dot_vox_data
.palette
.iter()
@ -262,7 +266,3 @@ impl MatSegment {
}
}
}
impl From<&DotVoxData> for MatSegment {
fn from(dot_vox_data: &DotVoxData) -> Self { Self::from_vox(dot_vox_data, false) }
}

View File

@ -20,23 +20,28 @@ pub fn main() {
let manifest = ItemImagesSpec::load_expect("voxygen.item_image_manifest");
for (_, spec) in manifest.read().0.iter() {
match spec {
ImageSpec::Vox(specifier) => voxel_to_png(&specifier, Transform::default(), args.scale),
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom) => voxel_to_png(
&specifier,
Transform {
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
.rotated_z(rot_z * std::f32::consts::PI / 180.0),
offset: Vec3::from(*offset),
/* FIXME: This is a dirty workaround to not cut off the edges of some objects
* like ./img-export/weapon/component/axe/poleaxe/bronze.vox
* more details here: https://gitlab.com/veloren/veloren/-/merge_requests/3494#note_1205030803 */
zoom: *zoom * 0.8,
orth: true,
stretch: false,
},
args.scale,
),
ImageSpec::Vox(specifier, model_index) => {
voxel_to_png(&specifier, Transform::default(), args.scale, model_index)
},
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom, model_index) => {
voxel_to_png(
&specifier,
Transform {
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
.rotated_z(rot_z * std::f32::consts::PI / 180.0),
offset: Vec3::from(*offset),
/* FIXME: This is a dirty workaround to not cut off the edges of some
* objects like ./img-export/weapon/component/
* axe/poleaxe/bronze.vox more details here: https://gitlab.com/veloren/veloren/-/merge_requests/3494#note_1205030803 */
zoom: *zoom * 0.8,
orth: true,
stretch: false,
},
args.scale,
model_index,
)
},
ImageSpec::Png(specifier) => {
println!("Skip png image {}", specifier);
continue;
@ -45,7 +50,7 @@ pub fn main() {
}
}
fn voxel_to_png(specifier: &String, transform: Transform, scale: u32) {
fn voxel_to_png(specifier: &String, transform: Transform, scale: u32, model_index: u32) {
let voxel = match DotVoxAsset::load(&format!("voxygen.{}", specifier)) {
Ok(dot_vox) => dot_vox,
Err(err) => {
@ -56,7 +61,7 @@ fn voxel_to_png(specifier: &String, transform: Transform, scale: u32) {
let dot_vox_data = &voxel.read().0;
let model_size = dot_vox_data
.models
.get(0)
.get(model_index)
.expect("Error getting model from voxel")
.size;
let ori_mat = Mat4::from(transform.ori);

View File

@ -20,35 +20,37 @@ pub fn animate_by_pulse(ids: &[Id], pulse: f32) -> Id {
#[derive(Serialize, Deserialize)]
pub enum ImageSpec {
Png(String),
Vox(String),
// (specifier, offset, (axis, 2 * angle / pi), zoom)
VoxTrans(String, [f32; 3], [f32; 3], f32),
Vox(String, #[serde(default)] u32),
// (specifier, offset, (axis, 2 * angle / pi), zoom, model_index)
VoxTrans(String, [f32; 3], [f32; 3], f32, #[serde(default)] u32),
}
impl ImageSpec {
fn create_graphic(&self) -> Graphic {
match self {
ImageSpec::Png(specifier) => Graphic::Image(graceful_load_img(specifier), None),
ImageSpec::Vox(specifier) => Graphic::Voxel(
graceful_load_segment_no_skin(specifier),
ImageSpec::Vox(specifier, model_index) => Graphic::Voxel(
graceful_load_segment_no_skin(specifier, *model_index),
Transform {
stretch: false,
..Default::default()
},
SampleStrat::None,
),
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom) => Graphic::Voxel(
graceful_load_segment_no_skin(specifier),
Transform {
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
.rotated_z(rot_z * std::f32::consts::PI / 180.0),
offset: Vec3::from(*offset),
zoom: *zoom,
orth: true, // TODO: Is this what we want here? @Pfau
stretch: false,
},
SampleStrat::None,
),
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom, model_index) => {
Graphic::Voxel(
graceful_load_segment_no_skin(specifier, *model_index),
Transform {
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
.rotated_z(rot_z * std::f32::consts::PI / 180.0),
offset: Vec3::from(*offset),
zoom: *zoom,
orth: true, // TODO: Is this what we want here? @Pfau
stretch: false,
},
SampleStrat::None,
)
},
}
}
}
@ -163,9 +165,12 @@ fn graceful_load_img(specifier: &str) -> Arc<DynamicImage> {
handle.read().to_image()
}
fn graceful_load_segment_no_skin(specifier: &str) -> Arc<Segment> {
fn graceful_load_segment_no_skin(specifier: &str, model_index: u32) -> Arc<Segment> {
use common::figure::{mat_cell::MatCell, MatSegment};
let mat_seg = MatSegment::from(&graceful_load_vox(specifier).read().0);
let mat_seg = MatSegment::from_vox_model_index(
&graceful_load_vox(specifier).read().0,
model_index as usize,
);
let seg = mat_seg
.map(|mat_cell| match mat_cell {
MatCell::None => None,

File diff suppressed because it is too large Load Diff

View File

@ -1977,7 +1977,7 @@ fn default_cache(renderer: &mut Renderer) -> HashMap<&'static str, Model<Particl
let max_size = Vec2::from(u16::try_from(max_texture_size).unwrap_or(u16::MAX));
let mut greedy = GreedyMesh::new(max_size, crate::mesh::greedy::general_config());
let segment = Segment::from(&vox.read().0);
let segment = Segment::from_vox_model_index(&vox.read().0, 0);
let segment_size = segment.size();
let mut mesh = generate_mesh_base_vol_particle(segment, &mut greedy).0;
// Center particle vertices around origin

View File

@ -571,7 +571,8 @@ impl SpriteRenderContext {
// Mesh generation exclusively acts using side effects; it
// has no interesting return value, but updates the mesh.
generate_mesh_base_vol_sprite(
Segment::from(&model.read().0).scaled_by(lod_scale),
Segment::from_vox_model_index(&model.read().0, 0)
.scaled_by(lod_scale),
(greedy, sprite_mesh, false),
offset.map(|e: f32| e.floor()) * lod_scale,
);

View File

@ -37,7 +37,7 @@ pub enum VoxelPixArtGraphic {}
fn load_segment(specifier: &str) -> Result<Arc<Segment>, Error> {
let dot_vox = DotVoxAsset::load(specifier)?;
let seg = Segment::from(&dot_vox.read().0);
let seg = Segment::from_vox_model_index(&dot_vox.read().0, 0);
Ok(Arc::new(seg))
}