Merge branch 'timo-cleanup' into 'master'

Implement specifier syntax and cleanup

See merge request veloren/veloren!413
This commit is contained in:
Marcel 2019-08-06 06:52:24 +00:00
commit 86be3fccfc
14 changed files with 493 additions and 516 deletions

View File

@ -1,3 +1,5 @@
//! Load assets (images or voxel data) from files
use dot_vox::DotVoxData;
use image::DynamicImage;
use lazy_static::lazy_static;
@ -6,12 +8,13 @@ use std::{
any::Any,
collections::HashMap,
env,
fs::{read_dir, read_link, File, ReadDir},
fs::{self, read_link, File, ReadDir},
io::{BufReader, Read},
path::{Path, PathBuf},
sync::{Arc, RwLock},
};
/// The error returned by asset loading functions
#[derive(Debug, Clone)]
pub enum Error {
/// An asset of a different type has already been loaded with this specifier.
@ -33,19 +36,22 @@ impl From<std::io::Error> for Error {
}
lazy_static! {
/// The HashMap where all loaded assets are stored in.
static ref ASSETS: RwLock<HashMap<String, Arc<dyn Any + 'static + Sync + Send>>> =
RwLock::new(HashMap::new());
}
/// Function used to load assets. Permits manipulating the loaded asset with a mapping function.
/// Loaded assets are cached in a global singleton hashmap.
// TODO: Remove this function. It's only used in world/ in a really ugly way.To do this properly
// assets should have all their necessary data in one file. A ron file could be used to combine
// voxel data with positioning data for example.
/// Function used to load assets from the filesystem or the cache. Permits manipulating the loaded asset with a mapping function.
/// Example usage:
/// ```no_run=
/// ```no_run
/// use veloren_common::{assets, terrain::Structure};
/// use vek::*;
///
/// let my_tree_structure = assets::load_map(
/// "world/tree/oak_green/1.vox",
/// "world.tree.oak_green.1",
/// |s: Structure| s.with_center(Vec3::new(15, 18, 14)),
/// ).unwrap();
/// ```
@ -54,10 +60,10 @@ pub fn load_map<A: Asset + 'static, F: FnOnce(A) -> A>(
f: F,
) -> Result<Arc<A>, Error> {
let mut assets_write = ASSETS.write().unwrap();
match assets_write.get(specifier) {
match assets_write.get(&(specifier.to_owned() + A::ENDINGS[0])) {
Some(asset) => Ok(Arc::clone(asset).downcast()?),
None => {
let asset = Arc::new(f(A::load(load_from_path(specifier)?)?));
let asset = Arc::new(f(A::parse(load_file(specifier, A::ENDINGS)?)?));
let clone = Arc::clone(&asset);
assets_write.insert(specifier.to_owned(), clone);
Ok(asset)
@ -65,8 +71,7 @@ pub fn load_map<A: Asset + 'static, F: FnOnce(A) -> A>(
}
}
/// Function used to load assets.
/// Loaded assets are cached in a global singleton hashmap.
/// Function used to load assets from the filesystem or the cache.
/// Example usage:
/// ```no_run
/// use image::DynamicImage;
@ -78,9 +83,7 @@ pub fn load<A: Asset + 'static>(specifier: &str) -> Result<Arc<A>, Error> {
load_map(specifier, |x| x)
}
/// Function used to load assets that will panic if the asset is not found.
/// Use this to load essential assets.
/// Loaded assets are cached in a global singleton hashmap.
/// Function used to load essential assets from the filesystem or the cache. It will panic if the asset is not found.
/// Example usage:
/// ```no_run
/// use image::DynamicImage;
@ -92,13 +95,17 @@ pub fn load_expect<A: Asset + 'static>(specifier: &str) -> Arc<A> {
load(specifier).unwrap_or_else(|_| panic!("Failed loading essential asset: {}", specifier))
}
/// Asset Trait
/// The Asset trait, which is implemented by all structures that have their data stored in the
/// filesystem.
pub trait Asset: Send + Sync + Sized {
fn load(buf_reader: BufReader<impl Read>) -> Result<Self, Error>;
const ENDINGS: &'static [&'static str];
/// Parse the input file and return the correct Asset.
fn parse(buf_reader: BufReader<File>) -> Result<Self, Error>;
}
impl Asset for DynamicImage {
fn load(mut buf_reader: BufReader<impl Read>) -> Result<Self, Error> {
const ENDINGS: &'static [&'static str] = &["png", "jpg"];
fn parse(mut buf_reader: BufReader<File>) -> Result<Self, Error> {
let mut buf = Vec::new();
buf_reader.read_to_end(&mut buf)?;
Ok(image::load_from_memory(&buf).unwrap())
@ -106,26 +113,29 @@ impl Asset for DynamicImage {
}
impl Asset for DotVoxData {
fn load(mut buf_reader: BufReader<impl Read>) -> Result<Self, Error> {
const ENDINGS: &'static [&'static str] = &["vox"];
fn parse(mut buf_reader: BufReader<File>) -> Result<Self, Error> {
let mut buf = Vec::new();
buf_reader.read_to_end(&mut buf)?;
Ok(dot_vox::load_bytes(&buf).unwrap())
}
}
// Read a JSON file
impl Asset for Value {
fn load(buf_reader: BufReader<impl Read>) -> Result<Self, Error> {
const ENDINGS: &'static [&'static str] = &["json"];
fn parse(buf_reader: BufReader<File>) -> Result<Self, Error> {
Ok(serde_json::from_reader(buf_reader).unwrap())
}
}
// TODO: System to load file from specifiers (e.g.: "core.ui.backgrounds.city").
fn assets_folder() -> PathBuf {
/// Function to find where the asset/ directory is.
fn assets_dir() -> PathBuf {
let mut paths = Vec::new();
// VELOREN_ASSETS environment variable
if let Ok(var) = std::env::var("VELOREN_ASSETS") {
paths.push(var.to_string().into());
paths.push(var.to_owned().into());
}
// Executable path
@ -156,53 +166,42 @@ fn assets_folder() -> PathBuf {
panic!(
"Asset directory not found. In attempting to find it, we searched:\n{})",
paths.iter().fold(String::new(), |mut a, path| {
a += path.to_str().unwrap_or("<invalid>");
a += &path.to_string_lossy();
a += "\n";
a
}),
);
}
// TODO: System to load file from specifiers (e.g.: "core.ui.backgrounds.city").
pub fn load_from_path(name: &str) -> Result<BufReader<File>, Error> {
debug!("Trying to access \"{}\"", name);
/// Converts a specifier like "core.backgrounds.city" to ".../veloren/assets/core/backgrounds/city".
fn unpack_specifier(specifier: &str) -> PathBuf {
let mut path = assets_dir();
path.push(specifier.replace(".", "/"));
path
}
let mut path = assets_folder();
path.push(name);
/// Loads a file based on the specifier and possible extensions
pub fn load_file(specifier: &str, endings: &[&str]) -> Result<BufReader<File>, Error> {
let mut path = unpack_specifier(specifier);
for ending in endings {
let mut path = path.clone();
path.set_extension(ending);
match File::open(path) {
Ok(file) => Ok(BufReader::new(file)),
Err(_) => Err(Error::NotFound(name.to_owned())),
debug!("Trying to access \"{:?}\"", path);
if let Ok(file) = File::open(path) {
return Ok(BufReader::new(file));
}
}
Err(Error::NotFound(path.to_string_lossy().into_owned()))
}
/// Read directory from `veloren/assets/*`
pub fn read_from_assets(dir_name: &str) -> Result<ReadDir, Error> {
let mut entry = assets_folder();
entry.push(dir_name);
match Path::new(&entry).exists() {
true => Ok(read_dir(entry).expect("`read_dir` failed.")),
false => Err(Error::NotFound(entry.to_str().unwrap().to_owned())),
}
}
/// Returns the cargo manifest directory when running the executable with cargo
/// or the directory in which the executable resides otherwise,
/// traversing symlinks if necessary.
pub fn application_root_dir() -> String {
match env::var("PROFILE") {
Ok(_) => String::from(env!("CARGO_MANIFEST_DIR")),
Err(_) => {
let mut path = env::current_exe().expect("Failed to find executable path.");
while let Ok(target) = read_link(path.clone()) {
path = target;
}
String::from(
path.parent()
.expect("Failed to get parent directory of the executable.")
.to_str()
.unwrap(),
)
}
pub fn read_dir(specifier: &str) -> Result<ReadDir, Error> {
let dir_name = unpack_specifier(specifier);
if dir_name.exists() {
Ok(fs::read_dir(dir_name).expect("`read_dir` failed."))
} else {
Err(Error::NotFound(dir_name.to_string_lossy().into_owned()))
}
}

View File

@ -5,6 +5,7 @@ use crate::{
volumes::dyna::{Dyna, DynaErr},
};
use dot_vox::DotVoxData;
use std::fs::File;
use std::io::{BufReader, Read};
use vek::*;
@ -72,8 +73,9 @@ impl ReadVol for Structure {
}
impl Asset for Structure {
fn load(buf_reader: BufReader<impl Read>) -> Result<Self, assets::Error> {
let dot_vox_data = DotVoxData::load(buf_reader)?;
const ENDINGS: &'static [&'static str] = &["vox"];
fn parse(buf_reader: BufReader<File>) -> Result<Self, assets::Error> {
let dot_vox_data = DotVoxData::parse(buf_reader)?;
if let Some(model) = dot_vox_data.models.get(0) {
let palette = dot_vox_data

View File

@ -1,5 +1,5 @@
use crate::settings::{AudioSettings, Settings};
use common::assets::{load_from_path, read_from_assets};
use common::assets::read_dir;
use crossbeam::{
atomic::AtomicCell,
channel::{unbounded, Sender},
@ -7,6 +7,8 @@ use crossbeam::{
sync::ShardedLock,
};
use rodio::{Decoder, Device, Sink};
use std::fs::File;
use std::io::BufReader;
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
@ -265,7 +267,7 @@ impl MonoEmitter {
// }
fn play_from(&mut self, path: &str) {
let bufreader = load_from_path(path).unwrap();
let bufreader = BufReader::new(File::open(path).unwrap());
let src = Decoder::new(bufreader).unwrap();
self.stream.append(src);
}
@ -350,12 +352,12 @@ pub(crate) fn get_default_device() -> String {
pub(crate) fn load_soundtracks(genre: &Genre) -> Vec<String> {
match *genre {
Genre::Bgm => {
let assets = read_from_assets("voxygen/audio/soundtrack/").unwrap();
let assets = read_dir("voxygen.audio.soundtrack").unwrap();
let soundtracks = assets
.filter_map(|entry| {
entry.ok().map(|f| {
let path = f.path();
(*path.into_os_string().to_string_lossy()).to_owned()
path.to_string_lossy().into_owned()
})
})
.collect::<Vec<String>>();
@ -363,7 +365,7 @@ pub(crate) fn load_soundtracks(genre: &Genre) -> Vec<String> {
soundtracks
}
Genre::Sfx => {
let assets = read_from_assets("voxygen/audio/soundtrack/").unwrap();
let assets = read_dir("voxygen.audio.soundtrack").unwrap();
let soundtracks = assets
//.filter_map(|entry| {
// entry.ok().and_then(|f| {

View File

@ -5,194 +5,196 @@ image_ids! {
<VoxelGraphic>
// Bag
bag_contents: "voxygen/element/frames/bag.vox",
inv_grid: "voxygen/element/frames/inv_grid.vox",
inv_slot: "voxygen/element/buttons/inv_slot.vox",
grid_inv: "voxygen/element/buttons/grid_inv.vox",
bag_top: "voxygen/element/bag/top.vox",
bag_mid: "voxygen/element/bag/mid.vox",
bag_bot: "voxygen/element/bag/bot.vox",
bag_contents: "voxygen.element.frames.bag",
inv_grid: "voxygen.element.frames.inv_grid",
inv_slot: "voxygen.element.buttons.inv_slot",
grid_inv: "voxygen.element.buttons.grid_inv",
bag_top: "voxygen.element.bag.top",
bag_mid: "voxygen.element.bag.mid",
bag_bot: "voxygen.element.bag.bot",
// Window Parts
window_3: "voxygen/element/frames/window_3.vox",
tab_bg: "voxygen/element/frames/tab_bg.vox",
tab_small_open: "voxygen/element/frames/tab_small_open.vox",
tab_small_closed: "voxygen/element/frames/tab_small_closed.vox",
window_3: "voxygen.element.frames.window_3",
tab_bg: "voxygen.element.frames.tab_bg",
tab_small_open: "voxygen.element.frames.tab_small_open",
tab_small_closed: "voxygen.element.frames.tab_small_closed",
// MiniMap
mmap_frame: "voxygen/element/frames/mmap.vox",
mmap_frame_closed: "voxygen/element/frames/mmap_closed.vox",
mmap_frame: "voxygen.element.frames.mmap",
mmap_frame_closed: "voxygen.element.frames.mmap_closed",
// Missing: Buff Frame Animation .gif ?! we could do animation in ui.maintain, or in shader?
window_frame: "voxygen/element/frames/window2.vox",
window_frame: "voxygen.element.frames.window2",
// Settings Window
settings_frame_r: "voxygen/element/frames/settings_r.vox",
settings_frame_l: "voxygen/element/frames/settings_l.vox",
settings_button: "voxygen/element/buttons/settings_button.vox",
settings_button_pressed: "voxygen/element/buttons/settings_button_pressed.vox",
settings_button_hover: "voxygen/element/buttons/settings_button_hover.vox",
settings_button_press: "voxygen/element/buttons/settings_button_press.vox",
check: "voxygen/element/buttons/check/no.vox",
check_mo: "voxygen/element/buttons/check/no_mo.vox",
check_press: "voxygen/element/buttons/check/press.vox",
check_checked: "voxygen/element/buttons/check/yes.vox",
check_checked_mo: "voxygen/element/buttons/check/yes_mo.vox",
slider: "voxygen/element/slider/track.vox",
slider_indicator: "voxygen/element/slider/indicator.vox",
esc_frame: "voxygen/element/frames/esc_menu.vox",
settings_frame_r: "voxygen.element.frames.settings_r",
settings_frame_l: "voxygen.element.frames.settings_l",
settings_button: "voxygen.element.buttons.settings_button",
settings_button_pressed: "voxygen.element.buttons.settings_button_pressed",
settings_button_hover: "voxygen.element.buttons.settings_button_hover",
settings_button_press: "voxygen.element.buttons.settings_button_press",
check: "voxygen.element.buttons.check.no",
check_mo: "voxygen.element.buttons.check.no_mo",
check_press: "voxygen.element.buttons.check.press",
check_checked: "voxygen.element.buttons.check.yes",
check_checked_mo: "voxygen.element.buttons.check.yes_mo",
slider: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
esc_frame: "voxygen.element.frames.esc_menu",
// Map Window
map_frame_l: "voxygen/element/frames/map_l.vox",
map_frame_r: "voxygen/element/frames/map_r.vox",
map_frame_bl: "voxygen/element/frames/map_bl.vox",
map_frame_br: "voxygen/element/frames/map_br.vox",
map_frame_l: "voxygen.element.frames.map_l",
map_frame_r: "voxygen.element.frames.map_r",
map_frame_bl: "voxygen.element.frames.map_bl",
map_frame_br: "voxygen.element.frames.map_br",
// Chat-Arrows
chat_arrow: "voxygen/element/buttons/arrow_down.vox",
chat_arrow_mo: "voxygen/element/buttons/arrow_down_hover.vox",
chat_arrow_press: "voxygen/element/buttons/arrow_down_press.vox",
chat_arrow: "voxygen.element.buttons.arrow_down",
chat_arrow_mo: "voxygen.element.buttons.arrow_down_hover",
chat_arrow_press: "voxygen.element.buttons.arrow_down_press",
// Crosshair
crosshair_inner: "voxygen/element/misc_bg/crosshair_inner.vox",
crosshair_inner: "voxygen.element.misc_bg.crosshair_inner",
////////////////////////////////////////////////////////////////////////
<VoxelMs9Graphic>
crosshair_outer_round: "voxygen/element/misc_bg/crosshair_outer_1.vox",
crosshair_outer_round_edges: "voxygen/element/misc_bg/crosshair_outer_2.vox",
crosshair_outer_edges: "voxygen/element/misc_bg/crosshair_outer_3.vox",
crosshair_outer_round: "voxygen.element.misc_bg.crosshair_outer_1",
crosshair_outer_round_edges: "voxygen.element.misc_bg.crosshair_outer_2",
crosshair_outer_edges: "voxygen.element.misc_bg.crosshair_outer_3",
crosshair_bg: "voxygen/element/misc_bg/crosshair_bg.vox",
crosshair_bg_hover: "voxygen/element/misc_bg/crosshair_bg_hover.vox",
crosshair_bg_press: "voxygen/element/misc_bg/crosshair_bg_press.vox",
crosshair_bg_pressed: "voxygen/element/misc_bg/crosshair_bg_pressed.vox",
crosshair_bg: "voxygen.element.misc_bg.crosshair_bg",
crosshair_bg_hover: "voxygen.element.misc_bg.crosshair_bg_hover",
crosshair_bg_press: "voxygen.element.misc_bg.crosshair_bg_press",
crosshair_bg_pressed: "voxygen.element.misc_bg.crosshair_bg_pressed",
// Buttons
mmap_closed: "voxygen/element/buttons/button_mmap_closed.vox",
mmap_closed_hover: "voxygen/element/buttons/button_mmap_closed_hover.vox",
mmap_closed_press: "voxygen/element/buttons/button_mmap_closed_press.vox",
mmap_open: "voxygen/element/buttons/button_mmap_open.vox",
mmap_open_hover: "voxygen/element/buttons/button_mmap_open_hover.vox",
mmap_open_press: "voxygen/element/buttons/button_mmap_open_press.vox",
mmap_closed: "voxygen.element.buttons.button_mmap_closed",
mmap_closed_hover: "voxygen.element.buttons.button_mmap_closed_hover",
mmap_closed_press: "voxygen.element.buttons.button_mmap_closed_press",
mmap_open: "voxygen.element.buttons.button_mmap_open",
mmap_open_hover: "voxygen.element.buttons.button_mmap_open_hover",
mmap_open_press: "voxygen.element.buttons.button_mmap_open_press",
// Grid
grid: "voxygen/element/buttons/grid.vox",
grid_hover: "voxygen/element/buttons/grid.vox",
grid_press: "voxygen/element/buttons/grid.vox",
grid: "voxygen.element.buttons.grid",
grid_hover: "voxygen.element.buttons.grid",
grid_press: "voxygen.element.buttons.grid",
settings: "voxygen/element/buttons/settings.vox",
settings_hover: "voxygen/element/buttons/settings_hover.vox",
settings_press: "voxygen/element/buttons/settings_press.vox",
settings: "voxygen.element.buttons.settings",
settings_hover: "voxygen.element.buttons.settings_hover",
settings_press: "voxygen.element.buttons.settings_press",
social_button: "voxygen/element/buttons/social.vox",
social_hover: "voxygen/element/buttons/social_hover.vox",
social_press: "voxygen/element/buttons/social_press.vox",
social_button: "voxygen.element.buttons.social",
social_hover: "voxygen.element.buttons.social_hover",
social_press: "voxygen.element.buttons.social_press",
map_button: "voxygen/element/buttons/map.vox",
map_hover: "voxygen/element/buttons/map_hover.vox",
map_press: "voxygen/element/buttons/map_press.vox",
map_button: "voxygen.element.buttons.map",
map_hover: "voxygen.element.buttons.map_hover",
map_press: "voxygen.element.buttons.map_press",
spellbook_button: "voxygen/element/buttons/spellbook.vox",
spellbook_hover: "voxygen/element/buttons/spellbook_hover.vox",
spellbook_press: "voxygen/element/buttons/spellbook_press.vox",
spellbook_button: "voxygen.element.buttons.spellbook",
spellbook_hover: "voxygen.element.buttons.spellbook_hover",
spellbook_press: "voxygen.element.buttons.spellbook_press",
character_button: "voxygen/element/buttons/character.vox",
character_hover: "voxygen/element/buttons/character_hover.vox",
character_press: "voxygen/element/buttons/character_press.vox",
character_button: "voxygen.element.buttons.character",
character_hover: "voxygen.element.buttons.character_hover",
character_press: "voxygen.element.buttons.character_press",
qlog_button: "voxygen/element/buttons/qlog.vox",
qlog_hover: "voxygen/element/buttons/qlog_hover.vox",
qlog_press: "voxygen/element/buttons/qlog_press.vox",
qlog_button: "voxygen.element.buttons.qlog",
qlog_hover: "voxygen.element.buttons.qlog_hover",
qlog_press: "voxygen.element.buttons.qlog_press",
// Charwindow
xp_charwindow: "voxygen/element/frames/xp_charwindow.vox",
divider: "voxygen/element/frames/divider_charwindow.vox",
head_bg: "voxygen/element/icons/head.vox",
shoulders_bg: "voxygen/element/icons/shoulders.vox",
hands_bg: "voxygen/element/icons/hands.vox",
belt_bg: "voxygen/element/icons/belt.vox",
legs_bg: "voxygen/element/icons/legs.vox",
feet_bg: "voxygen/element/icons/feet.vox",
ring_r_bg: "voxygen/element/icons/ring.vox",
ring_l_bg: "voxygen/element/icons/ring.vox",
tabard_bg: "voxygen/element/icons/tabard.vox",
chest_bg: "voxygen/element/icons/chest.vox",
back_bg: "voxygen/element/icons/back.vox",
gem_bg: "voxygen/element/icons/gem.vox",
necklace_bg: "voxygen/element/icons/necklace.vox",
mainhand_bg: "voxygen/element/icons/mainhand.vox",
offhand_bg: "voxygen/element/icons/offhand.vox",
xp_charwindow: "voxygen.element.frames.xp_charwindow",
divider: "voxygen.element.frames.divider_charwindow",
head_bg: "voxygen.element.icons.head",
shoulders_bg: "voxygen.element.icons.shoulders",
hands_bg: "voxygen.element.icons.hands",
belt_bg: "voxygen.element.icons.belt",
legs_bg: "voxygen.element.icons.legs",
feet_bg: "voxygen.element.icons.feet",
ring_r_bg: "voxygen.element.icons.ring",
ring_l_bg: "voxygen.element.icons.ring",
tabard_bg: "voxygen.element.icons.tabard",
chest_bg: "voxygen.element.icons.chest",
back_bg: "voxygen.element.icons.back",
gem_bg: "voxygen.element.icons.gem",
necklace_bg: "voxygen.element.icons.necklace",
mainhand_bg: "voxygen.element.icons.mainhand",
offhand_bg: "voxygen.element.icons.offhand",
// Close button
close_button: "voxygen/element/buttons/x.vox",
close_button_hover: "voxygen/element/buttons/x_hover.vox",
close_button_press: "voxygen/element/buttons/x_press.vox",
close_button: "voxygen.element.buttons.x",
close_button_hover: "voxygen.element.buttons.x_hover",
close_button_press: "voxygen.element.buttons.x_press",
// Esc-Menu
fireplace: "voxygen/element/misc_bg/fireplace.vox",
button: "voxygen/element/buttons/button.vox",
button_hover: "voxygen/element/buttons/button_hover.vox",
button_press: "voxygen/element/buttons/button_press.vox",
fireplace: "voxygen.element.misc_bg.fireplace",
button: "voxygen.element.buttons.button",
button_hover: "voxygen.element.buttons.button_hover",
button_press: "voxygen.element.buttons.button_press",
// Items
potion_red: "voxygen/voxel/object/potion_red.vox",
potion_green: "voxygen/voxel/object/potion_green.vox",
potion_blue: "voxygen/voxel/object/potion_blue.vox",
key: "voxygen/voxel/object/key.vox",
key_gold: "voxygen/voxel/object/key_gold.vox",
potion_red: "voxygen.voxel.object.potion_red",
potion_green: "voxygen.voxel.object.potion_green",
potion_blue: "voxygen.voxel.object.potion_blue",
key: "voxygen.voxel.object.key",
key_gold: "voxygen.voxel.object.key_gold",
//////////////////////////////////////////////////////////////////////////////////////////////////////
<ImageGraphic>
charwindow_gradient:"voxygen/element/misc_bg/charwindow.png",
charwindow_gradient:"voxygen.element.misc_bg.charwindow",
// Spell Book Window
spellbook_icon: "voxygen/element/icons/spellbook.png",
spellbook_icon: "voxygen.element.icons.spellbook",
// Bag
bag: "voxygen/element/buttons/bag/closed.png",
bag_hover: "voxygen/element/buttons/bag/closed_hover.png",
bag_press: "voxygen/element/buttons/bag/closed_press.png",
bag_open: "voxygen/element/buttons/bag/open.png",
bag_open_hover: "voxygen/element/buttons/bag/open_hover.png",
bag_open_press: "voxygen/element/buttons/bag/open_press.png",
bag: "voxygen.element.buttons.bag.closed",
bag_hover: "voxygen.element.buttons.bag.closed_hover",
bag_press: "voxygen.element.buttons.bag.closed_press",
bag_open: "voxygen.element.buttons.bag.open",
bag_open_hover: "voxygen.element.buttons.bag.open_hover",
bag_open_press: "voxygen.element.buttons.bag.open_press",
map_icon: "voxygen/element/icons/map.png",
map_icon: "voxygen.element.icons.map",
grid_button: "voxygen/element/buttons/border.png",
grid_button_hover: "voxygen/element/buttons/border_mo.png",
grid_button_press: "voxygen/element/buttons/border_press.png",
grid_button_open: "voxygen/element/buttons/border_pressed.png",
grid_button: "voxygen.element.buttons.border",
grid_button_hover: "voxygen.element.buttons.border_mo",
grid_button_press: "voxygen.element.buttons.border_press",
grid_button_open: "voxygen.element.buttons.border_pressed",
// Skillbar Module
sb_grid: "voxygen/element/skill_bar/sbar_grid.png",
sb_grid_bg: "voxygen/element/skill_bar/sbar_grid_bg.png",
l_click: "voxygen/element/skill_bar/l.png",
r_click: "voxygen/element/skill_bar/r.png",
mana_bar: "voxygen/element/skill_bar/mana_bar.png",
health_bar: "voxygen/element/skill_bar/health_bar.png",
xp_bar: "voxygen/element/skill_bar/xp_bar.png",
sb_grid: "voxygen.element.skill_bar.sbar_grid",
sb_grid_bg: "voxygen.element.skill_bar.sbar_grid_bg",
l_click: "voxygen.element.skill_bar.l",
r_click: "voxygen.element.skill_bar.r",
mana_bar: "voxygen.element.skill_bar.mana_bar",
health_bar: "voxygen.element.skill_bar.health_bar",
xp_bar: "voxygen.element.skill_bar.xp_bar",
esc_bg: "voxygen/element/frames/menu.png",
esc_bg: "voxygen.element.frames.menu",
window_frame_2: "voxygen/element/frames/window_2.png",
window_frame_2: "voxygen.element.frames.window_2",
// Char Window
charwindow: "voxygen/element/misc_bg/charwindow.png",
charwindow_icon: "voxygen/element/icons/charwindow.png",
charwindow_tab_bg: "voxygen/element/frames/tab.png",
charwindow_tab: "voxygen/element/buttons/tab.png",
charwindow_expbar: "voxygen/element/misc_bg/small_bg.png",
progress_frame: "voxygen/element/frames/progress_bar.png",
progress: "voxygen/element/misc_bg/progress.png",
charwindow: "voxygen.element.misc_bg.charwindow",
charwindow_icon: "voxygen.element.icons.charwindow",
charwindow_tab_bg: "voxygen.element.frames.tab",
charwindow_tab: "voxygen.element.buttons.tab",
charwindow_expbar: "voxygen.element.misc_bg.small_bg",
progress_frame: "voxygen.element.frames.progress_bar",
progress: "voxygen.element.misc_bg.progress",
// Quest-Log Window
questlog_icon: "voxygen/element/icons/questlog.png",
questlog_icon: "voxygen.element.icons.questlog",
// Window BG
window_bg: "voxygen/element/misc_bg/window_bg.png",
window_bg: "voxygen.element.misc_bg.window_bg",
// Social Window
social_icon: "voxygen/element/icons/social.png",
social_icon: "voxygen.element.icons.social",
<BlankGraphic>
nothing: (),

View File

@ -118,8 +118,8 @@ widget_ids! {
font_ids! {
pub struct Fonts {
opensans: "voxygen/font/OpenSans-Regular.ttf",
metamorph: "voxygen/font/Metamorphous-Regular.ttf",
opensans: "voxygen.font.OpenSans-Regular",
metamorph: "voxygen.font.Metamorphous-Regular",
}
}

View File

@ -69,7 +69,7 @@ impl Scene {
backdrop_model: renderer
.create_model(&FigureModelCache::load_mesh(
"fixture/selection_bg.vox",
"fixture.selection_bg",
Vec3::new(-55.0, -49.5, -2.0),
))
.unwrap(),

View File

@ -140,46 +140,46 @@ widget_ids! {
image_ids! {
struct Imgs {
<VoxelGraphic>
button: "voxygen/element/buttons/button.vox",
button_hover: "voxygen/element/buttons/button_hover.vox",
button_press: "voxygen/element/buttons/button_press.vox",
name_input: "voxygen/element/misc_bg/textbox.vox",
charlist_frame: "voxygen/element/frames/window_4.vox",
server_frame: "voxygen/element/frames/server_frame.vox",
selection: "voxygen/element/frames/selection.vox",
button: "voxygen.element.buttons.button",
button_hover: "voxygen.element.buttons.button_hover",
button_press: "voxygen.element.buttons.button_press",
name_input: "voxygen.element.misc_bg.textbox",
charlist_frame: "voxygen.element.frames.window_4",
server_frame: "voxygen.element.frames.server_frame",
selection: "voxygen.element.frames.selection",
<ImageGraphic>
slider_range: "voxygen/element/slider/track.png",
slider_indicator: "voxygen/element/slider/indicator.png",
slider_range: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
// Tool Icons
daggers: "voxygen/element/icons/daggers.png",
sword: "voxygen/element/icons/sword.png",
axe: "voxygen/element/icons/axe.png",
hammer: "voxygen/element/icons/hammer.png",
bow: "voxygen/element/icons/bow.png",
staff: "voxygen/element/icons/staff.png",
daggers: "voxygen.element.icons.daggers",
sword: "voxygen.element.icons.sword",
axe: "voxygen.element.icons.axe",
hammer: "voxygen.element.icons.hammer",
bow: "voxygen.element.icons.bow",
staff: "voxygen.element.icons.staff",
// Race Icons
male: "voxygen/element/icons/male.png",
female: "voxygen/element/icons/female.png",
human_m: "voxygen/element/icons/human_m.png",
human_f: "voxygen/element/icons/human_f.png",
orc_m: "voxygen/element/icons/orc_m.png",
orc_f: "voxygen/element/icons/orc_f.png",
dwarf_m: "voxygen/element/icons/dwarf_m.png",
dwarf_f: "voxygen/element/icons/dwarf_f.png",
undead_m: "voxygen/element/icons/ud_m.png",
undead_f: "voxygen/element/icons/ud_f.png",
elf_m: "voxygen/element/icons/elf_m.png",
elf_f: "voxygen/element/icons/elf_f.png",
danari_m: "voxygen/element/icons/danari_m.png",
danari_f: "voxygen/element/icons/danari_f.png",
male: "voxygen.element.icons.male",
female: "voxygen.element.icons.female",
human_m: "voxygen.element.icons.human_m",
human_f: "voxygen.element.icons.human_f",
orc_m: "voxygen.element.icons.orc_m",
orc_f: "voxygen.element.icons.orc_f",
dwarf_m: "voxygen.element.icons.dwarf_m",
dwarf_f: "voxygen.element.icons.dwarf_f",
undead_m: "voxygen.element.icons.ud_m",
undead_f: "voxygen.element.icons.ud_f",
elf_m: "voxygen.element.icons.elf_m",
elf_f: "voxygen.element.icons.elf_f",
danari_m: "voxygen.element.icons.danari_m",
danari_f: "voxygen.element.icons.danari_f",
// Icon Borders
icon_border: "voxygen/element/buttons/border.png",
icon_border_mo: "voxygen/element/buttons/border_mo.png",
icon_border_press: "voxygen/element/buttons/border_press.png",
icon_border_pressed: "voxygen/element/buttons/border_pressed.png",
icon_border: "voxygen.element.buttons.border",
icon_border_mo: "voxygen.element.buttons.border_mo",
icon_border_press: "voxygen.element.buttons.border_press",
icon_border_pressed: "voxygen.element.buttons.border_pressed",
<BlankGraphic>
nothing: (),
@ -188,8 +188,8 @@ image_ids! {
font_ids! {
pub struct Fonts {
opensans: "voxygen/font/OpenSans-Regular.ttf",
metamorph: "voxygen/font/Metamorphous-Regular.ttf",
opensans: "voxygen.font.OpenSans-Regular",
metamorph: "voxygen.font.Metamorphous-Regular",
}
}

View File

@ -60,16 +60,16 @@ widget_ids! {
image_ids! {
struct Imgs {
<VoxelGraphic>
v_logo: "voxygen/element/v_logo.vox",
input_bg: "voxygen/element/misc_bg/textbox.vox",
button: "voxygen/element/buttons/button.vox",
button_hover: "voxygen/element/buttons/button_hover.vox",
button_press: "voxygen/element/buttons/button_press.vox",
disclaimer: "voxygen/element/frames/disclaimer.vox",
v_logo: "voxygen.element.v_logo",
input_bg: "voxygen.element.misc_bg.textbox",
button: "voxygen.element.buttons.button",
button_hover: "voxygen.element.buttons.button_hover",
button_press: "voxygen.element.buttons.button_press",
disclaimer: "voxygen.element.frames.disclaimer",
<ImageGraphic>
bg: "voxygen/background/bg_main.png",
error_frame: "voxygen/element/frames/window_2.png",
bg: "voxygen.background.bg_main",
error_frame: "voxygen.element.frames.window_2",
<BlankGraphic>
nothing: (),
@ -79,8 +79,8 @@ image_ids! {
font_ids! {
pub struct Fonts {
opensans: "voxygen/font/OpenSans-Regular.ttf",
metamorph: "voxygen/font/Metamorphous-Regular.ttf",
opensans: "voxygen.font.OpenSans-Regular",
metamorph: "voxygen.font.Metamorphous-Regular",
}
}

View File

@ -160,9 +160,9 @@ impl FigureModelCache {
}
// TODO: Don't make this public.
pub fn load_mesh(filename: &str, position: Vec3<f32>) -> Mesh<FigurePipeline> {
let full_path: String = ["voxygen/voxel/", filename].concat();
Segment::from(assets::load_expect::<DotVoxData>(full_path.as_str()).as_ref())
pub fn load_mesh(mesh_name: &str, position: Vec3<f32>) -> Mesh<FigurePipeline> {
let full_specifier: String = ["voxygen.voxel.", mesh_name].concat();
Segment::from(assets::load_expect::<DotVoxData>(full_specifier.as_str()).as_ref())
.generate_mesh(position)
}
@ -170,53 +170,29 @@ impl FigureModelCache {
use humanoid::{BodyType::*, Race::*};
let (name, offset) = match (race, body_type) {
// z-value should be 0.25 of the .vox total z
(Human, Male) => (
"figure/head/head_human_male.vox",
Vec3::new(-7.0, -5.0, -2.25),
),
// z-value should be 0.25 of the total z
(Human, Male) => ("figure.head.head_human_male", Vec3::new(-7.0, -5.0, -2.25)),
(Human, Female) => (
"figure/head/head_human_female.vox",
"figure.head.head_human_female",
Vec3::new(-7.0, -7.5, -3.25),
),
(Elf, Male) => (
"figure/head/head_elf_male.vox",
Vec3::new(-8.0, -5.0, -2.25),
),
(Elf, Female) => (
"figure/head/head_elf_female.vox",
Vec3::new(-8.0, -5.5, -3.0),
),
(Dwarf, Male) => (
"figure/head/head_dwarf_male.vox",
Vec3::new(-6.0, -5.0, -12.5),
),
(Elf, Male) => ("figure.head.head_elf_male", Vec3::new(-8.0, -5.0, -2.25)),
(Elf, Female) => ("figure.head.head_elf_female", Vec3::new(-8.0, -5.5, -3.0)),
(Dwarf, Male) => ("figure.head.head_dwarf_male", Vec3::new(-6.0, -5.0, -12.5)),
(Dwarf, Female) => (
"figure/head/head_dwarf_female.vox",
"figure.head.head_dwarf_female",
Vec3::new(-6.0, -6.0, -9.25),
),
(Orc, Male) => (
"figure/head/head_orc_male.vox",
Vec3::new(-8.0, -5.0, -2.50),
),
(Orc, Female) => (
"figure/head/head_orc_female.vox",
Vec3::new(-8.0, -8.0, -3.5),
),
(Undead, Male) => (
"figure/head/head_undead_male.vox",
Vec3::new(-5.5, -5.0, -2.5),
),
(Orc, Male) => ("figure.head.head_orc_male", Vec3::new(-8.0, -5.0, -2.50)),
(Orc, Female) => ("figure.head.head_orc_female", Vec3::new(-8.0, -8.0, -3.5)),
(Undead, Male) => ("figure.head.head_undead_male", Vec3::new(-5.5, -5.0, -2.5)),
(Undead, Female) => (
"figure/head/head_undead_female.vox",
"figure.head.head_undead_female",
Vec3::new(-6.0, -5.0, -2.5),
),
(Danari, Male) => (
"figure/head/head_danari_male.vox",
Vec3::new(-9.0, -5.0, -2.75),
),
(Danari, Male) => ("figure.head.head_danari_male", Vec3::new(-9.0, -5.0, -2.75)),
(Danari, Female) => (
"figure/head/head_danari_female.vox",
"figure.head.head_danari_female",
Vec3::new(-9.0, -7.5, -3.0),
),
};
@ -225,8 +201,8 @@ impl FigureModelCache {
// loads models with different offsets
// fn load_beard(beard: Beard) -> Mesh<FigurePipeline> {
// let (name, offset) = match beard {
// Beard::None => ("figure/body/empty.vox", Vec3::new(0.0, 0.0, 0.0)),
// Beard::Human1 => ("figure/empty.vox", Vec3::new(0.0, 0.0, 0.0)),
// Beard::None => ("figure/body/empty", Vec3::new(0.0, 0.0, 0.0)),
// Beard::Human1 => ("figure/empty", Vec3::new(0.0, 0.0, 0.0)),
// };
// Self::load_mesh(name, offset)
// }
@ -236,11 +212,11 @@ impl FigureModelCache {
Self::load_mesh(
match chest {
Blue => "armor/chest/chest_blue.vox",
Brown => "armor/chest/chest_brown.vox",
Dark => "armor/chest/chest_dark.vox",
Green => "armor/chest/chest_green.vox",
Orange => "armor/chest/chest_orange.vox",
Blue => "armor.chest.chest_blue",
Brown => "armor.chest.chest_brown",
Dark => "armor.chest.chest_dark",
Green => "armor.chest.chest_green",
Orange => "armor.chest.chest_orange",
},
Vec3::new(-6.0, -3.5, 0.0),
)
@ -251,8 +227,8 @@ impl FigureModelCache {
Self::load_mesh(
match belt {
//Belt::Default => "figure/body/belt_male.vox",
Dark => "armor/belt/belt_dark.vox",
//Belt::Default => "figure/body/belt_male",
Dark => "armor.belt.belt_dark",
},
Vec3::new(-5.0, -3.5, 0.0),
)
@ -263,11 +239,11 @@ impl FigureModelCache {
Self::load_mesh(
match pants {
Blue => "armor/pants/pants_blue.vox",
Brown => "armor/pants/pants_brown.vox",
Dark => "armor/pants/pants_dark.vox",
Green => "armor/pants/pants_green.vox",
Orange => "armor/pants/pants_orange.vox",
Blue => "armor.pants.pants_blue",
Brown => "armor.pants.pants_brown",
Dark => "armor.pants.pants_dark",
Green => "armor.pants.pants_green",
Orange => "armor.pants.pants_orange",
},
Vec3::new(-5.0, -3.5, 0.0),
)
@ -276,7 +252,7 @@ impl FigureModelCache {
fn load_left_hand(hand: humanoid::Hand) -> Mesh<FigurePipeline> {
Self::load_mesh(
match hand {
humanoid::Hand::Default => "figure/body/hand.vox",
humanoid::Hand::Default => "figure.body.hand",
},
Vec3::new(-2.0, -2.5, -2.0),
)
@ -285,7 +261,7 @@ impl FigureModelCache {
fn load_right_hand(hand: humanoid::Hand) -> Mesh<FigurePipeline> {
Self::load_mesh(
match hand {
humanoid::Hand::Default => "figure/body/hand.vox",
humanoid::Hand::Default => "figure.body.hand",
},
Vec3::new(-2.0, -2.5, -2.0),
)
@ -296,7 +272,7 @@ impl FigureModelCache {
Self::load_mesh(
match foot {
Dark => "armor/foot/foot_dark.vox",
Dark => "armor.foot.foot_dark",
},
Vec3::new(-2.5, -3.5, -9.0),
)
@ -307,7 +283,7 @@ impl FigureModelCache {
Self::load_mesh(
match foot {
Dark => "armor/foot/foot_dark.vox",
Dark => "armor.foot.foot_dark",
},
Vec3::new(-2.5, -3.5, -9.0),
)
@ -315,13 +291,13 @@ impl FigureModelCache {
fn load_weapon(weapon: Tool) -> Mesh<FigurePipeline> {
let (name, offset) = match weapon {
Tool::Sword => ("weapon/sword/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
Tool::Axe => ("weapon/axe/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
Tool::Hammer => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Daggers => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
Tool::SwordShield => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
Tool::Bow => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Staff => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
Tool::Sword => ("weapon.sword.rusty_2h", Vec3::new(-1.5, -6.5, -4.0)),
Tool::Axe => ("weapon.axe.rusty_2h", Vec3::new(-1.5, -6.5, -4.0)),
Tool::Hammer => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Daggers => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
Tool::SwordShield => ("weapon.axe.rusty_2h", Vec3::new(-2.5, -6.5, -2.0)),
Tool::Bow => ("weapon.hammer.rusty_2h", Vec3::new(-2.5, -5.5, -4.0)),
Tool::Staff => ("weapon.axe.rusty_2h", Vec3::new(-2.5, -6.5, -2.0)),
};
Self::load_mesh(name, offset)
}
@ -329,8 +305,8 @@ impl FigureModelCache {
fn load_left_shoulder(shoulder: humanoid::Shoulder) -> Mesh<FigurePipeline> {
Self::load_mesh(
match shoulder {
humanoid::Shoulder::None => "figure/empty.vox",
humanoid::Shoulder::Brown1 => "armor/shoulder/shoulder_l_brown.vox",
humanoid::Shoulder::None => "figure.empty",
humanoid::Shoulder::Brown1 => "armor.shoulder.shoulder_l_brown",
},
Vec3::new(2.5, -0.5, 0.0),
)
@ -339,8 +315,8 @@ impl FigureModelCache {
fn load_right_shoulder(shoulder: humanoid::Shoulder) -> Mesh<FigurePipeline> {
Self::load_mesh(
match shoulder {
humanoid::Shoulder::None => "figure/empty.vox",
humanoid::Shoulder::Brown1 => "armor/shoulder/shoulder_r_brown.vox",
humanoid::Shoulder::None => "figure.empty",
humanoid::Shoulder::Brown1 => "armor.shoulder.shoulder_r_brown",
},
Vec3::new(2.5, -0.5, 0.0),
)
@ -348,13 +324,13 @@ impl FigureModelCache {
// TODO: Inventory
fn load_draw() -> Mesh<FigurePipeline> {
Self::load_mesh("object/glider.vox", Vec3::new(-26.0, -26.0, -5.0))
Self::load_mesh("object.glider", Vec3::new(-26.0, -26.0, -5.0))
}
//fn load_right_equip(hand: humanoid::Hand) -> Mesh<FigurePipeline> {
// Self::load_mesh(
// match hand {
// humanoid::Hand::Default => "figure/body/hand.vox",
// humanoid::Hand::Default => "figure/body/hand",
// },
// Vec3::new(-2.0, -2.5, -5.0),
// )
@ -364,7 +340,7 @@ impl FigureModelCache {
fn load_pig_head(head: quadruped::Head) -> Mesh<FigurePipeline> {
Self::load_mesh(
match head {
quadruped::Head::Default => "npc/pig_purple/pig_head.vox",
quadruped::Head::Default => "npc.pig_purple.pig_head",
},
Vec3::new(-6.0, 4.5, 3.0),
)
@ -373,7 +349,7 @@ impl FigureModelCache {
fn load_pig_chest(chest: quadruped::Chest) -> Mesh<FigurePipeline> {
Self::load_mesh(
match chest {
quadruped::Chest::Default => "npc/pig_purple/pig_chest.vox",
quadruped::Chest::Default => "npc.pig_purple.pig_chest",
},
Vec3::new(-5.0, 4.5, 0.0),
)
@ -382,7 +358,7 @@ impl FigureModelCache {
fn load_pig_leg_lf(leg_l: quadruped::LegL) -> Mesh<FigurePipeline> {
Self::load_mesh(
match leg_l {
quadruped::LegL::Default => "npc/pig_purple/pig_leg_l.vox",
quadruped::LegL::Default => "npc.pig_purple.pig_leg_l",
},
Vec3::new(0.0, -1.0, -1.5),
)
@ -391,7 +367,7 @@ impl FigureModelCache {
fn load_pig_leg_rf(leg_r: quadruped::LegR) -> Mesh<FigurePipeline> {
Self::load_mesh(
match leg_r {
quadruped::LegR::Default => "npc/pig_purple/pig_leg_r.vox",
quadruped::LegR::Default => "npc.pig_purple.pig_leg_r",
},
Vec3::new(0.0, -1.0, -1.5),
)
@ -400,7 +376,7 @@ impl FigureModelCache {
fn load_pig_leg_lb(leg_l: quadruped::LegL) -> Mesh<FigurePipeline> {
Self::load_mesh(
match leg_l {
quadruped::LegL::Default => "npc/pig_purple/pig_leg_l.vox",
quadruped::LegL::Default => "npc.pig_purple.pig_leg_l",
},
Vec3::new(0.0, -1.0, -1.5),
)
@ -409,7 +385,7 @@ impl FigureModelCache {
fn load_pig_leg_rb(leg_r: quadruped::LegR) -> Mesh<FigurePipeline> {
Self::load_mesh(
match leg_r {
quadruped::LegR::Default => "npc/pig_purple/pig_leg_r.vox",
quadruped::LegR::Default => "npc.pig_purple.pig_leg_r",
},
Vec3::new(0.0, -1.0, -1.5),
)
@ -418,7 +394,7 @@ impl FigureModelCache {
fn load_wolf_head_upper(upper_head: quadruped_medium::HeadUpper) -> Mesh<FigurePipeline> {
Self::load_mesh(
match upper_head {
quadruped_medium::HeadUpper::Default => "npc/wolf/wolf_head_upper.vox",
quadruped_medium::HeadUpper::Default => "npc.wolf.wolf_head_upper",
},
Vec3::new(-7.0, -6.0, -5.5),
)
@ -427,7 +403,7 @@ impl FigureModelCache {
fn load_wolf_jaw(jaw: quadruped_medium::Jaw) -> Mesh<FigurePipeline> {
Self::load_mesh(
match jaw {
quadruped_medium::Jaw::Default => "npc/wolf/wolf_jaw.vox",
quadruped_medium::Jaw::Default => "npc.wolf.wolf_jaw",
},
Vec3::new(-3.0, -3.0, -2.5),
)
@ -436,7 +412,7 @@ impl FigureModelCache {
fn load_wolf_head_lower(head_lower: quadruped_medium::HeadLower) -> Mesh<FigurePipeline> {
Self::load_mesh(
match head_lower {
quadruped_medium::HeadLower::Default => "npc/wolf/wolf_head_lower.vox",
quadruped_medium::HeadLower::Default => "npc.wolf.wolf_head_lower",
},
Vec3::new(-7.0, -6.0, -5.5),
)
@ -445,7 +421,7 @@ impl FigureModelCache {
fn load_wolf_tail(tail: quadruped_medium::Tail) -> Mesh<FigurePipeline> {
Self::load_mesh(
match tail {
quadruped_medium::Tail::Default => "npc/wolf/wolf_tail.vox",
quadruped_medium::Tail::Default => "npc.wolf.wolf_tail",
},
Vec3::new(-2.0, -12.0, -5.0),
)
@ -454,7 +430,7 @@ impl FigureModelCache {
fn load_wolf_torso_back(torso_back: quadruped_medium::TorsoBack) -> Mesh<FigurePipeline> {
Self::load_mesh(
match torso_back {
quadruped_medium::TorsoBack::Default => "npc/wolf/wolf_torso_back.vox",
quadruped_medium::TorsoBack::Default => "npc.wolf.wolf_torso_back",
},
Vec3::new(-7.0, -6.0, -6.0),
)
@ -463,7 +439,7 @@ impl FigureModelCache {
fn load_wolf_torso_mid(torso_mid: quadruped_medium::TorsoMid) -> Mesh<FigurePipeline> {
Self::load_mesh(
match torso_mid {
quadruped_medium::TorsoMid::Default => "npc/wolf/wolf_torso_mid.vox",
quadruped_medium::TorsoMid::Default => "npc.wolf.wolf_torso_mid",
},
Vec3::new(-8.0, -5.5, -6.0),
)
@ -472,7 +448,7 @@ impl FigureModelCache {
fn load_wolf_ears(ears: quadruped_medium::Ears) -> Mesh<FigurePipeline> {
Self::load_mesh(
match ears {
quadruped_medium::Ears::Default => "npc/wolf/wolf_ears.vox",
quadruped_medium::Ears::Default => "npc.wolf.wolf_ears",
},
Vec3::new(-4.0, -1.0, -1.0),
)
@ -481,7 +457,7 @@ impl FigureModelCache {
fn load_wolf_foot_lf(foot_lf: quadruped_medium::FootLF) -> Mesh<FigurePipeline> {
Self::load_mesh(
match foot_lf {
quadruped_medium::FootLF::Default => "npc/wolf/wolf_foot_lf.vox",
quadruped_medium::FootLF::Default => "npc.wolf.wolf_foot_lf",
},
Vec3::new(-2.5, -4.0, -2.5),
)
@ -490,7 +466,7 @@ impl FigureModelCache {
fn load_wolf_foot_rf(foot_rf: quadruped_medium::FootRF) -> Mesh<FigurePipeline> {
Self::load_mesh(
match foot_rf {
quadruped_medium::FootRF::Default => "npc/wolf/wolf_foot_rf.vox",
quadruped_medium::FootRF::Default => "npc.wolf.wolf_foot_rf",
},
Vec3::new(-2.5, -4.0, -2.5),
)
@ -499,7 +475,7 @@ impl FigureModelCache {
fn load_wolf_foot_lb(foot_lb: quadruped_medium::FootLB) -> Mesh<FigurePipeline> {
Self::load_mesh(
match foot_lb {
quadruped_medium::FootLB::Default => "npc/wolf/wolf_foot_lb.vox",
quadruped_medium::FootLB::Default => "npc.wolf.wolf_foot_lb",
},
Vec3::new(-2.5, -4.0, -2.5),
)
@ -508,7 +484,7 @@ impl FigureModelCache {
fn load_wolf_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh<FigurePipeline> {
Self::load_mesh(
match foot_rb {
quadruped_medium::FootRB::Default => "npc/wolf/wolf_foot_rb.vox",
quadruped_medium::FootRB::Default => "npc.wolf.wolf_foot_rb",
},
Vec3::new(-2.5, -4.0, -2.5),
)
@ -516,75 +492,69 @@ impl FigureModelCache {
fn load_object(obj: object::Body) -> Mesh<FigurePipeline> {
let (name, offset) = match obj {
object::Body::Bomb => ("object/bomb.vox", Vec3::new(-5.5, -5.5, 0.0)),
object::Body::Scarecrow => ("object/scarecrow.vox", Vec3::new(-9.5, -4.0, 0.0)),
object::Body::Cauldron => ("object/cauldron.vox", Vec3::new(-10.0, -10.0, 0.0)),
object::Body::ChestVines => ("object/chest_vines.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::Chest => ("object/chest.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestDark => ("object/chest_dark.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestDemon => ("object/chest_demon.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestGold => ("object/chest_gold.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestLight => ("object/chest_light.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestOpen => ("object/chest_open.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestSkull => ("object/chest_skull.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::Pumpkin => ("object/pumpkin.vox", Vec3::new(-5.5, -4.0, 0.0)),
object::Body::Pumpkin2 => ("object/pumpkin_2.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin3 => ("object/pumpkin_3.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin4 => ("object/pumpkin_4.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin5 => ("object/pumpkin_5.vox", Vec3::new(-4.0, -5.0, 0.0)),
object::Body::Campfire => ("object/campfire.vox", Vec3::new(-9.0, -10.0, 0.0)),
object::Body::LanternGround => {
("object/lantern_ground.vox", Vec3::new(-3.5, -3.5, 0.0))
}
object::Body::Bomb => ("object.bomb", Vec3::new(-5.5, -5.5, 0.0)),
object::Body::Scarecrow => ("object.scarecrow", Vec3::new(-9.5, -4.0, 0.0)),
object::Body::Cauldron => ("object.cauldron", Vec3::new(-10.0, -10.0, 0.0)),
object::Body::ChestVines => ("object.chest_vines", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::Chest => ("object.chest", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestDark => ("object.chest_dark", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestDemon => ("object.chest_demon", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestGold => ("object.chest_gold", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestLight => ("object.chest_light", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestOpen => ("object.chest_open", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestSkull => ("object.chest_skull", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::Pumpkin => ("object.pumpkin", Vec3::new(-5.5, -4.0, 0.0)),
object::Body::Pumpkin2 => ("object.pumpkin_2", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin3 => ("object.pumpkin_3", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin4 => ("object.pumpkin_4", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin5 => ("object.pumpkin_5", Vec3::new(-4.0, -5.0, 0.0)),
object::Body::Campfire => ("object.campfire", Vec3::new(-9.0, -10.0, 0.0)),
object::Body::LanternGround => ("object.lantern_ground", Vec3::new(-3.5, -3.5, 0.0)),
object::Body::LanternGroundOpen => {
("object/lantern_ground_open.vox", Vec3::new(-3.5, -3.5, 0.0))
("object.lantern_ground_open", Vec3::new(-3.5, -3.5, 0.0))
}
object::Body::LanternStanding => {
("object/lantern_standing.vox", Vec3::new(-7.5, -3.5, 0.0))
("object.lantern_standing", Vec3::new(-7.5, -3.5, 0.0))
}
object::Body::LanternStanding2 => {
("object/lantern_standing_2.vox", Vec3::new(-11.5, -3.5, 0.0))
("object.lantern_standing_2", Vec3::new(-11.5, -3.5, 0.0))
}
object::Body::PotionRed => ("object/potion_red.vox", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::PotionBlue => ("object/potion_blue.vox", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::PotionGreen => ("object/potion_green.vox", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::Crate => ("object/crate.vox", Vec3::new(-7.0, -7.0, 0.0)),
object::Body::Tent => ("object/tent.vox", Vec3::new(-18.5, -19.5, 0.0)),
object::Body::WindowSpooky => {
("object/window_spooky.vox", Vec3::new(-15.0, -1.5, -1.0))
object::Body::PotionRed => ("object.potion_red", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::PotionBlue => ("object.potion_blue", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::PotionGreen => ("object.potion_green", Vec3::new(-2.0, -2.0, 0.0)),
object::Body::Crate => ("object.crate", Vec3::new(-7.0, -7.0, 0.0)),
object::Body::Tent => ("object.tent", Vec3::new(-18.5, -19.5, 0.0)),
object::Body::WindowSpooky => ("object.window_spooky", Vec3::new(-15.0, -1.5, -1.0)),
object::Body::DoorSpooky => ("object.door_spooky", Vec3::new(-15.0, -4.5, 0.0)),
object::Body::Table => ("object.table", Vec3::new(-12.0, -8.0, 0.0)),
object::Body::Table2 => ("object.table_2", Vec3::new(-8.0, -8.0, 0.0)),
object::Body::Table3 => ("object.table_3", Vec3::new(-10.0, -10.0, 0.0)),
object::Body::Drawer => ("object.drawer", Vec3::new(-11.0, -7.5, 0.0)),
object::Body::BedBlue => ("object.bed_human_blue", Vec3::new(-11.0, -15.0, 0.0)),
object::Body::Anvil => ("object.anvil", Vec3::new(-3.0, -7.0, 0.0)),
object::Body::Gravestone => ("object.gravestone", Vec3::new(-5.0, -2.0, 0.0)),
object::Body::Gravestone2 => ("object.gravestone_2", Vec3::new(-8.5, -3.0, 0.0)),
object::Body::Chair => ("object.chair", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair2 => ("object.chair_2", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair3 => ("object.chair_3", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Bench => ("object.bench", Vec3::new(-8.8, -5.0, 0.0)),
object::Body::Carpet => ("object.carpet", Vec3::new(-14.0, -14.0, -0.5)),
object::Body::Bedroll => ("object.bedroll", Vec3::new(-11.0, -19.5, -0.5)),
object::Body::CarpetHumanRound => {
("object.carpet_human_round", Vec3::new(-14.0, -14.0, -0.5))
}
object::Body::CarpetHumanSquare => {
("object.carpet_human_square", Vec3::new(-13.5, -14.0, -0.5))
}
object::Body::DoorSpooky => ("object/door_spooky.vox", Vec3::new(-15.0, -4.5, 0.0)),
object::Body::Table => ("object/table.vox", Vec3::new(-12.0, -8.0, 0.0)),
object::Body::Table2 => ("object/table_2.vox", Vec3::new(-8.0, -8.0, 0.0)),
object::Body::Table3 => ("object/table_3.vox", Vec3::new(-10.0, -10.0, 0.0)),
object::Body::Drawer => ("object/drawer.vox", Vec3::new(-11.0, -7.5, 0.0)),
object::Body::BedBlue => ("object/bed_human_blue.vox", Vec3::new(-11.0, -15.0, 0.0)),
object::Body::Anvil => ("object/anvil.vox", Vec3::new(-3.0, -7.0, 0.0)),
object::Body::Gravestone => ("object/gravestone.vox", Vec3::new(-5.0, -2.0, 0.0)),
object::Body::Gravestone2 => ("object/gravestone_2.vox", Vec3::new(-8.5, -3.0, 0.0)),
object::Body::Chair => ("object/chair.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair2 => ("object/chair_2.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair3 => ("object/chair_3.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Bench => ("object/bench.vox", Vec3::new(-8.8, -5.0, 0.0)),
object::Body::Carpet => ("object/carpet.vox", Vec3::new(-14.0, -14.0, -0.5)),
object::Body::Bedroll => ("object/bedroll.vox", Vec3::new(-11.0, -19.5, -0.5)),
object::Body::CarpetHumanRound => (
"object/carpet_human_round.vox",
Vec3::new(-14.0, -14.0, -0.5),
),
object::Body::CarpetHumanSquare => (
"object/carpet_human_square.vox",
Vec3::new(-13.5, -14.0, -0.5),
),
object::Body::CarpetHumanSquare2 => (
"object/carpet_human_square_2.vox",
"object.carpet_human_square_2",
Vec3::new(-13.5, -14.0, -0.5),
),
object::Body::CarpetHumanSquircle => (
"object/carpet_human_squircle.vox",
"object.carpet_human_squircle",
Vec3::new(-21.0, -21.0, -0.5),
),
object::Body::Pouch => ("object/pouch.vox", Vec3::new(-5.5, -4.5, 0.0)),
object::Body::Pouch => ("object.pouch", Vec3::new(-5.5, -4.5, 0.0)),
};
Self::load_mesh(name, offset)
}

View File

@ -3,10 +3,10 @@
///
/// Example usage:
/// ```
/// image_ids! {
/// pub struct Imgs {
/// font1: "filename1.vox",
/// font2: "filename2.vox",
/// font_ids! {
/// pub struct Fonts {
/// font1: "filename1",
/// font2: "filename2",
/// }
/// }
/// ```

View File

@ -64,11 +64,11 @@ impl<'a> GraphicCreator<'a> for VoxelMs9Graphic {
/// image_ids! {
/// pub struct Imgs {
/// <VoxelGraphic>
/// button1: "filename1.vox",
/// button2: "filename2.vox",
/// button1: "specifier1",
/// button2: "specifier2",
///
/// <ImageGraphic>
/// background: "background.png",
/// background: "background",
///
/// <BlankGraphic>
/// blank: (),

View File

@ -42,6 +42,7 @@ use conrod_core::{
use graphic::Id as GraphicId;
use log::warn;
use std::{
fs::File,
io::{BufReader, Read},
ops::Range,
sync::Arc,
@ -83,7 +84,8 @@ impl DrawCommand {
pub struct Font(text::Font);
impl assets::Asset for Font {
fn load(mut buf_reader: BufReader<impl Read>) -> Result<Self, assets::Error> {
const ENDINGS: &'static [&'static str] = &["ttf"];
fn parse(mut buf_reader: BufReader<File>) -> Result<Self, assets::Error> {
let mut buf = Vec::new();
buf_reader.read_to_end(&mut buf)?;
Ok(Font(text::Font::from_bytes(buf.clone()).unwrap()))

View File

@ -79,356 +79,356 @@ fn st_asset(path: &str, offset: impl Into<Vec3<i32>>) -> Arc<Structure> {
lazy_static! {
pub static ref OAKS: Vec<Arc<Structure>> = vec![
// green oaks
assets::load_map("world/tree/oak_green/1.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.1", |s: Structure| s
.with_center(Vec3::new(15, 18, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/2.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.2", |s: Structure| s
.with_center(Vec3::new(15, 18, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/3.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.3", |s: Structure| s
.with_center(Vec3::new(16, 20, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/4.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.4", |s: Structure| s
.with_center(Vec3::new(18, 21, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/5.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.5", |s: Structure| s
.with_center(Vec3::new(18, 18, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/6.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.6", |s: Structure| s
.with_center(Vec3::new(16, 21, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/7.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.7", |s: Structure| s
.with_center(Vec3::new(20, 19, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/8.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.8", |s: Structure| s
.with_center(Vec3::new(22, 20, 14)))
.unwrap(),
assets::load_map("world/tree/oak_green/9.vox", |s: Structure| s
assets::load_map("world.tree.oak_green.9", |s: Structure| s
.with_center(Vec3::new(26, 26, 14)))
.unwrap(),
];
pub static ref OAK_STUMPS: Vec<Arc<Structure>> = vec![
// oak stumps
assets::load_map("world/tree/oak_stump/1.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.1", |s: Structure| s
.with_center(Vec3::new(15, 18, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/2.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.2", |s: Structure| s
.with_center(Vec3::new(15, 18, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/3.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.3", |s: Structure| s
.with_center(Vec3::new(16, 20, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/4.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.4", |s: Structure| s
.with_center(Vec3::new(18, 21, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/5.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.5", |s: Structure| s
.with_center(Vec3::new(18, 18, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/6.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.6", |s: Structure| s
.with_center(Vec3::new(16, 21, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/7.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.7", |s: Structure| s
.with_center(Vec3::new(20, 19, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/8.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.8", |s: Structure| s
.with_center(Vec3::new(22, 20, 10)))
.unwrap(),
assets::load_map("world/tree/oak_stump/9.vox", |s: Structure| s
assets::load_map("world.tree.oak_stump.9", |s: Structure| s
.with_center(Vec3::new(26, 26, 10)))
.unwrap(),
];
pub static ref PINES: Vec<Arc<Structure>> = vec![
// green pines
assets::load_map("world/tree/pine_green/1.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.1", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_green/2.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.2", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_green/3.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.3", |s: Structure| s
.with_center(Vec3::new(17, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green/4.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.4", |s: Structure| s
.with_center(Vec3::new(10, 8, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green/5.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.5", |s: Structure| s
.with_center(Vec3::new(12, 12, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green/6.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.6", |s: Structure| s
.with_center(Vec3::new(11, 10, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green/7.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.7", |s: Structure| s
.with_center(Vec3::new(16, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green/8.vox", |s: Structure| s
assets::load_map("world.tree.pine_green.8", |s: Structure| s
.with_center(Vec3::new(12, 10, 12)))
.unwrap(),
/*
// green pines 2
assets::load_map("world/tree/pine_green_2/1.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/1", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/2.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/2", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/3.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/3", |s: Structure| s
.with_center(Vec3::new(17, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/4.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/4", |s: Structure| s
.with_center(Vec3::new(10, 8, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/5.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/5", |s: Structure| s
.with_center(Vec3::new(12, 12, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/6.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/6", |s: Structure| s
.with_center(Vec3::new(11, 10, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/7.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/7", |s: Structure| s
.with_center(Vec3::new(16, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_green_2/8.vox", |s: Structure| s
assets::load_map("world/tree/pine_green_2/8", |s: Structure| s
.with_center(Vec3::new(12, 10, 12)))
.unwrap(),
// blue pines
assets::load_map("world/tree/pine_blue/1.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/1", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_blue/2.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/2", |s: Structure| s
.with_center(Vec3::new(15, 15, 14)))
.unwrap(),
assets::load_map("world/tree/pine_blue/3.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/3", |s: Structure| s
.with_center(Vec3::new(17, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_blue/4.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/4", |s: Structure| s
.with_center(Vec3::new(10, 8, 12)))
.unwrap(),
assets::load_map("world/tree/pine_blue/5.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/5", |s: Structure| s
.with_center(Vec3::new(12, 12, 12)))
.unwrap(),
assets::load_map("world/tree/pine_blue/6.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/6", |s: Structure| s
.with_center(Vec3::new(11, 10, 12)))
.unwrap(),
assets::load_map("world/tree/pine_blue/7.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/7", |s: Structure| s
.with_center(Vec3::new(16, 15, 12)))
.unwrap(),
assets::load_map("world/tree/pine_blue/8.vox", |s: Structure| s
assets::load_map("world/tree/pine_blue/8", |s: Structure| s
.with_center(Vec3::new(12, 10, 12)))
.unwrap(),
*/
];
/*
// temperate small
assets::load_map("world/tree/temperate_small/1.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/1", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
assets::load_map("world/tree/temperate_small/2.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/2", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
assets::load_map("world/tree/temperate_small/3.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/3", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
assets::load_map("world/tree/temperate_small/4.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/4", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
assets::load_map("world/tree/temperate_small/5.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/5", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
assets::load_map("world/tree/temperate_small/6.vox", |s: Structure| s
assets::load_map("world/tree/temperate_small/6", |s: Structure| s
.with_center(Vec3::new(4, 4, 7)))
.unwrap(),
// birch
assets::load_map("world/tree/birch/1.vox", |s: Structure| s
assets::load_map("world/tree/birch/1", |s: Structure| s
.with_center(Vec3::new(12, 9, 10)))
.unwrap(),
assets::load_map("world/tree/birch/2.vox", |s: Structure| s
assets::load_map("world/tree/birch/2", |s: Structure| s
.with_center(Vec3::new(11, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/3.vox", |s: Structure| s
assets::load_map("world/tree/birch/3", |s: Structure| s
.with_center(Vec3::new(9, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/4.vox", |s: Structure| s
assets::load_map("world/tree/birch/4", |s: Structure| s
.with_center(Vec3::new(9, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/5.vox", |s: Structure| s
assets::load_map("world/tree/birch/5", |s: Structure| s
.with_center(Vec3::new(9, 11, 10)))
.unwrap(),
assets::load_map("world/tree/birch/6.vox", |s: Structure| s
assets::load_map("world/tree/birch/6", |s: Structure| s
.with_center(Vec3::new(9, 9, 10)))
.unwrap(),
assets::load_map("world/tree/birch/7.vox", |s: Structure| s
assets::load_map("world/tree/birch/7", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/8.vox", |s: Structure| s
assets::load_map("world/tree/birch/8", |s: Structure| s
.with_center(Vec3::new(9, 9, 10)))
.unwrap(),
assets::load_map("world/tree/birch/9.vox", |s: Structure| s
assets::load_map("world/tree/birch/9", |s: Structure| s
.with_center(Vec3::new(9, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/10.vox", |s: Structure| s
assets::load_map("world/tree/birch/10", |s: Structure| s
.with_center(Vec3::new(10, 9, 10)))
.unwrap(),
assets::load_map("world/tree/birch/11.vox", |s: Structure| s
assets::load_map("world/tree/birch/11", |s: Structure| s
.with_center(Vec3::new(9, 10, 10)))
.unwrap(),
assets::load_map("world/tree/birch/12.vox", |s: Structure| s
assets::load_map("world/tree/birch/12", |s: Structure| s
.with_center(Vec3::new(10, 9, 10)))
.unwrap(),
// poplar
assets::load_map("world/tree/poplar/1.vox", |s: Structure| s
assets::load_map("world/tree/poplar/1", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/2.vox", |s: Structure| s
assets::load_map("world/tree/poplar/2", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/3.vox", |s: Structure| s
assets::load_map("world/tree/poplar/3", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/4.vox", |s: Structure| s
assets::load_map("world/tree/poplar/4", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/5.vox", |s: Structure| s
assets::load_map("world/tree/poplar/5", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/6.vox", |s: Structure| s
assets::load_map("world/tree/poplar/6", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/7.vox", |s: Structure| s
assets::load_map("world/tree/poplar/7", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/8.vox", |s: Structure| s
assets::load_map("world/tree/poplar/8", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/9.vox", |s: Structure| s
assets::load_map("world/tree/poplar/9", |s: Structure| s
.with_center(Vec3::new(6, 6, 10)))
.unwrap(),
assets::load_map("world/tree/poplar/10.vox", |s: Structure| s
assets::load_map("world/tree/poplar/10", |s: Structure| s
.with_center(Vec3::new(7, 7, 10)))
.unwrap(),
*/
pub static ref PALMS: Vec<Arc<Structure>> = vec![
// palm trees
assets::load_map("world/tree/desert_palm/1.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.1", |s: Structure| s
.with_center(Vec3::new(12, 12, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/2.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.2", |s: Structure| s
.with_center(Vec3::new(12, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/3.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.3", |s: Structure| s
.with_center(Vec3::new(12, 12, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/4.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.4", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/5.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.5", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/6.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.6", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/7.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.7", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/8.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.8", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/9.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.9", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
assets::load_map("world/tree/desert_palm/10.vox", |s: Structure| s
assets::load_map("world.tree.desert_palm.10", |s: Structure| s
.with_center(Vec3::new(10, 10, 10)))
.unwrap(),
];
pub static ref SNOW_PINES: Vec<Arc<Structure>> = vec![
// snow pines
st_asset("world/tree/snow_pine/1.vox", (15, 15, 14)),
st_asset("world/tree/snow_pine/2.vox", (15, 15, 14)),
st_asset("world/tree/snow_pine/3.vox", (17, 15, 12)),
st_asset("world/tree/snow_pine/4.vox", (10, 8, 12)),
st_asset("world/tree/snow_pine/5.vox", (12, 12, 12)),
st_asset("world/tree/snow_pine/6.vox", (11, 10, 12)),
st_asset("world/tree/snow_pine/7.vox", (16, 15, 12)),
st_asset("world/tree/snow_pine/8.vox", (12, 10, 12)),
st_asset("world.tree.snow_pine.1", (15, 15, 14)),
st_asset("world.tree.snow_pine.2", (15, 15, 14)),
st_asset("world.tree.snow_pine.3", (17, 15, 12)),
st_asset("world.tree.snow_pine.4", (10, 8, 12)),
st_asset("world.tree.snow_pine.5", (12, 12, 12)),
st_asset("world.tree.snow_pine.6", (11, 10, 12)),
st_asset("world.tree.snow_pine.7", (16, 15, 12)),
st_asset("world.tree.snow_pine.8", (12, 10, 12)),
];
pub static ref ACACIAS: Vec<Arc<Structure>> = vec![
// snow pines
st_asset("world/tree/acacia/1.vox", (16, 17, 1)),
st_asset("world/tree/acacia/2.vox", (5, 6, 1)),
st_asset("world/tree/acacia/3.vox", (5, 6, 1)),
st_asset("world/tree/acacia/4.vox", (15, 16, 1)),
st_asset("world/tree/acacia/5.vox", (19, 18, 1)),
// acias
st_asset("world.tree.acacia.1", (16, 17, 1)),
st_asset("world.tree.acacia.2", (5, 6, 1)),
st_asset("world.tree.acacia.3", (5, 6, 1)),
st_asset("world.tree.acacia.4", (15, 16, 1)),
st_asset("world.tree.acacia.5", (19, 18, 1)),
];
pub static ref FRUIT_TREES: Vec<Arc<Structure>> = vec![
// snow pines
st_asset("world/tree/fruit/1.vox", (5, 5, 7)),
st_asset("world/tree/fruit/2.vox", (5, 5, 7)),
st_asset("world/tree/fruit/3.vox", (5, 5, 7)),
st_asset("world/tree/fruit/4.vox", (5, 5, 7)),
st_asset("world/tree/fruit/5.vox", (5, 5, 7)),
st_asset("world/tree/fruit/6.vox", (5, 5, 7)),
// fruit trees
st_asset("world.tree.fruit.1", (5, 5, 7)),
st_asset("world.tree.fruit.2", (5, 5, 7)),
st_asset("world.tree.fruit.3", (5, 5, 7)),
st_asset("world.tree.fruit.4", (5, 5, 7)),
st_asset("world.tree.fruit.5", (5, 5, 7)),
st_asset("world.tree.fruit.6", (5, 5, 7)),
];
/*
// snow birches -> need roots!
assets::load_map("world/tree/snow_birch/1.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/1", |s: Structure| s
.with_center(Vec3::new(12, 9, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/2.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/2", |s: Structure| s
.with_center(Vec3::new(11, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/3.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/3", |s: Structure| s
.with_center(Vec3::new(9, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/4.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/4", |s: Structure| s
.with_center(Vec3::new(9, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/5.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/5", |s: Structure| s
.with_center(Vec3::new(9, 11, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/6.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/6", |s: Structure| s
.with_center(Vec3::new(9, 9, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/7.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/7", |s: Structure| s
.with_center(Vec3::new(10, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/8.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/8", |s: Structure| s
.with_center(Vec3::new(9, 9, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/9.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/9", |s: Structure| s
.with_center(Vec3::new(9, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/10.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/10", |s: Structure| s
.with_center(Vec3::new(10, 9, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/11.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/11", |s: Structure| s
.with_center(Vec3::new(9, 10, 4)))
.unwrap(),
assets::load_map("world/tree/snow_birch/12.vox", |s: Structure| s
assets::load_map("world/tree/snow_birch/12", |s: Structure| s
.with_center(Vec3::new(10, 9, 4)))
.unwrap(),
// willows
assets::load_map("world/tree/willow/1.vox", |s: Structure| s
assets::load_map("world/tree/willow/1", |s: Structure| s
.with_center(Vec3::new(15, 14, 1)))
.unwrap(),
assets::load_map("world/tree/willow/2.vox", |s: Structure| s
assets::load_map("world/tree/willow/2", |s: Structure| s
.with_center(Vec3::new(11, 12, 1)))
.unwrap(),
];
*/
pub static ref QUIRKY: Vec<Arc<Structure>> = vec![
st_asset("world/structure/natural/tower-ruin.vox", (11, 14, 5)),
st_asset("world/structure/natural/witch-hut.vox", (10, 13, 9)),
st_asset("world.structure.natural.tower-ruin", (11, 14, 5)),
st_asset("world.structure.natural.witch-hut", (10, 13, 9)),
];
pub static ref QUIRKY_DRY: Vec<Arc<Structure>> = vec![
st_asset("world/structure/natural/ribcage-small.vox", (7, 13, 4)),
st_asset("world/structure/natural/ribcage-large.vox", (13, 19, 8)),
st_asset("world/structure/natural/skull-large.vox", (15, 20, 4)),
st_asset("world.structure.natural.ribcage-small", (7, 13, 4)),
st_asset("world.structure.natural.ribcage-large", (13, 19, 8)),
st_asset("world.structure.natural.skull-large", (15, 20, 4)),
];
}

View File

@ -28,10 +28,10 @@ static DUNGEON_RAND: RandomPerm = RandomPerm::new(0x42782335);
lazy_static! {
pub static ref DUNGEONS: Vec<Arc<Structure>> = vec![
assets::load_map("world/structure/dungeon/ruins.vox", |s: Structure| s
assets::load_map("world.structure.dungeon.ruins", |s: Structure| s
.with_center(Vec3::new(57, 58, 62)))
.unwrap(),
assets::load_map("world/structure/dungeon/ruins-2.vox", |s: Structure| s
assets::load_map("world.structure.dungeon.ruins-2", |s: Structure| s
.with_center(Vec3::new(53, 57, 60)))
.unwrap(),
];