mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added support for JPEG backgrounds
This commit is contained in:
parent
1af6f685d1
commit
0265da1074
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,4 +1,6 @@
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.vox filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
|
BIN
assets/voxygen/background/bg_1.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_1.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_10.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_10.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_11.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_11.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_12.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_12.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_13.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_13.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_2.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_2.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_3.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_3.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_4.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_4.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_5.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_5.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_6.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_6.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_7.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_7.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_8.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_8.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_9.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_9.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/background/bg_main.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_main.png
(Stored with Git LFS)
Binary file not shown.
@ -97,19 +97,20 @@ impl Image {
|
||||
pub fn to_image(&self) -> Arc<DynamicImage> { Arc::clone(&self.0) }
|
||||
}
|
||||
|
||||
pub struct PngLoader;
|
||||
impl Loader<Image> for PngLoader {
|
||||
fn load(content: Cow<[u8]>, _: &str) -> Result<Image, BoxedError> {
|
||||
let format = image::ImageFormat::Png;
|
||||
pub struct ImageLoader;
|
||||
impl Loader<Image> for ImageLoader {
|
||||
fn load(content: Cow<[u8]>, ext: &str) -> Result<Image, BoxedError> {
|
||||
let format = image::ImageFormat::from_extension(ext)
|
||||
.ok_or_else(|| format!("Invalid file extension {}", ext))?;
|
||||
let image = image::load_from_memory_with_format(&content, format)?;
|
||||
Ok(Image(Arc::new(image)))
|
||||
}
|
||||
}
|
||||
|
||||
impl Asset for Image {
|
||||
type Loader = PngLoader;
|
||||
type Loader = ImageLoader;
|
||||
|
||||
const EXTENSION: &'static str = "png";
|
||||
const EXTENSIONS: &'static [&'static str] = &["png", "jpg", "jpeg"];
|
||||
}
|
||||
|
||||
pub struct DotVoxAsset(pub DotVoxData);
|
||||
|
Loading…
Reference in New Issue
Block a user