1#![allow(
25 clippy::type_complexity,
26 clippy::unwrap_or_default,
27 dead_code,
28 unused_variables,
29 unused_imports,
30 unused_mut,
31 unused_parens
32)]
33
34mod kvasir;
35mod material;
36pub mod error;
37
38pub use material::builtins;
40pub use material::{CompiledMaterial, MaterialCompiler, MaterialError, MaterialGraph, MaterialOp};
41
42pub mod accessibility;
43pub mod ai;
44mod api;
45pub mod draw;
46pub mod filter;
47pub mod passes;
48pub mod pyramid;
49pub mod renderer;
50mod surtr_util;
51pub mod types;
52pub mod vertex;
53
54pub mod heim;
55pub use heim::SkylinePacker;
56
57pub mod subsystems;
61pub use subsystems::RendererConfig;
62
63#[cfg(test)]
64mod tests {
65 use super::*;
66
67 use super::heim::SkylinePacker;
68
69 #[test]
70 fn test_shelf_packer_basic() {
71 let mut packer = SkylinePacker::new(100, 100);
72 assert_eq!(packer.pack(10, 10), Some((0, 0)));
73 assert_eq!(packer.pack(20, 15), Some((10, 0)));
74 }
75
76 #[test]
77 fn test_shelf_packer_wrap() {
78 let mut packer = SkylinePacker::new(100, 100);
79 packer.pack(60, 10);
80 assert_eq!(packer.pack(50, 20), Some((0, 10)));
81 }
82
83 #[test]
84 fn test_parse_svg_animations() {
85 let svg = r##"
86 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
87 <g id="spinner">
88 <animateTransform attributeName="transform" type="rotate" from="0" to="360" dur="2s" />
89 </g>
90 <circle id="pulse">
91 <animate attributeName="opacity" from="0.5" to="1.0" dur="0.5s" />
92 </circle>
93 <!-- Edge cases: xlink:href, ms suffix, values list -->
94 <rect>
95 <animate xlink:href="#myRect" attributeName="x" values="10; 20; 30" dur="500ms" />
96 </rect>
97 </svg>
98 "##;
99 let anims = draw::parse_svg_animations(svg.as_bytes());
100 assert_eq!(anims.len(), 3);
101
102 assert_eq!(anims[0].target_id, "spinner");
103 assert_eq!(anims[0].keyframe_values, vec![0.0, 360.0]);
104
105 assert_eq!(anims[1].target_id, "pulse");
106 assert_eq!(anims[1].attribute_name, "opacity");
107 assert_eq!(anims[1].duration, 0.5);
108 assert_eq!(anims[1].keyframe_values, vec![0.5, 1.0]);
109
110 assert_eq!(anims[2].target_id, "myRect");
111 assert_eq!(anims[2].attribute_name, "x");
112 assert_eq!(anims[2].duration, 0.5); assert_eq!(anims[2].keyframe_values, vec![10.0, 20.0, 30.0]);
114 }
115
116 #[test]
117 fn test_shelf_packer_full() {
118 let mut packer = SkylinePacker::new(10, 10);
119 assert_eq!(packer.pack(11, 5), None);
120 assert_eq!(packer.pack(5, 11), None);
121 }
122}
123
124#[cfg(target_arch = "wasm32")]
132pub(crate) const WGSL_COMMON: &str = include_str!("shaders/common_wasm.wgsl");
133#[cfg(not(target_arch = "wasm32"))]
134pub(crate) const WGSL_COMMON: &str = include_str!("shaders/common.wgsl");
135
136pub(crate) const WGSL_SHAPES: &str = include_str!("shaders/shapes.wgsl");
137
138#[cfg(target_arch = "wasm32")]
139pub(crate) const WGSL_MATERIAL_OPAQUE: &str = include_str!("shaders/material_opaque_wasm.wgsl");
140#[cfg(not(target_arch = "wasm32"))]
141pub(crate) const WGSL_MATERIAL_OPAQUE: &str = include_str!("shaders/material_opaque.wgsl");
142
143pub(crate) const WGSL_MATERIAL_GLASS: &str = include_str!("shaders/material_glass.wgsl");
144pub(crate) const WGSL_BIFROST: &str = include_str!("shaders/bifrost.wgsl");
145
146#[cfg(target_arch = "wasm32")]
147pub(crate) const WGSL_BLOOM: &str = include_str!("shaders/bloom_wasm.wgsl");
148#[cfg(not(target_arch = "wasm32"))]
149pub(crate) const WGSL_BLOOM: &str = include_str!("shaders/bloom.wgsl");
150
151pub(crate) const WGSL_COLOR_BLIND: &str = include_str!("shaders/color_blind.wgsl");
152pub(crate) const WGSL_TONEMAP: &str = include_str!("shaders/tonemap.wgsl");
153pub(crate) const WGSL_PARTICLES: &str = include_str!("shaders/particles.wgsl");
154
155pub mod color_blindness;
156
157pub use color_blindness::ColorBlindMode;
159
160pub use accesskit::{
163 ActionHandler, ActionRequest, ActivationHandler, DeactivationHandler, Node, NodeId, Role, Tree,
164 TreeId, TreeUpdate,
165};
166pub use accesskit_winit::Adapter as ShieldWallAdapter;
167
168pub use cvkg_core::{ColorTheme, SceneUniforms};
170
171pub use renderer::GpuRenderer;
172
173pub use types::{SvgAnimation, SvgModel};
175pub use vertex::{InstanceData, Vertex};