Ship production navigation authoring workflow

This commit is contained in:
Rbanh committed 2026-07-12 02:53:43 -04:00
1 parent 0798aa5d57
commit b4aa61e394
35 files changed
+3898 -602

No files matched your search

+9 -24
View File
@@ -63,7 +63,7 @@ impl From<&SurfaceExtension> for SurfaceExtensionKey {
}
}
#[derive(Asset, AsBindGroup, Reflect, Debug, Clone)]
#[derive(Asset, AsBindGroup, Reflect, Debug, Clone, Default)]
#[bind_group_data(SurfaceExtensionKey)]
pub struct SurfaceExtension {
#[uniform(100)]
@@ -96,23 +96,6 @@ pub struct SurfaceExtension {
pub shader: Handle<Shader>,
}
impl Default for SurfaceExtension {
fn default() -> Self {
Self {
uniform: SurfaceUniform::default(),
texture0: None,
texture1: None,
texture2: None,
texture3: None,
texture4: None,
texture5: None,
texture6: None,
texture7: None,
shader: Handle::default(),
}
}
}
impl SurfaceExtension {
pub fn set_texture(&mut self, index: usize, handle: Option<Handle<Image>>) {
match index {
@@ -170,8 +153,8 @@ pub struct SurfaceMaterialCache {
}
enum BuiltRendererMaterial {
Standard(StandardMaterial),
Surface(SurfaceMaterial),
Standard(Box<StandardMaterial>),
Surface(Box<SurfaceMaterial>),
}
#[derive(Resource, Default, Debug, Clone)]
@@ -203,7 +186,7 @@ impl Plugin for SurfaceMaterialPlugin {
}
}
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
fn sync_surface_material_bindings(
mut commands: Commands,
asset_server: Res<AssetServer>,
@@ -267,6 +250,7 @@ fn sync_surface_material_bindings(
&mut evaluator_registry,
) {
Ok(BuiltRendererMaterial::Surface(material)) => {
let material = *material;
cache.standard_only.remove(reference);
cache.standard_handles.remove(reference);
cache.failed_revisions.remove(reference);
@@ -282,6 +266,7 @@ fn sync_surface_material_bindings(
}
}
Ok(BuiltRendererMaterial::Standard(material)) => {
let material = *material;
// Plain Material assets stay on Bevy's StandardMaterial path, while still
// sharing one live-updated handle across every renderer slot.
let handle = standard_handle
@@ -404,7 +389,7 @@ fn build_surface_material(
(!asset.render_state.double_sided).then_some(bevy::render::render_resource::Face::Back);
let Some(evaluator) = evaluator_source.as_deref() else {
return Ok(BuiltRendererMaterial::Standard(base));
return Ok(BuiltRendererMaterial::Standard(Box::new(base)));
};
validate_surface_evaluator(evaluator)?;
let runtime_shader_id = stable_shader_id(reference);
@@ -443,10 +428,10 @@ fn build_surface_material(
asset_server,
)?;
}
Ok(BuiltRendererMaterial::Surface(ExtendedMaterial {
Ok(BuiltRendererMaterial::Surface(Box::new(ExtendedMaterial {
base,
extension,
}))
})))
}
fn material_dependency_paths(path: &str) -> Result<Vec<String>, String> {