Build renderer and material component foundations
Add dedicated skinned rendering, pose restoration, shared Material and Material Instance slots, registry-driven components, Surface/Solari integration, transactional schema upgrades, navigation authoring, documentation, and evaluation evidence.
This commit is contained in:
1 parent
0553a85220
commit
0798aa5d57
169 files changed
+27098
-3469
No files matched your search
@@ -5,8 +5,9 @@ use bevy::ecs::system::SystemParam;
|
||||
use bevy::prelude::*;
|
||||
use shared::{
|
||||
AudioListenerDesc, AudioSourceDesc, AuthoringLightKind, ColliderDesc, ColliderShapeDesc,
|
||||
LevelObject, LightDesc, ModelRef, ObjectiveMarker, PhysicsBody, PlayerSpawn,
|
||||
PostProcessVolumeDesc, PrefabRef, ProjectSun, RaytracingExcluded, TeamSpawn, TriggerVolume,
|
||||
LevelObject, LightDesc, ModelRef, NavigationArea, NavigationBounds, NavigationLink,
|
||||
NavigationObstacle, ObjectiveMarker, PhysicsBody, PlayerSpawn, PostProcessVolumeDesc,
|
||||
PrefabRef, ProjectSun, RaytracingExcluded, SkinnedMeshRenderer, TeamSpawn, TriggerVolume,
|
||||
WeaponSpawn,
|
||||
};
|
||||
use sim::tuning::{EYE_OFFSET_STAND, PLAYER_LENGTH, PLAYER_RADIUS};
|
||||
@@ -107,7 +108,15 @@ struct VisualizerTargetQueries<'w, 's> {
|
||||
lights: Query<'w, 's, Entity, (With<LevelObject>, With<LightDesc>)>,
|
||||
spawns: Query<'w, 's, Entity, (With<LevelObject>, With<PlayerSpawn>)>,
|
||||
prefabs: Query<'w, 's, Entity, (With<LevelObject>, With<PrefabRef>)>,
|
||||
models: Query<'w, 's, Entity, (With<LevelObject>, With<ModelRef>)>,
|
||||
models: Query<
|
||||
'w,
|
||||
's,
|
||||
Entity,
|
||||
(
|
||||
With<LevelObject>,
|
||||
Or<(With<ModelRef>, With<SkinnedMeshRenderer>)>,
|
||||
),
|
||||
>,
|
||||
players: Query<'w, 's, Entity, With<Player>>,
|
||||
cameras: Query<'w, 's, Entity, With<PlayerCamera>>,
|
||||
project_suns: Query<'w, 's, Entity, With<ProjectSun>>,
|
||||
@@ -127,6 +136,7 @@ impl Plugin for EditorVisualizersPlugin {
|
||||
draw_audio_visualizers,
|
||||
draw_split_collider_visualizers,
|
||||
draw_post_process_volume_gizmos,
|
||||
draw_navigation_visualizers,
|
||||
)
|
||||
.chain()
|
||||
.run_if(scene_tools_active)
|
||||
@@ -135,6 +145,119 @@ impl Plugin for EditorVisualizersPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_navigation_visualizers(
|
||||
state: Res<crate::ui::navigation_inspector::NavigationEditorState>,
|
||||
mut gizmos: Gizmos,
|
||||
bounds: Query<(&NavigationBounds, &GlobalTransform), With<LevelObject>>,
|
||||
obstacles: Query<(&NavigationObstacle, &GlobalTransform), With<LevelObject>>,
|
||||
areas: Query<(&NavigationArea, &GlobalTransform), With<LevelObject>>,
|
||||
links: Query<(&NavigationLink, &GlobalTransform), With<LevelObject>>,
|
||||
) {
|
||||
for (value, global) in &bounds {
|
||||
let (_, rotation, center) = global.to_scale_rotation_translation();
|
||||
draw_box(
|
||||
&mut gizmos,
|
||||
center,
|
||||
rotation,
|
||||
value.half_extents,
|
||||
Color::srgba(0.12, 0.82, 0.78, 0.72),
|
||||
);
|
||||
}
|
||||
for (value, global) in &obstacles {
|
||||
let (_, rotation, center) = global.to_scale_rotation_translation();
|
||||
draw_box(
|
||||
&mut gizmos,
|
||||
center,
|
||||
rotation,
|
||||
value.half_extents,
|
||||
Color::srgba(1.0, 0.28, 0.22, 0.78),
|
||||
);
|
||||
}
|
||||
for (value, global) in &areas {
|
||||
let (_, rotation, center) = global.to_scale_rotation_translation();
|
||||
let color = if value.walkable {
|
||||
Color::srgba(0.32, 0.72, 1.0, 0.62)
|
||||
} else {
|
||||
Color::srgba(1.0, 0.55, 0.18, 0.72)
|
||||
};
|
||||
draw_box(&mut gizmos, center, rotation, value.half_extents, color);
|
||||
}
|
||||
for (value, global) in &links {
|
||||
let start = global.transform_point(value.start);
|
||||
let end = global.transform_point(value.end);
|
||||
let color = if value.enabled {
|
||||
Color::srgba(0.95, 0.78, 0.22, 0.95)
|
||||
} else {
|
||||
Color::srgba(0.48, 0.48, 0.5, 0.55)
|
||||
};
|
||||
gizmos.line(start, end, color);
|
||||
gizmos
|
||||
.sphere(Isometry3d::from_translation(start), 0.11, color)
|
||||
.resolution(12);
|
||||
gizmos
|
||||
.sphere(Isometry3d::from_translation(end), 0.11, color)
|
||||
.resolution(12);
|
||||
}
|
||||
|
||||
if state.show_mesh {
|
||||
if let Some(artifact) = &state.artifact {
|
||||
for layer in &artifact.mesh.layers {
|
||||
for polygon in &layer.polygons {
|
||||
for index in 0..polygon.vertices.len() {
|
||||
let a_index = polygon.vertices[index] as usize;
|
||||
let b_index =
|
||||
polygon.vertices[(index + 1) % polygon.vertices.len()] as usize;
|
||||
let Some(a) = navigation_vertex(layer, a_index) else {
|
||||
continue;
|
||||
};
|
||||
let Some(b) = navigation_vertex(layer, b_index) else {
|
||||
continue;
|
||||
};
|
||||
gizmos.line(
|
||||
a + Vec3::Y * 0.025,
|
||||
b + Vec3::Y * 0.025,
|
||||
Color::srgba(0.08, 0.9, 0.72, 0.7),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for edge in state.preview_path.windows(2) {
|
||||
gizmos.line(
|
||||
edge[0] + Vec3::Y * 0.08,
|
||||
edge[1] + Vec3::Y * 0.08,
|
||||
Color::srgba(0.98, 0.88, 0.2, 1.0),
|
||||
);
|
||||
}
|
||||
if let Some(start) = state.preview_path.first().copied() {
|
||||
gizmos
|
||||
.sphere(
|
||||
Isometry3d::from_translation(start + Vec3::Y * 0.08),
|
||||
0.16,
|
||||
Color::srgba(0.2, 1.0, 0.55, 1.0),
|
||||
)
|
||||
.resolution(14);
|
||||
}
|
||||
if let Some(end) = state.preview_path.last().copied() {
|
||||
gizmos
|
||||
.sphere(
|
||||
Isometry3d::from_translation(end + Vec3::Y * 0.08),
|
||||
0.16,
|
||||
Color::srgba(1.0, 0.28, 0.22, 1.0),
|
||||
)
|
||||
.resolution(14);
|
||||
}
|
||||
}
|
||||
|
||||
fn navigation_vertex(layer: &polyanya::Layer, index: usize) -> Option<Vec3> {
|
||||
let vertex = layer.vertices.get(index)?;
|
||||
let height = layer.height.get(index).copied().unwrap_or_default();
|
||||
let coords = vertex.coords + layer.offset;
|
||||
Some(Vec3::new(coords.x, height, coords.y))
|
||||
}
|
||||
|
||||
fn draw_audio_visualizers(
|
||||
viewport_mode: Res<EditorViewportMode>,
|
||||
settings: Res<EditorVisualizationSettings>,
|
||||
@@ -399,7 +522,13 @@ fn draw_visualizers(
|
||||
lights: Query<(Entity, &LightDesc, &GlobalTransform), With<LevelObject>>,
|
||||
spawns: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<PlayerSpawn>)>,
|
||||
prefabs: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<PrefabRef>)>,
|
||||
models: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<ModelRef>)>,
|
||||
models: Query<
|
||||
(Entity, &GlobalTransform),
|
||||
(
|
||||
With<LevelObject>,
|
||||
Or<(With<ModelRef>, With<SkinnedMeshRenderer>)>,
|
||||
),
|
||||
>,
|
||||
players: Query<(Entity, &GlobalTransform), With<Player>>,
|
||||
cameras: Query<(Entity, &GlobalTransform), With<PlayerCamera>>,
|
||||
project_suns: Query<(Entity, &GlobalTransform), With<ProjectSun>>,
|
||||
|
||||
Reference in new issue
Block a user