map-tool: disable all image formats except png and jpeg
This commit is contained in:
24
Cargo.lock
generated
24
Cargo.lock
generated
@@ -1728,9 +1728,7 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"ddsfile",
|
||||
"half",
|
||||
"image",
|
||||
"intel_tex_2",
|
||||
"strum",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
@@ -4047,28 +4045,6 @@ dependencies = [
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
|
||||
@@ -49,8 +49,8 @@ anyhow = "1.0.75"
|
||||
clap = { version = "4.4.2", features = ["derive"], optional = true }
|
||||
flate2 = "1.0.27"
|
||||
futures = { version = "0.3.31", optional = true }
|
||||
image = "0.25.2"
|
||||
image_dds = "0.7.1"
|
||||
image = { version = "0.25.2", features = ["png", "jpeg"], default-features = false }
|
||||
image_dds = { version = "0.7.1", features = ["ddsfile","encode"], default-features = false }
|
||||
thiserror = "2.0.11"
|
||||
tokio = { version = "1.43.0", features = ["time"] }
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ pub fn get_unique_assets(dom:&rbx_dom_weak::WeakDom)->UniqueAssets{
|
||||
pub enum ConvertTextureError{
|
||||
#[error("Image error {0:?}")]
|
||||
Image(#[from]image::ImageError),
|
||||
#[error("DDS encode error {0:?}")]
|
||||
DDSEncode(#[from]image_dds::error::SurfaceError),
|
||||
#[error("DDS create error {0:?}")]
|
||||
DDS(#[from]image_dds::CreateDdsError),
|
||||
#[error("DDS write error {0:?}")]
|
||||
@@ -134,12 +136,14 @@ pub fn convert_texture_to_dds(data:&[u8])->Result<Vec<u8>,ConvertTextureError>{
|
||||
image_dds::ImageFormat::BC7RgbaUnormSrgb
|
||||
};
|
||||
|
||||
let dds=image_dds::dds_from_image(
|
||||
&image,
|
||||
format,
|
||||
image_dds::Quality::Slow,
|
||||
image_dds::Mipmaps::GeneratedAutomatic,
|
||||
)?;
|
||||
let dds=image_dds::SurfaceRgba8{
|
||||
width:image.width(),
|
||||
height:image.height(),
|
||||
depth:1,
|
||||
layers:1,
|
||||
mipmaps:1,
|
||||
data:image.as_raw(),
|
||||
}.encode(format,image_dds::Quality::Slow,image_dds::Mipmaps::GeneratedAutomatic)?.to_dds()?;
|
||||
|
||||
let mut buf=Vec::new();
|
||||
dds.write(&mut Cursor::new(&mut buf))?;
|
||||
|
||||
@@ -209,6 +209,8 @@ pub fn load_texture<'bsp,'vpk,'a>(finder:BspFinder<'bsp,'vpk>,texture_name:&str)
|
||||
pub enum ConvertTextureError{
|
||||
#[error("Vtf error {0:?}")]
|
||||
Vtf(#[from]vtf::Error),
|
||||
#[error("DDS encode error {0:?}")]
|
||||
DDSEncode(#[from]image_dds::error::SurfaceError),
|
||||
#[error("DDS create error {0:?}")]
|
||||
DDS(#[from]image_dds::CreateDdsError),
|
||||
#[error("DDS write error {0:?}")]
|
||||
@@ -224,12 +226,14 @@ pub fn convert_texture_to_dds(vtf_data:&[u8])->Result<Vec<u8>,ConvertTextureErro
|
||||
}else{
|
||||
image_dds::ImageFormat::BC7RgbaUnormSrgb
|
||||
};
|
||||
let dds=image_dds::dds_from_image(
|
||||
&image,
|
||||
format,
|
||||
image_dds::Quality::Slow,
|
||||
image_dds::Mipmaps::GeneratedAutomatic,
|
||||
)?;
|
||||
let dds=image_dds::SurfaceRgba8{
|
||||
width:image.width(),
|
||||
height:image.height(),
|
||||
depth:1,
|
||||
layers:1,
|
||||
mipmaps:1,
|
||||
data:image.as_raw(),
|
||||
}.encode(format,image_dds::Quality::Slow,image_dds::Mipmaps::GeneratedAutomatic)?.to_dds()?;
|
||||
|
||||
let mut buf=Vec::new();
|
||||
dds.write(&mut Cursor::new(&mut buf))?;
|
||||
|
||||
Reference in New Issue
Block a user