mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
switch to new matcell variant
This commit is contained in:
parent
97a3c1e713
commit
a05c1ea4c5
@ -1,16 +1,6 @@
|
||||
EntityConfig (
|
||||
name: Name("Pirate"),
|
||||
body: Exact(Humanoid(Body(
|
||||
species: Human,
|
||||
body_type: Female,
|
||||
hair_style: 2,
|
||||
beard: 0,
|
||||
eyes: 0,
|
||||
accessory: 0,
|
||||
hair_color: 12,
|
||||
skin: 8,
|
||||
eye_color: 3,
|
||||
))),
|
||||
body: RandomWith("humanoid"),
|
||||
alignment: Alignment(Enemy),
|
||||
|
||||
loot: LootTable("common.loot_tables.creature.biped_large.saurok"),
|
||||
|
@ -1,16 +1,6 @@
|
||||
EntityConfig (
|
||||
name: Name("Witch"),
|
||||
body: Exact(Humanoid(Body(
|
||||
species: Human,
|
||||
body_type: Female,
|
||||
hair_style: 15,
|
||||
beard: 0,
|
||||
eyes: 0,
|
||||
accessory: 0,
|
||||
hair_color: 12,
|
||||
skin: 0,
|
||||
eye_color: 1,
|
||||
))),
|
||||
body: RandomWith("humanoid"),
|
||||
alignment: Alignment(Enemy),
|
||||
|
||||
loot: LootTable("common.loot_tables.spots.witch"),
|
||||
|
@ -5,6 +5,7 @@
|
||||
Armor(Hands): Item("common.items.armor.hide.rawhide.hand"),
|
||||
Armor(Legs): Item("common.items.armor.hide.rawhide.pants"),
|
||||
Armor(Feet): Item("common.items.armor.hide.rawhide.foot"),
|
||||
Armor(Head): Item("common.items.armor.misc.head.bandana.thief"),
|
||||
|
||||
Lantern: Choice([
|
||||
(1.0, Some(Item("common.items.lantern.black_0"))),
|
||||
|
@ -5,20 +5,19 @@ use vek::*;
|
||||
|
||||
const GLOWY: u8 = 1 << 1;
|
||||
const SHINY: u8 = 1 << 2;
|
||||
const HOLLOW: u8 = 1 << 3;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CellData {
|
||||
pub col: Rgb<u8>,
|
||||
pub attr: NonZeroU8, // 1 = glowy, 2 = shiny, 3 = hollow
|
||||
pub attr: NonZeroU8, // 1 = glowy, 2 = shiny
|
||||
}
|
||||
|
||||
impl CellData {
|
||||
pub(super) fn new(col: Rgb<u8>, glowy: bool, shiny: bool, hollow: bool) -> Self {
|
||||
pub(super) fn new(col: Rgb<u8>, glowy: bool, shiny: bool) -> Self {
|
||||
CellData {
|
||||
col,
|
||||
attr: NonZeroU8::new(
|
||||
1 + glowy as u8 * GLOWY + shiny as u8 * SHINY + hollow as u8 * HOLLOW,
|
||||
1 + glowy as u8 * GLOWY + shiny as u8 * SHINY,
|
||||
)
|
||||
.unwrap(),
|
||||
}
|
||||
@ -26,7 +25,7 @@ impl CellData {
|
||||
}
|
||||
|
||||
impl Default for CellData {
|
||||
fn default() -> Self { Self::new(Rgb::broadcast(255), false, false, false) }
|
||||
fn default() -> Self { Self::new(Rgb::broadcast(255), false, false) }
|
||||
}
|
||||
|
||||
/// A type representing a single voxel in a figure.
|
||||
@ -37,8 +36,8 @@ pub enum Cell {
|
||||
}
|
||||
|
||||
impl Cell {
|
||||
pub fn new(col: Rgb<u8>, glowy: bool, shiny: bool, hollow: bool) -> Self {
|
||||
Cell::Filled(CellData::new(col, glowy, shiny, hollow))
|
||||
pub fn new(col: Rgb<u8>, glowy: bool, shiny: bool) -> Self {
|
||||
Cell::Filled(CellData::new(col, glowy, shiny))
|
||||
}
|
||||
|
||||
pub fn get_color(&self) -> Option<Rgb<u8>> {
|
||||
@ -61,13 +60,6 @@ impl Cell {
|
||||
Cell::Empty => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_hollow(&self) -> bool {
|
||||
match self {
|
||||
Cell::Filled(data) => data.attr.get() & HOLLOW != 0,
|
||||
Cell::Empty => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Vox for Cell {
|
||||
|
@ -20,6 +20,7 @@ pub enum MatCell {
|
||||
None,
|
||||
Mat(Material),
|
||||
Normal(CellData),
|
||||
Hollow,
|
||||
}
|
||||
|
||||
impl Vox for MatCell {
|
||||
|
@ -67,7 +67,6 @@ impl Segment {
|
||||
color,
|
||||
(13..16).contains(&voxel.i), // Glowy
|
||||
(8..13).contains(&voxel.i), // Shiny
|
||||
voxel.i == 16, // Hollow
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
@ -99,7 +98,6 @@ impl Segment {
|
||||
transform(rgb),
|
||||
cell.is_glowy(),
|
||||
cell.is_shiny(),
|
||||
cell.is_hollow(),
|
||||
)
|
||||
})
|
||||
})
|
||||
@ -166,8 +164,9 @@ impl MatSegment {
|
||||
for (pos, vox) in self.full_vol_iter() {
|
||||
let data = match vox {
|
||||
MatCell::None => continue,
|
||||
MatCell::Mat(mat) => CellData::new(map(*mat), false, false, false),
|
||||
MatCell::Mat(mat) => CellData::new(map(*mat), false, false),
|
||||
MatCell::Normal(data) => *data,
|
||||
MatCell::Hollow => continue,
|
||||
};
|
||||
vol.set(pos, Cell::Filled(data)).unwrap();
|
||||
}
|
||||
@ -220,6 +219,7 @@ impl MatSegment {
|
||||
4 => MatCell::Mat(Material::SkinDark),
|
||||
5 => MatCell::Mat(Material::SkinLight),
|
||||
7 => MatCell::Mat(Material::EyeWhite),
|
||||
16 => MatCell::Hollow,
|
||||
//6 => MatCell::Mat(Material::Clothing),
|
||||
index => {
|
||||
let color = palette
|
||||
@ -230,7 +230,6 @@ impl MatSegment {
|
||||
color,
|
||||
(13..16).contains(&index),
|
||||
(8..13).contains(&index),
|
||||
index == 16, // Hollow
|
||||
))
|
||||
},
|
||||
};
|
||||
|
38
frame-trace_1634705763589.json
Normal file
38
frame-trace_1634705763589.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"traceEvents": [
|
||||
{ "pid":1, "tid":1, "ts":1634705763488162, "dur":5681.276321411133, "ph":"X", "name":"frame" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488195, "dur":661.1347198486328, "ph":"X", "name":"shadow_pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488195.3, "dur":643.0149078369141, "ph":"X", "name":"direcred_terrain_shadows" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488839.3, "dur":15.497207641601563, "ph":"X", "name":"direcred_figure_shadows" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488858.8, "dur":690.460205078125, "ph":"X", "name":"point shadows" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488867, "dur":43.15376281738281, "ph":"X", "name":"point shadow face-0 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488917.5, "dur":45.7763671875, "ph":"X", "name":"point shadow face-1 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763488970.8, "dur":51.25999450683594, "ph":"X", "name":"point shadow face-2 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489028.8, "dur":51.25999450683594, "ph":"X", "name":"point shadow face-3 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489088.5, "dur":42.438507080078125, "ph":"X", "name":"point shadow face-4 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489501.8, "dur":45.06111145019531, "ph":"X", "name":"point shadow face-5 pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489573, "dur":3035.5453491210938, "ph":"X", "name":"first_pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489573.8, "dur":20.503997802734375, "ph":"X", "name":"figures" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763489594.3, "dur":1816.2727355957031, "ph":"X", "name":"terrain" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763491410.8, "dur":41.00799560546875, "ph":"X", "name":"figures" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763491451.8, "dur":1039.9818420410156, "ph":"X", "name":"lod_terrain" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492492, "dur":3.337860107421875, "ph":"X", "name":"skybox" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492495.8, "dur":96.08268737792969, "ph":"X", "name":"sprites" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492592.3, "dur":0, "ph":"X", "name":"fluid" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492593.5, "dur":13.113021850585938, "ph":"X", "name":"particles" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492606.8, "dur":1.430511474609375, "ph":"X", "name":"debug" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763492621, "dur":546.4553833007813, "ph":"X", "name":"second_pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493169.8, "dur":466.1083221435547, "ph":"X", "name":"bloom" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493174, "dur":41.00799560546875, "ph":"X", "name":"downsample filtered 1" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493220.5, "dur":12.874603271484375, "ph":"X", "name":"downsample 2" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493237.5, "dur":4.0531158447265625, "ph":"X", "name":"downsample 3" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493247.3, "dur":2.6226043701171875, "ph":"X", "name":"downsample 4" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493255.3, "dur":5.0067901611328125, "ph":"X", "name":"upsample 1" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493438.3, "dur":11.205673217773438, "ph":"X", "name":"upsample 2" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493456.3, "dur":31.948089599609375, "ph":"X", "name":"upsample 3" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493501.8, "dur":131.13021850585938, "ph":"X", "name":"upsample 4" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493646.8, "dur":193.11904907226563, "ph":"X", "name":"third_pass" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493647.3, "dur":181.1981201171875, "ph":"X", "name":"postprocess" },
|
||||
{ "pid":1, "tid":1, "ts":1634705763493829.5, "dur":9.5367431640625, "ph":"X", "name":"ui" }
|
||||
]
|
||||
}
|
@ -211,6 +211,7 @@ fn graceful_load_segment_no_skin(specifier: &str) -> Arc<Segment> {
|
||||
let seg = mat_seg
|
||||
.map(|mat_cell| match mat_cell {
|
||||
MatCell::None => None,
|
||||
MatCell::Hollow => None,
|
||||
MatCell::Mat(_) => Some(MatCell::None),
|
||||
MatCell::Normal(_) => None,
|
||||
})
|
||||
|
@ -318,7 +318,7 @@ impl HumHeadSpec {
|
||||
.maybe_add(beard)
|
||||
.maybe_add(accessory)
|
||||
.maybe_add(helmet)
|
||||
.unify_with(|v| if v.is_hollow() { Cell::empty() } else { v });
|
||||
.unify();
|
||||
(
|
||||
head,
|
||||
Vec3::from(spec.offset) + origin_offset.map(|e| e as f32 * -1.0),
|
||||
|
Loading…
Reference in New Issue
Block a user