turn on gltf support by default

- removed feature gate
This commit is contained in:
Dmitry Stepanov
2025-02-06 12:26:06 +03:00
parent ca2895b7c2
commit 5fe390b94c
7 changed files with 8 additions and 26 deletions
-2
View File
@@ -18,9 +18,7 @@ rust-version = "1.80"
crate-type = ["dylib"]
[features]
gltf = ["fyrox-impl/gltf"]
mesh_analysis = ["fyrox-impl/mesh_analysis"]
gltf_blend_shapes = ["fyrox-impl/gltf_blend_shapes"]
[dependencies]
fyrox-impl = { path = "../fyrox-impl", version = "0.36.0" }
+1 -2
View File
@@ -44,7 +44,7 @@ base64 = "0.22.1"
uvgen = "0.2.0"
lightmap = "0.2"
libloading = "0.8.1"
gltf = { version = "1.4.0", optional = true, default-features = false, features = ["names", "utils"] }
gltf = { version = "1.4.0", default-features = false, features = ["names", "utils", "extras"] }
bytemuck = { version = "1.16.1", features = ["derive"] }
# These dependencies isn't actually used by the engine, but it is needed to prevent cargo from rebuilding
# the engine lib on different packages.
@@ -53,7 +53,6 @@ imageproc = "0.25.0"
[features]
enable_profiler = ["fyrox-core/enable_profiler"]
gltf_blend_shapes = ["gltf", "gltf/extras"]
mesh_analysis = []
[target.'cfg(target_os = "android")'.dependencies]
+5 -8
View File
@@ -1231,14 +1231,11 @@ pub(crate) fn initialize_resource_manager_loaders(
let mut state = resource_manager.state();
#[cfg(feature = "gltf")]
{
let gltf_loader = super::resource::gltf::GltfLoader {
resource_manager: resource_manager.clone(),
default_import_options: Default::default(),
};
state.loaders.set(gltf_loader);
}
let gltf_loader = super::resource::gltf::GltfLoader {
resource_manager: resource_manager.clone(),
default_import_options: Default::default(),
};
state.loaders.set(gltf_loader);
for shader in ShaderResource::standard_shaders() {
state.built_in_resources.add((*shader).clone());
-6
View File
@@ -68,7 +68,6 @@ pub use uri::{parse_uri, Scheme, Uri};
type Result<T> = std::result::Result<T, GltfLoadError>;
#[cfg(feature = "gltf_blend_shapes")]
const TARGET_NAMES_KEY: &str = "targetNames";
#[derive(Debug)]
@@ -476,10 +475,7 @@ fn import_mesh(
path: &Path,
stats: &mut GeometryStatistics,
) -> Result<MeshData> {
#[cfg(feature = "gltf_blend_shapes")]
let morph_info = import_morph_info(&mesh)?;
#[cfg(not(feature = "gltf_blend_shapes"))]
let morph_info = BlendShapeInfoContainer::default();
let mut surfs: Vec<Surface> = Vec::with_capacity(mesh.primitives().len());
let mut blend_shapes: Option<Vec<BlendShape>> = None;
for prim in mesh.primitives() {
@@ -494,7 +490,6 @@ fn import_mesh(
})
}
#[cfg(feature = "gltf_blend_shapes")]
fn import_morph_info(mesh: &gltf::Mesh) -> Result<BlendShapeInfoContainer> {
let weights: &[f32] = mesh.weights().unwrap_or_default();
let weights: Vec<f32> = weights.iter().map(|w| w * 100.0).collect();
@@ -528,7 +523,6 @@ fn import_morph_info(mesh: &gltf::Mesh) -> Result<BlendShapeInfoContainer> {
Ok(BlendShapeInfoContainer::new(names, weights))
}
#[cfg(feature = "gltf_blend_shapes")]
fn values_to_strings(values: &[json::Value]) -> Option<Vec<String>> {
let mut result: Vec<String> = Vec::with_capacity(values.len());
for v in values {
+2 -5
View File
@@ -267,12 +267,9 @@ fn build_morph_data(
morph_info: &BlendShapeInfoContainer,
buffers: &[Vec<u8>],
) -> Result<Vec<InputBlendShapeData>> {
#[cfg(feature = "gltf_blend_shapes")]
return inner_build_morph_data(primitive, morph_info, buffers);
#[cfg(not(feature = "gltf_blend_shapes"))]
return Ok(Vec::new());
inner_build_morph_data(primitive, morph_info, buffers)
}
#[cfg(feature = "gltf_blend_shapes")]
fn inner_build_morph_data(
primitive: &Primitive,
morph_info: &BlendShapeInfoContainer,
-1
View File
@@ -24,7 +24,6 @@
pub mod curve;
pub mod fbx;
#[cfg(feature = "gltf")]
pub mod gltf;
pub mod model;
pub mod texture;
-2
View File
@@ -17,9 +17,7 @@ rust-version = "1.80"
[features]
default = ["fyrox-impl"]
dylib = ["fyrox-dylib"]
gltf = ["fyrox-impl/gltf", "fyrox-dylib/gltf"]
mesh_analysis = ["fyrox-impl/mesh_analysis", "fyrox-dylib/mesh_analysis"]
gltf_blend_shapes = ["fyrox-impl/gltf_blend_shapes", "fyrox-dylib/gltf_blend_shapes"]
[dependencies]
fyrox-impl = { version = "0.36.0", path = "../fyrox-impl", optional = true }