concinnity_core/components/
mod.rs1mod animation;
25mod animation_graph;
26mod animation_params;
27mod app_config;
28mod audio_bus;
29mod audio_clip;
30mod audio_command;
31mod audio_cue;
32mod audio_emitter;
33mod audio_occlusion_probe;
34mod behavior;
35mod block_type;
36mod camera3d;
37mod camera_probe;
38mod character_rig;
39mod character_shape;
40mod color_lut;
41pub mod compiled_programs;
42mod contact_event;
43mod controls_command;
44mod cubemap_texture;
45mod debug_hud;
46mod decal;
47mod despawn_request;
48mod directional_light;
49mod engine_defaults;
50mod entity_target;
51mod environment_map;
52mod file;
53mod font;
54mod fps_counter;
55mod frame_input;
56mod gamepad_button;
57mod gamepad_map;
58mod geometry;
59mod glass_panel;
60mod graphics_config;
61mod ground_probes;
62mod hit_region;
63mod input_key;
64mod instanced_prop;
65mod interact_event;
66mod key_binding;
67mod layout_container;
68mod lifetime;
69mod loading_overlay;
70mod material;
71mod mesh;
72mod model;
73mod nav_direction;
74mod particle_emitter;
75mod physics_config;
76mod physics_joint;
77mod play_cue;
78mod point_light;
79mod post_process_config;
80pub mod procedural_mesh;
81mod prop;
82mod prop_body;
83mod rect_area_light;
84mod reflection_probe;
85mod reparent_request;
86mod rigid_body;
87mod room;
88mod root_motion_event;
89mod scene;
90mod scene_command;
91mod screen;
92mod screen_command;
93mod screen_shown;
94mod scroll_panel;
95pub mod sdf_programs;
96pub mod sdf_volume;
97mod setting_command;
98pub mod shader;
99mod skeleton_pose;
100mod skinned_mesh;
101mod sky_rotation;
102mod spawn_request;
103mod spawner;
104mod spot_light;
105mod sprite;
106mod stat_hud;
107mod story;
108mod story_command;
109mod streaming_config;
110mod text_input;
111mod text_label;
112mod texture;
113mod trigger_volume;
114mod variables;
115mod visibility_request;
116mod volume_event;
117mod volumetric_fog;
118mod voxel_chunk;
119mod voxel_world;
120mod water_surface;
121mod window;
122
123mod body_dynamics;
126mod children;
127mod collider;
128mod global_transform;
129mod held;
130mod hidden;
131mod interactable;
132mod mesh_renderer;
133mod model_renderer;
134mod parent;
135mod pickup;
136mod prop_instance;
137mod render_handle;
138mod scene_member;
139mod transform;
140
141pub mod cook;
142pub mod stored;
143pub mod validate;
144
145#[cfg(test)]
148mod component_tests;
149
150pub use animation::{Animation, AnimationTrack, Keyframe, MorphKey};
151pub use animation_graph::{
152 AnimationBlend, AnimationBlendPoint, AnimationCondition, AnimationGraph, AnimationIkChain,
153 AnimationParam, AnimationState, AnimationTransition,
154};
155pub use animation_params::AnimationParams;
156pub use app_config::AppConfig;
157pub use audio_bus::AudioBus;
158pub use audio_clip::AudioClip;
159pub use audio_command::{AudioCommand, AudioTarget};
160pub use audio_cue::AudioCue;
161pub use audio_cue::CueKind;
162pub use audio_emitter::AudioEmitter;
163pub use audio_emitter::Rolloff;
164pub use audio_occlusion_probe::AudioOcclusionProbe;
165pub use behavior::Behavior;
166pub use behavior::BehaviorExpr;
167pub use behavior::BehaviorLiteral;
168pub use behavior::BehaviorLocal;
169pub use behavior::BehaviorNode;
170pub use behavior::BehaviorQuery;
171pub use behavior::BehaviorSource;
172pub use block_type::BlockType;
173pub use camera_probe::CameraProbe;
174pub use camera3d::Camera3D;
175pub use camera3d::CameraController;
176pub use camera3d::FollowController;
177pub use camera3d::FollowDrive;
178pub use character_rig::CharacterRig;
179pub use character_shape::CharacterShape;
180pub use character_shape::JointProportion;
181pub use character_shape::ResolvedSliders;
182pub use character_shape::ShapeSlider;
183pub use color_lut::ColorLut;
184pub use contact_event::ContactEvent;
185pub use controls_command::ControlsCommand;
186pub use cubemap_texture::CubemapTexture;
187pub use decal::Decal;
188pub use despawn_request::DespawnRequest;
189pub use directional_light::DirectionalLight;
190pub use engine_defaults::EngineDefaults;
191pub use entity_target::EntityTarget;
192pub use environment_map::EnvironmentMap;
193pub use file::File;
194pub use file::FileKind;
195pub use font::Font;
196pub use frame_input::FrameInput;
197pub use gamepad_button::GamepadButton;
198pub use gamepad_map::{GamepadAction, GamepadMap};
199pub use geometry::{
200 GlassPanelGeometry, InstancedPropGeometry, RectAreaLightGeometry, SPOT_MAX_ANGLE_DEG,
201 SpotLightGeometry,
202};
203pub use glass_panel::GlassPanel;
204pub use graphics_config::GraphicsConfig;
205pub use graphics_config::ShadowUpdate;
206pub use ground_probes::{GroundProbe, GroundProbes};
207pub use hit_region::HitRegion;
208pub use input_key::InputKey;
209pub use instanced_prop::InstanceTransform;
210pub use instanced_prop::InstancedProp;
211pub use interact_event::InteractEvent;
212pub use key_binding::KeyBinding;
213pub use layout_container::Justify;
214pub use layout_container::LabelBox;
215pub use layout_container::LabelPlacement;
216pub use layout_container::LayoutContainer;
217pub use layout_container::LayoutRow;
218pub use lifetime::Lifetime;
219pub use loading_overlay::LoadingOverlay;
220pub use material::Material;
221pub use mesh::Mesh;
222pub use mesh::VertexData;
223pub use model::Model;
224pub use model::SubMeshRef;
225pub use nav_direction::NavDirection;
226pub use particle_emitter::ParticleEmitter;
227pub use physics_config::PhysicsConfig;
228pub use physics_joint::PhysicsJoint;
229pub use physics_joint::PhysicsJointKind;
230pub use play_cue::PlayCue;
231pub use point_light::PointLight;
232pub use post_process_config::AaMode;
233pub use post_process_config::IndirectLighting;
234pub use post_process_config::PostProcessConfig;
235pub use post_process_config::PostProcessResolve;
236pub use post_process_config::ReflectionBlurResolution;
237pub use post_process_config::SsgiResolution;
238pub use post_process_config::UpscaleQuality;
239pub use post_process_config::UpscalerBackend;
240pub use procedural_mesh::ProceduralMesh;
241pub use prop::Prop;
242pub use prop::PropCollider;
243pub use prop_body::PropBody;
244pub use rect_area_light::RectAreaLight;
245pub use reflection_probe::ReflectionProbe;
246pub use reparent_request::ReparentRequest;
247pub use rigid_body::RigidBody;
248pub use room::Room;
249pub use root_motion_event::RootMotionEvent;
250pub use scene::Scene;
251pub use scene_command::SceneCommand;
252pub use screen::Screen;
253pub use screen::ScreenInput;
254pub use screen_command::ScreenCommand;
255pub use screen_shown::ScreenShown;
256pub use scroll_panel::ScrollGroup;
257pub use scroll_panel::ScrollPanel;
258pub use scroll_panel::ScrollRow;
259pub use sdf_volume::SdfVolume;
260pub use setting_command::{SettingCommand, SettingOp};
261pub use shader::{Shader, ShaderPrograms, ShaderStage};
262pub use skeleton_pose::SkeletonPose;
263pub use skinned_mesh::CharacterCapsule;
264pub use skinned_mesh::MorphDelta;
265pub use skinned_mesh::SkeletonJoint;
266pub use skinned_mesh::SkinnedMesh;
267pub use skinned_mesh::SkinnedVertexData;
268pub use skinned_mesh::{SkinnedMeshGeometry, build_skeleton_from_joint_defs};
269pub use sky_rotation::SkyRotation;
270pub use spawn_request::SpawnRequest;
271pub use spawner::Spawner;
272pub use spot_light::SpotLight;
273pub use sprite::Sprite;
274pub use sprite::SpriteFit;
275pub use story::Story;
276pub use story::StoryChoice;
277pub use story::StoryCompareOp;
278pub use story::StoryCondition;
279pub use story::StoryGate;
280pub use story::StoryImage;
281pub use story::StoryNode;
282pub use story::StoryOp;
283pub use story::StoryPage;
284pub use story::StoryPlayback;
285pub use story::StoryReload;
286pub use story::StoryScaffold;
287pub use story::StorySpeaker;
288pub use story::StoryStage;
289pub use story_command::StoryCommand;
290pub use streaming_config::StreamingConfig;
291pub use text_input::TextInput;
292pub use text_label::TextAlign;
293pub use text_label::TextLabel;
294pub use texture::Texture;
295pub use trigger_volume::TriggerFilter;
296pub use trigger_volume::TriggerVolume;
297pub use variables::VariableDecl;
298pub use variables::Variables;
299pub use visibility_request::VisibilityRequest;
300pub use volume_event::VolumeEvent;
301pub use volumetric_fog::VolumetricFog;
302pub use voxel_chunk::VoxelChunk;
303pub use voxel_world::VoxelWorld;
304pub use water_surface::MAX_WATER_WAVES;
305pub use water_surface::WaterSurface;
306pub use water_surface::WaterWave;
307pub use window::Window;
308pub use window::WindowMode;
309
310pub use body_dynamics::BodyDynamics;
312pub use children::Children;
313pub use collider::Collider;
314pub use global_transform::GlobalTransform;
315pub use held::Held;
316pub use hidden::Hidden;
317pub use interactable::Interactable;
318pub use mesh_renderer::MeshRenderer;
319pub use model_renderer::ModelRenderer;
320pub use parent::Parent;
321pub use pickup::Pickup;
322pub use prop_instance::PropInstance;
323pub use render_handle::RenderHandle;
324pub use scene_member::SceneMember;
325pub use transform::Transform;
326
327pub use debug_hud::DebugHud;
329pub use fps_counter::FpsCounter;
330pub use stat_hud::StatHud;
331
332pub(crate) fn path_extension(path: &str) -> Option<&str> {
337 let name = path.rsplit(['/', '\\']).next().unwrap_or(path);
338 match name.rsplit_once('.') {
339 Some((stem, ext)) if !stem.is_empty() => Some(ext),
340 _ => None,
341 }
342}
343
344pub use post_process_config::{DEFAULT_SSGI_RAYS, DEFAULT_SSGI_STEPS};
347#[cfg(test)]
348mod tests {
349 use super::*;
354 use crate::ecs::asset_id::AssetId;
355 use crate::ecs::{Component, PayloadLocator};
356
357 fn exercise<C: Component + Default + serde::Serialize>() {
361 let bytes = postcard::to_allocvec(&C::default()).expect("default serializes");
362 let mut comp = C::from_baked(&bytes).expect("baked bytes deserialize");
363 comp.inject_name(AssetId::default());
364 comp.inject_locator(PayloadLocator {
365 blob_index: 0,
366 offset: 0,
367 len: 0,
368 });
369
370 let mut widened = bytes.clone();
374 widened.push(0);
375 assert!(
376 C::from_baked(&widened).is_err(),
377 "{} accepted a record with an unread trailing byte",
378 core::any::type_name::<C>()
379 );
380 }
381
382 #[test]
383 fn path_extension_matches_std_path_semantics() {
384 assert_eq!(path_extension("foo.metal"), Some("metal"));
385 assert_eq!(path_extension("shaders/pbr.hlsl"), Some("hlsl"));
386 assert_eq!(path_extension("a.b.glsl"), Some("glsl"));
387 assert_eq!(path_extension("plain"), None);
390 assert_eq!(path_extension(".bashrc"), None);
391 assert_eq!(path_extension("dir.v2/plain"), None);
392 }
393
394 #[test]
395 fn simple_assets_round_trip_defaults() {
396 exercise::<Scene>();
397 exercise::<Model>();
398 exercise::<ProceduralMesh>();
399 exercise::<WaterSurface>();
400 exercise::<Decal>();
401 exercise::<CharacterShape>();
402 exercise::<ParticleEmitter>();
403 exercise::<VoxelWorld>();
404 exercise::<VoxelChunk>();
405 }
406}