Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(cursor): sculpt original cursor themes in 3D
EtienneLescot856a30901e5f
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rsindex ed14609d8..11b6c6bc5 100644--- a/crates/compositor/src/compositor_linux.rs+++ b/crates/compositor/src/compositor_linux.rs@@ -337,8 +337,8 @@ pub struct Compositor {/// touche depuis appartient au jeu actif et ne peut pas etre evince -- voir/// `cached_image`.img_frame_start: std::cell::Cell<u64>,- /// Champs de distance des sprites de curseur (mode 15), R16F, par chemin, avec leur forme.- /// Pas d'eviction : seuls les seize sprites du theme par defaut y passent (~2,6 Mo en tout).+ /// Champs et reliefs des sprites de curseur (mode 15), RG16F, par chemin, avec leur forme.+ /// Pas d'eviction : l'ensemble des cartes livrees reste inferieur a quelques dizaines de Mo.sdf_cache: RefCell<std::collections::HashMap<String, (wgpu::Texture, SpriteShape)>>,/// Copie mipmappee de la frame composee, lue par les annotations « flou »@@ -1317,13 +1317,19 @@ impl Compositor {Ok((tex, w, h))}- /// Champ de distance du sprite `path` (binding 2 du mode 15) et sa forme, calcules au+ /// Champ et relief du sprite `path` (binding 2 du mode 15) et sa forme, calcules au/// premier appel. Parite `compositor_windows::cursor_sdf`.- fn cursor_sdf(&self, path: &str) -> Result<(wgpu::Texture, SpriteShape)> {- if let Some(hit) = self.sdf_cache.borrow().get(path) {+ fn cursor_sdf(+ &self,+ path: &str,+ depth_path: Option<&str>,+ ) -> Result<(wgpu::Texture, SpriteShape)> {+ let cache_key = format!("{path}\0{}", depth_path.unwrap_or_default());+ if let Some(hit) = self.sdf_cache.borrow().get(&cache_key) {return Ok(hit.clone());}- let sdf = crate::cursor_sdf::CursorSdf::load(path)?;+ let sdf = crate::cursor_sdf::CursorSdf::load_with_depth(path, depth_path)?;+ let texels = sdf.rg16_bytes();let size = wgpu::Extent3d { width: sdf.width, height: sdf.height, depth_or_array_layers: 1 };let tex = self.gpu.device.create_texture(&wgpu::TextureDescriptor {label: Some("cursor-sdf"),@@ -1331,7 +1337,7 @@ impl Compositor {mip_level_count: 1,sample_count: 1,dimension: wgpu::TextureDimension::D2,- format: wgpu::TextureFormat::R16Float,+ format: wgpu::TextureFormat::Rg16Float,usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,view_formats: &[],});@@ -1342,16 +1348,16 @@ impl Compositor {origin: wgpu::Origin3d::ZERO,aspect: wgpu::TextureAspect::All,},- &sdf.f16_bytes(),+ &texels,wgpu::TexelCopyBufferLayout {offset: 0,- bytes_per_row: Some(sdf.width * 2),+ bytes_per_row: Some(sdf.width * 4),rows_per_image: Some(sdf.height),},size,);let entry = (tex, sdf.shape);- self.sdf_cache.borrow_mut().insert(path.to_string(), entry.clone());+ self.sdf_cache.borrow_mut().insert(cache_key, entry.clone());Ok(entry)}@@ -2833,7 +2839,7 @@ impl Compositor {// Curseur modelise (mode 15) : ce meme sprite extrude, `plan_cursor` en a tire la// pose. Sprite au binding 1 (texY), champ au binding 2 (texU). Parite Windows/macOS.if let Some(pose) = plan.model {- match self.cursor_sdf(&sprite.path) {+ match self.cursor_sdf(&sprite.path, sprite.model_depth_path.as_deref()) {Ok((sdf, shape)) => {let shape = SpriteShape { hotspot, ..shape };let sdf_view = sdf.create_view(&wgpu::TextureViewDescriptor::default());diff --git a/crates/compositor/src/compositor_macos.rs b/crates/compositor/src/compositor_macos.rsindex 42f35f9f5..da7be6c05 100644--- a/crates/compositor/src/compositor_macos.rs+++ b/crates/compositor/src/compositor_macos.rs@@ -282,8 +282,8 @@ pub struct Compositor {/// Valeur de `img_tick` au début de la frame en cours. Tout ce qui a été touché depuis/// appartient au jeu actif et ne peut pas être évincé — voir `cached_image`.img_frame_start: std::cell::Cell<u64>,- /// Champs de distance des sprites de curseur (mode 15), R16F, par chemin, avec leur forme.- /// Pas d'éviction : seuls les seize sprites du thème par défaut y passent (~2,6 Mo en tout).+ /// Champs et reliefs des sprites de curseur (mode 15), RG16F, par chemin, avec leur forme.+ /// Pas d'éviction : l'ensemble des cartes livrées reste inférieur à quelques dizaines de Mo.sdf_cache: RefCell<std::collections::HashMap<String, (metal::Texture, crate::frame_geometry::SpriteShape)>,>,@@ -908,21 +908,23 @@ impl Compositor {Ok((tex, w, h))}- /// Champ de distance du sprite `path` (texture(4) du mode 15) et sa forme, calculés au- /// premier appel. Parité `compositor_windows::cursor_sdf`. R16Float : filtrable sur tous+ /// Champ et relief du sprite `path` (texture(4) du mode 15) et sa forme, calculés au+ /// premier appel. Parité `compositor_windows::cursor_sdf`. RG16Float : filtrable sur tous/// les GPU Apple, contrairement au R32Float.fn cursor_sdf(&self,path: &str,+ depth_path: Option<&str>,) -> Result<(metal::Texture, crate::frame_geometry::SpriteShape)> {- if let Some(hit) = self.sdf_cache.borrow().get(path) {+ let cache_key = format!("{path}\0{}", depth_path.unwrap_or_default());+ if let Some(hit) = self.sdf_cache.borrow().get(&cache_key) {return Ok(hit.clone());}- let sdf = crate::cursor_sdf::CursorSdf::load(path)?;- let texels = sdf.f16_bytes();+ let sdf = crate::cursor_sdf::CursorSdf::load_with_depth(path, depth_path)?;+ let texels = sdf.rg16_bytes();let tex = make_texture(&self.gpu.device,- metal::MTLPixelFormat::R16Float,+ metal::MTLPixelFormat::RG16Float,sdf.width,sdf.height,metal::MTLStorageMode::Shared,@@ -935,10 +937,10 @@ impl Compositor {},0,texels.as_ptr() as *const std::ffi::c_void,- (sdf.width * 2) as u64,+ (sdf.width * 4) as u64,);let entry = (tex, sdf.shape);- self.sdf_cache.borrow_mut().insert(path.to_string(), entry.clone());+ self.sdf_cache.borrow_mut().insert(cache_key, entry.clone());Ok(entry)}@@ -1976,7 +1978,7 @@ impl Compositor {let (tex, iw, ih) = self.cached_image(sprite.path.as_str())?;// Sans champ de distance, repli sur le sprite plat plutôt qu'aucun curseur. Parité Linux.if let Some(pose) = model {- match self.cursor_sdf(sprite.path.as_str()) {+ match self.cursor_sdf(sprite.path.as_str(), sprite.model_depth_path.as_deref()) {Ok((sdf, shape)) => {let shape = crate::frame_geometry::SpriteShape {hotspot: [sprite.hotspot_x, sprite.hotspot_y],diff --git a/crates/compositor/src/compositor_windows.rs b/crates/compositor/src/compositor_windows.rsindex 8a95d1f06..6be6f7ff8 100644--- a/crates/compositor/src/compositor_windows.rs+++ b/crates/compositor/src/compositor_windows.rs@@ -179,8 +179,8 @@ pub struct Compositor {/// Valeur de `img_tick` au début de la frame en cours. Tout ce qui a été touché depuis/// appartient au jeu actif et ne peut pas être évincé — voir `cached_image`.img_frame_start: std::cell::Cell<u64>,- /// Champs de distance des sprites de curseur (mode 15), R16F, par chemin, avec leur forme.- /// Pas d'éviction : seuls les seize sprites du thème par défaut y passent (~2,6 Mo en tout).+ /// Champs et reliefs des sprites de curseur (mode 15), RG16F, par chemin, avec leur forme.+ /// Pas d'éviction : l'ensemble des cartes livrées reste inférieur à quelques dizaines de Mo.sdf_cache: RefCell<HashMap<String, (ID3D11ShaderResourceView, SpriteShape)>>,/// Masque de segmentation du sujet webcam, R8 à la résolution du modèle. Écrit par/// `set_webcam_mask` depuis le thread d'inférence, lu au moment de dessiner la webcam.@@ -1093,19 +1093,24 @@ impl Compositor {Ok((srv.unwrap(), w, h))}- /// Champ de distance du sprite `path` (t4 du mode 15) et sa forme, calculés au premier appel.- unsafe fn cursor_sdf(&self, path: &str) -> Result<(ID3D11ShaderResourceView, SpriteShape)> {- if let Some(hit) = self.sdf_cache.borrow().get(path) {+ /// Champ et carte de relief du sprite `path` (t4 du mode 15) et sa forme, calculés au premier appel.+ unsafe fn cursor_sdf(+ &self,+ path: &str,+ depth_path: Option<&str>,+ ) -> Result<(ID3D11ShaderResourceView, SpriteShape)> {+ let cache_key = format!("{path}\0{}", depth_path.unwrap_or_default());+ if let Some(hit) = self.sdf_cache.borrow().get(&cache_key) {return Ok(hit.clone());}- let sdf = crate::cursor_sdf::CursorSdf::load(path)?;- let texels = sdf.f16_bytes();+ let sdf = crate::cursor_sdf::CursorSdf::load_with_depth(path, depth_path)?;+ let texels = sdf.rg16_bytes();let td = D3D11_TEXTURE2D_DESC {Width: sdf.width,Height: sdf.height,MipLevels: 1,ArraySize: 1,- Format: DXGI_FORMAT_R16_FLOAT,+ Format: DXGI_FORMAT_R16G16_FLOAT,SampleDesc: DXGI_SAMPLE_DESC { Count: 1, Quality: 0 },Usage: D3D11_USAGE_IMMUTABLE,BindFlags: D3D11_BIND_SHADER_RESOURCE.0 as u32,@@ -1114,7 +1119,7 @@ impl Compositor {};let init = D3D11_SUBRESOURCE_DATA {pSysMem: texels.as_ptr() as *const c_void,- SysMemPitch: sdf.width * 2,+ SysMemPitch: sdf.width * 4,SysMemSlicePitch: 0,};let mut tex: Option<ID3D11Texture2D> = None;@@ -1122,7 +1127,7 @@ impl Compositor {let mut srv: Option<ID3D11ShaderResourceView> = None;self.dev.CreateShaderResourceView(&tex.unwrap(), None, Some(&mut srv))?;let entry = (srv.unwrap(), sdf.shape);- self.sdf_cache.borrow_mut().insert(path.to_string(), entry.clone());+ self.sdf_cache.borrow_mut().insert(cache_key, entry.clone());Ok(entry)}@@ -1535,7 +1540,7 @@ impl Compositor {// Sans champ de distance, repli sur le sprite plat plutôt que sur le curseur math.// Parité Linux.if let Some(pose) = model {- match self.cursor_sdf(path) {+ match self.cursor_sdf(path, sprite.model_depth_path.as_deref()) {Ok((sdf, shape)) => {let shape =SpriteShape { hotspot: [sprite.hotspot_x, sprite.hotspot_y], ..shape };diff --git a/crates/compositor/src/cursor_sdf.rs b/crates/compositor/src/cursor_sdf.rsindex 9bd449ed8..c26ba5ee5 100644--- a/crates/compositor/src/cursor_sdf.rs+++ b/crates/compositor/src/cursor_sdf.rs@@ -14,9 +14,8 @@//! en tiraient des stries sur les flancs. Le flou efface l'escalier ; il laisse en place un bord//! droit (le champ y est affine) et n'arrondit un coin que d'un demi-texel source.//!-//! La texture (R16F, même rect que le sprite) garde les distances telles quelles : un demi-flottant-//! est exact au millième près autour de zéro, là où la silhouette se joue, et il est filtrable sur-//! les trois backends (D3D11, Metal, wgpu), contrairement au R32F.+//! La texture RG16F, même rect que le sprite, stocke le champ de distance dans R et le relief de la+//! face dans G. Le relief vient d'une carte PNG en niveaux de gris, étirée sur le même suréchantillon.use anyhow::{anyhow, Result};@@ -35,6 +34,8 @@ pub struct CursorSdf {/// Distances signées (unités du modèle, négatives dedans), ligne par ligne, texels centrés/// comme ceux du sprite : la texture couvre exactement son rect.pub texels: Vec<f32>,+ /// Hauteur du dessus au même point, en unités du modèle.+ pub heights: Vec<f32>,/// La forme, hotspot nul : l'appelant pose celui de la scène.pub shape: SpriteShape,}@@ -42,6 +43,11 @@ pub struct CursorSdf {impl CursorSdf {/// Décode `path` (chemin ou data URI, comme les sprites) et en tire le champ.pub fn load(path: &str) -> Result<CursorSdf> {+ Self::load_with_depth(path, None)+ }++ /// Décode le sprite et une éventuelle carte de relief PNG alignée sur lui.+ pub fn load_with_depth(path: &str, depth_path: Option<&str>) -> Result<CursorSdf> {let img = if let Some(bytes) = crate::frame_geometry::decode_data_uri(path) {image::load_from_memory(&bytes)} else {@@ -50,11 +56,27 @@ impl CursorSdf {.map_err(|e| anyhow!("sprite {path} : {e}"))?.to_rgba8();let (w, h) = img.dimensions();- Ok(CursorSdf::from_rgba(img.as_raw(), w, h))+ let heights = if let Some(depth_path) = depth_path {+ let depth = image::open(depth_path)+ .map_err(|e| anyhow!("relief {depth_path} : {e}"))?+ .to_luma8();+ if depth.dimensions() != (w, h) {+ return Err(anyhow!("relief {depth_path} : taille différente du sprite {path}"));+ }+ Some(depth.into_raw())+ } else {+ None+ };+ Ok(CursorSdf::from_rgba_with_height(img.as_raw(), w, h, heights.as_deref()))}/// `rgba` : `w`×`h` texels RGBA8, alpha droit.pub fn from_rgba(rgba: &[u8], w: u32, h: u32) -> CursorSdf {+ Self::from_rgba_with_height(rgba, w, h, None)+ }++ /// `heights`, quand présent, est une image grise `w`×`h` (255 = relief maximal).+ fn from_rgba_with_height(rgba: &[u8], w: u32, h: u32, heights: Option<&[u8]>) -> CursorSdf {const K: usize = SDF_UPSAMPLE;// Une marge de texels transparents : un texel intérieur collé au bord du sprite trouve// ainsi son voisin extérieur, qui n'existe pas dans le rect.@@ -86,6 +108,8 @@ impl CursorSdf {let scale = 1.0 / (K * w.max(h)) as f32;let mut texels = Vec::with_capacity(fw * fh);+ let mut relief = Vec::with_capacity(fw * fh);+ let mut max_height = 0.0f32;let mut top_row = fh;for fy in 0..fh {for fx in 0..fw {@@ -98,6 +122,25 @@ impl CursorSdf {to_inside[g].sqrt().min((gw + gh) as f64) - 0.5};texels.push(d as f32 * scale);++ let height = if let Some(heights) = heights {+ let sx = (fx as f32 + 0.5) / K as f32 - 0.5;+ let sy = (fy as f32 + 0.5) / K as f32 - 0.5;+ let (x0, y0) = (sx.floor(), sy.floor());+ let (tx, ty) = (sx - x0, sy - y0);+ let (x0, y0) = (x0 as isize, y0 as isize);+ let at = |x: isize, y: isize| {+ let (x, y) = (x.clamp(0, w as isize - 1) as usize, y.clamp(0, h as isize - 1) as usize);+ heights[y * w as usize + x] as f32 / 255.0+ };+ let top = at(x0, y0) * (1.0 - tx) + at(x0 + 1, y0) * tx;+ let bottom = at(x0, y0 + 1) * (1.0 - tx) + at(x0 + 1, y0 + 1) * tx;+ (top * (1.0 - ty) + bottom * ty) * crate::frame_geometry::MODEL_RELIEF_MAX+ } else {+ 0.0+ };+ relief.push(height);+ max_height = max_height.max(height);}}for _ in 0..2 {@@ -108,19 +151,32 @@ impl CursorSdf {width: fw as u32,height: fh as u32,texels,+ heights: relief,shape: SpriteShape {size: [w as f32 / long, h as f32 / long],hotspot: [0.0; 2],top: top_row as f32 / fh as f32,+ max_height,},}}- /// Les texels en demi-flottants petit-boutistes, pour une texture R16F.+ /// Le champ de distance seul en demi-flottants petit-boutistes, pour les tests mono-canal.pub fn f16_bytes(&self) -> Vec<u8> {self.texels.iter().flat_map(|&d| f16_bits(d).to_le_bytes()).collect()}+ /// Le champ et le relief intercalés en demi-flottants petit-boutistes, pour une texture RG16F.+ pub fn rg16_bytes(&self) -> Vec<u8> {+ self.texels+ .iter()+ .zip(&self.heights)+ .flat_map(|(&distance, &height)| {+ f16_bits(distance).to_le_bytes().into_iter().chain(f16_bits(height).to_le_bytes())+ })+ .collect()+ }+/// Le champ en `uv` (0..1 sur le rect du sprite), filtré comme le sampler des shaders :/// bilinéaire, bord prolongé. Miroir CPU de l'échantillonnage du mode 15.#[cfg(test)]@@ -410,4 +466,22 @@ mod tests {assert!(sdf.sample([0.9, 0.1]) > 0.0);assert_eq!(sdf.f16_bytes().len(), sdf.texels.len() * 2);}++ #[test]+ fn each_original_theme_loads_its_aligned_sculpted_faces() {+ let root = concat!(env!("CARGO_MANIFEST_DIR"), "/../../public/cursors/");+ for theme in ["studio-ink", "prism-glow", "pop-coral", "pixel-candy", "star-sprout"] {+ for state in ["arrow", "pointer"] {+ let face = format!("{root}{theme}/model-{state}.png");+ let depth = format!("{root}{theme}/model-{state}-depth.png");+ let sdf = CursorSdf::load_with_depth(&face, Some(&depth))+ .unwrap_or_else(|error| panic!("{theme}/{state}: {error}"));+ assert_eq!(sdf.width, 128 * SDF_UPSAMPLE as u32, "{theme}/{state}");+ assert_eq!(sdf.height, 128 * SDF_UPSAMPLE as u32, "{theme}/{state}");+ assert!(sdf.shape.max_height > 0.02, "{theme}/{state} has no sculpted relief");+ assert_eq!(sdf.shape.max_height, crate::frame_geometry::MODEL_RELIEF_MAX);+ assert_eq!(sdf.rg16_bytes().len(), sdf.texels.len() * 4, "{theme}/{state}");+ }+ }+ }}diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rsindex 86c85fb3b..9cb5c411a 100644--- a/crates/compositor/src/frame_geometry.rs+++ b/crates/compositor/src/frame_geometry.rs@@ -3283,16 +3283,15 @@ pub fn plan_cursor(g: &FrameGeometry, input: &CursorPlanInput) -> Option<CursorP// ============ Curseur modélisé (mode 15) ============//-// Le sprite de l'état courant (thème par défaut) devient un OBJET : sa silhouette extrudée, lancée-// de rayons par pixel dans le shader, éclairée, et qui porte une vraie ombre sur l'écran. La-// silhouette est le champ de distance signé que `cursor_sdf` tire de l'alpha du sprite ; le dessus-// porte l'art du sprite, les flancs et le chanfrein la couleur de son bord. Rust ne fait ici que la-// pose (fonction pure de `t`), la caméra et la boîte de dessin ; les trois shaders font le reste-// avec les MÊMES constantes.+// Le sprite de l'état courant devient un OBJET : sa silhouette et son relief rasterisé sont lancés+// de rayons par pixel dans le shader, éclairés, et portent une vraie ombre sur l'écran. Le champ de+// distance vient de l'alpha ; le second canal porte la hauteur de face propre au modèle. Le dessus+// garde son art, et les flancs prennent sa matière de bord. Rust calcule la pose, la caméra et la+// boîte de dessin ; les trois shaders font le reste avec les MÊMES constantes.//// Repère du MODÈLE : unité = plus grand côté du sprite (`size_px`, la taille du curseur), origine-// au hotspot de la face du dessus, x à droite, y vers le bas, z vers la caméra ; le modèle occupe-// z de -MODEL_THICK à 0.+// au hotspot de la face du dessus, x à droite, y vers le bas, z vers la caméra ; le dessous reste+// en z = -MODEL_THICK, l'arête est en z = 0 et le relief monte jusqu'à MODEL_RELIEF_MAX.//// Emplacements du `LayerCB` au mode 15 (128 octets, inchangés) :// dst rect de dessin (sortie 0..1) : boîte du modèle ET de son ombre@@ -3312,12 +3311,14 @@ pub fn plan_cursor(g: &FrameGeometry, input: &CursorPlanInput) -> Option<CursorP// mb.zw translation du plan dans le repère caméra (px, `TiltedQuad::offset`) : le// plan vaut `R·p + (mb.zw, 0)`, œil en (0, 0, P). Nulle sous un angle fixe.// radius_px rapport w/h du sprite : sa taille (unités) en découle, plus grand côté = 1-// Textures : le sprite RGBA (alpha droit) et son champ R16F (`cursor_sdf`), sur le même rect.+// Textures : le sprite RGBA (alpha droit) et le champ RG16F (`cursor_sdf`, distance + hauteur), sur le même rect.// Windows et macOS : sprite en t2/texture(2) (`texImg`), champ en t4/texture(4) (`texSdf`).// Linux : sprite au binding 1 (`texY`), champ au binding 2 (`texU`).-/// Épaisseur du modèle : la face du dessus est en z = 0, celle du dessous en z = -épaisseur.+/// Épaisseur du modèle : l'arête est à z = 0, celle du dessous à z = -épaisseur.pub const MODEL_THICK: f32 = 0.19;+/// Relief maximal des faces sculptées, en unités du modèle.+pub const MODEL_RELIEF_MAX: f32 = 0.12;/// Rayon du chanfrein arrondi des arêtes du dessus et du dessous.pub const MODEL_BEVEL: f32 = 0.045;/// Direction VERS la lumière, repère caméra (x droite, y bas, z vers le spectateur) : en haut à@@ -3367,6 +3368,8 @@ pub struct SpriteShape {pub hotspot: [f32; 2],/// Haut de la silhouette (alpha 0,5), fraction de la hauteur du sprite.pub top: f32,+ /// Hauteur maximale de la face au-dessus de l'arête du sprite, en unités du modèle.+ pub max_height: f32,}impl SpriteShape {@@ -3378,7 +3381,10 @@ impl SpriteShape {/// La boîte englobante du modèle écrasé à `squash` : le rect du sprite, sur toute l'épaisseur.fn model_box(&self, squash: f32) -> ([f32; 3], [f32; 3]) {let [x, y] = self.origin();- ([x, y, -MODEL_THICK * squash], [x + self.size[0], y + self.size[1], 0.0])+ (+ [x, y, -MODEL_THICK * squash],+ [x + self.size[0], y + self.size[1], self.max_height],+ )}/// Hauteur du hotspot du dessus quand le point le plus bas du modèle basculé de `pitch` (≥ 0)@@ -3472,14 +3478,13 @@ pub fn cursor_pose(CursorPose { clearance, pitch, yaw, squash }}-/// Le sprite du thème par défaut que les backends résoudraient pour `cursor_type`, s'il y en a-/// un : c'est lui que le mode 15 extrude. Même résolution qu'eux : l'état s'il a un sprite, sinon-/// la flèche. Les autres thèmes restent plats.+/// Le sprite que les backends résoudraient pour `cursor_type` : c'est lui que le mode 15 modèle.+/// Même résolution qu'eux : l'état s'il a un sprite, sinon la flèche.fn modelled_sprite<'a>(scene: Option<&'a Scene>,cursor_type: Option<&str>,) -> Option<&'a crate::scene::SceneCursorSprite> {- let s = scene.filter(|s| s.cursor.theme == "default")?;+ let s = scene?;let sprites = &s.cursor.cursor_sprites;cursor_type.and_then(|k| sprites.get(k)).or_else(|| sprites.get("arrow"))}@@ -6605,7 +6610,12 @@ mod tests {for (key, [hx, hy]) in DEFAULT_SPRITES {scene.cursor.cursor_sprites.insert(key.into(),- crate::scene::SceneCursorSprite { path: sprite_path(key), hotspot_x: hx, hotspot_y: hy },+ crate::scene::SceneCursorSprite {+ path: sprite_path(key),+ hotspot_x: hx,+ hotspot_y: hy,+ model_depth_path: None,+ },);}scene@@ -6808,10 +6818,27 @@ mod tests {model_plan([0.0; 3], &scene, &unknown, 0.3, true).expect("plan").model,Some(cursor_pose(&unknown, 0.3, 2.5, 1.0)));- // Un autre thème, ou pas de sprite du tout : le sprite plat.+ // Les faces propres à un thème autre que `default` ont aussi accès au mode 3D.let mut themed = model_scene();- themed.cursor.theme = "black-pixel".into();- assert!(model_plan([0.0; 3], &themed, &track, 0.3, true).expect("plan").model.is_none());+ themed.cursor.theme = "studio-ink".into();+ let themed_arrow = crate::scene::SceneCursorSprite {+ path: "studio-ink/model-arrow.png".into(),+ hotspot_x: 0.1977,+ hotspot_y: 0.0635,+ model_depth_path: Some("studio-ink/model-arrow-depth.png".into()),+ };+ themed.cursor.cursor_sprites.insert("arrow".into(), themed_arrow.clone());+ assert_eq!(+ modelled_sprite(Some(&themed), None).map(|sprite| sprite.path.as_str()),+ Some("studio-ink/model-arrow.png")+ );+ assert_eq!(+ modelled_sprite(Some(&themed), None).and_then(|sprite| sprite.model_depth_path.as_deref()),+ Some("studio-ink/model-arrow-depth.png")+ );+ assert!(model_plan([0.0; 3], &themed, &track, 0.3, true).expect("plan").model.is_some());++ // Sans aucun sprite résolu, il n'y a pas de modèle à dessiner.let bare = zoomed_golden_scene();assert!(model_plan([0.0; 3], &bare, &track, 0.3, true).expect("plan").model.is_none());}diff --git a/crates/compositor/src/scene.rs b/crates/compositor/src/scene.rsindex 36dac9bb7..0787ac638 100644--- a/crates/compositor/src/scene.rs+++ b/crates/compositor/src/scene.rs@@ -506,9 +506,9 @@ pub struct SceneCursor {pub smoothing: f32,pub motion_blur: f32,pub click_bounce: f32,- /// Curseur MODÉLISÉ en 3D (mode 15) : le sprite de chaque état du thème par défaut, extrudé,- /// à la place du sprite plat. Les autres thèmes restent plats. `#[serde(default)]` : absent- /// des projets et des JSON écrits avant le réglage, qui gardent donc le curseur plat.+ /// Curseur MODÉLISÉ en 3D (mode 15) : face raster et relief dédiés lorsqu'un état du thème en+ /// fournit, sinon le sprite de cet état est extrudé. `#[serde(default)]` : absent des projets+ /// et des JSON écrits avant le réglage, qui gardent donc le curseur plat.#[serde(default)]pub model3d: bool,pub clip_to_bounds: bool,@@ -539,6 +539,10 @@ pub struct SceneCursorSprite {/// que le curseur était agrandi — le bug que ce champ corrige.pub hotspot_x: f32,pub hotspot_y: f32,+ /// Carte PNG en niveaux de gris, alignée sur la face du modèle (255 = relief maximal).+ /// Les états sans carte gardent une face plate au sommet de leur extrusion.+ #[serde(default)]+ pub model_depth_path: Option<String>,}#[derive(Debug, Clone, Copy, Deserialize)]diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlslindex d9794478a..ef0062c78 100644--- a/crates/compositor/src/shaders.hlsl+++ b/crates/compositor/src/shaders.hlsl@@ -46,9 +46,9 @@ Texture2D<float4> texImg : register(t2); // wallpaper image RGBA (fond, mode 6)// resolution du modele (256x144) ; l'upscale vers la resolution webcam est fait par le sampler// lineaire, ce qui est exactement le filtrage qu'on veut sur un masque.Texture2D<float> texMask : register(t3);-// Champ de distance signé du sprite de curseur (mode 15 seulement), R16F, cf. `cursor_sdf.rs`.+// Champ signé et hauteur du sprite de curseur (mode 15 seulement), RG16F, cf. `cursor_sdf.rs`.// Le sprite lui-même est en t2 (texImg), comme aux modes 7 et 13.-Texture2D<float> texSdf : register(t4);+Texture2D<float2> texSdf : register(t4);SamplerState samp : register(s0);// Plafond de la profondeur de champ du mode 8, en niveau de la pyramide demi-résolution (1.5 =@@ -389,12 +389,14 @@ float3 blur_webcam_bg(float2 uv, float intensity, float2 qpx, float2 local_px)// du cbuffer.//// Repère du MODÈLE : unité = plus grand côté du sprite, origine au hotspot de la face du dessus,-// x à droite, y vers le bas, z vers la caméra ; le modèle occupe z de -MODEL_THICK à 0. Le rect-// du sprite y commence en `color.rg` et mesure `sprite_size()` (rapport w/h dans `radius_px`).-// Textures : t2 (texImg) = le sprite, RGBA en alpha droit ; t4 (texSdf) = son champ, R16F, en+// x à droite, y vers le bas, z vers la caméra ; le dessous reste à -MODEL_THICK, le dessus peut+// monter jusqu'à MODEL_RELIEF_MAX. Le rect du sprite y commence en `color.rg` et mesure+// `sprite_size()` (rapport w/h dans `radius_px`). Textures : t2 (texImg) = le sprite, RGBA ;+// t4 (texSdf) = champ signé en R et relief en G, RG16F, en// unités du modèle, négatif dedans, sur le même rect.// Constantes : miroir exact de `frame_geometry.rs` (MODEL_*).static const float MODEL_THICK = 0.19;+static const float MODEL_RELIEF_MAX = 0.12;// Taille du sprite, repère du modèle : son plus grand côté vaut 1, `radius_px` porte w/h.float2 sprite_size()@@ -443,19 +445,30 @@ static const float MODEL_CONTACT_ALPHA = 0.5;float sd_sprite2(float2 p){float2 c = clamp(p, color.rg, color.rg + sprite_size());- float d = texSdf.SampleLevel(samp, (c - color.rg) / sprite_size(), 0.0);+ float d = texSdf.SampleLevel(samp, (c - color.rg) / sprite_size(), 0.0).r;float2 o = p - c;float out2 = dot(o, o);float e = max(d, 0.0);return out2 > 0.0 ? sqrt(out2 + e * e) : d;}+// Hauteur du dessus : zéro pour un sprite sans carte, model-specific pour un modèle sculpté.+float model_top_height(float2 p)+{+ float2 c = clamp(p, color.rg, color.rg + sprite_size());+ float relief = texSdf.SampleLevel(samp, (c - color.rg) / sprite_size(), 0.0).g;+ return clamp(relief * color.b, 0.0, MODEL_RELIEF_MAX);+}+// Distance signée au modèle : le contour rentré du chanfrein, épaisseur rentrée du chanfrein, puis// regonflé : les arêtes du dessus et du dessous sont arrondies de MODEL_BEVEL.float sd_model(float3 p){- float half_t = model_thick() * 0.5;- float2 w = float2(sd_sprite2(p.xy) + MODEL_BEVEL, abs(p.z + half_t) - (half_t - MODEL_BEVEL));+ float top = model_top_height(p.xy);+ float thick = model_thick();+ float half_t = (top + thick) * 0.5;+ float center_z = (top - thick) * 0.5;+ float2 w = float2(sd_sprite2(p.xy) + MODEL_BEVEL, abs(p.z - center_z) - (half_t - MODEL_BEVEL));return min(max(w.x, w.y), 0.0) + length(max(w, 0.0)) - MODEL_BEVEL;}@@ -584,7 +597,7 @@ float4 cursor_model(float2 local)float3 tip = src_prev.xyz;// La boîte du modèle : le rect du sprite, sur toute l'épaisseur.float3 lo = float3(color.rg, -model_thick());- float3 hi = float3(color.rg + sprite_size(), 0.0);+ float3 hi = float3(color.rg + sprite_size(), MODEL_RELIEF_MAX);// Le rayon de ce pixel : de la caméra (0, 0, P) à travers le pixel sur le plan image z = 0.// Le plan est translaté de mb.zw dans le repère caméra (caméra réelle, 0 sous un angle fixe).diff --git a/crates/compositor/src/shaders.metal b/crates/compositor/src/shaders.metalindex ce201f24e..07b885425 100644--- a/crates/compositor/src/shaders.metal+++ b/crates/compositor/src/shaders.metal@@ -111,7 +111,7 @@ constant float DOF_MAX_LOD = 1.5;// Slots de texture, tenus par les paramètres des entry points :// ps_main : 0 = texY (Y, R8), 1 = texUV (CbCr, RG8), 2 = texImg (RGBA), 3 = texMask (R8),-// 4 = texSdf (champ du sprite de curseur, R16F, mode 15)+// 4 = texSdf (champ + hauteur du sprite de curseur, RG16F, mode 15)// ps_fs_* : 0 = rgbTex (RGBA)// =================================================================================@@ -430,10 +430,11 @@ inline float3 gradient_motion(float2 gp, float2 dir, float denom, float3 c0, flo// ============ Curseur MODÉLISÉ (mode 15) ============// Port ligne pour ligne de `cursor_model` (HLSL), dont les commentaires font foi ; seules// différences : `layer` et les textures arrivent en paramètres (le sprite en texture(2), son-// champ R16F en texture(4)), `saturate` s'écrit `clamp`, `lerp` s'écrit `mix`, `SampleLevel`+// champ RG16F en texture(4)), `saturate` s'écrit `clamp`, `lerp` s'écrit `mix`, `SampleLevel`// s'écrit `sample(…, level(0.0))`.// Constantes : miroir exact de `frame_geometry.rs` (MODEL_*).constant float MODEL_THICK = 0.19;+constant float MODEL_RELIEF_MAX = 0.12;constant float MODEL_BEVEL = 0.045;constant float3 MODEL_LIGHT = float3(-0.4194, -0.5792, 0.6990);constant float MODEL_AMBIENT = 0.36;@@ -476,11 +477,22 @@ static float sd_sprite2(float2 p, constant Layer &layer, texture2d<float, accessreturn out2 > 0.0 ? sqrt(out2 + e * e) : d;}+static float model_top_height(float2 p, constant Layer &layer, texture2d<float, access::sample> texSdf)+{+ float2 lo = layer.color.rg;+ float2 c = clamp(p, lo, lo + sprite_size(layer));+ float relief = texSdf.sample(samp, (c - lo) / sprite_size(layer), level(0.0)).g;+ return clamp(relief * layer.color.b, 0.0, MODEL_RELIEF_MAX);+}+static float sd_model(float3 p, constant Layer &layer, texture2d<float, access::sample> texSdf){- float half_t = model_thick(layer) * 0.5;+ float top = model_top_height(p.xy, layer, texSdf);+ float thick = model_thick(layer);+ float half_t = (top + thick) * 0.5;+ float center_z = (top - thick) * 0.5;float2 w = float2(sd_sprite2(p.xy, layer, texSdf) + MODEL_BEVEL,- abs(p.z + half_t) - (half_t - MODEL_BEVEL));+ abs(p.z - center_z) - (half_t - MODEL_BEVEL));return min(max(w.x, w.y), 0.0) + length(max(w, 0.0)) - MODEL_BEVEL;}@@ -601,7 +613,7 @@ static float4 cursor_model(float2 local, constant Layer &layer,float unit = layer.src.w;float3 tip = layer.src_prev.xyz;float3 lo = float3(layer.color.rg, -model_thick(layer));- float3 hi = float3(layer.color.rg + sprite_size(layer), 0.0);+ float3 hi = float3(layer.color.rg + sprite_size(layer), MODEL_RELIEF_MAX);float3 dw = float3(local + layer.src.xy, -persp);float dlen = length(dw);@@ -1255,7 +1267,7 @@ fragment float4 ps_main(VSOut i [[stage_in]],// masque n'existe : Metal rend alors 0, ce qui est sans effet// puisque la branche n'est prise que si layer.fx.z > 0.5.texture2d<float, access::sample> texMask [[texture(3)]],- // Champ de distance du sprite de curseur (mode 15 seulement), R16F, cf.+ // Champ et relief du sprite de curseur (mode 15 seulement), RG16F, cf.// `cursor_sdf.rs`. Le sprite lui-même est en texture(2), comme aux// modes 7 et 13.texture2d<float, access::sample> texSdf [[texture(4)]])@@ -1850,4 +1862,4 @@ fragment float4 ps_kawase_up(FSOut i [[stage_in]],s += rgbTex.sample(sampNV, uv + float2(0.0, -hp.y * 2.0));s += rgbTex.sample(sampNV, uv + float2(-hp.x, -hp.y)) * 2.0;return s / 12.0;-}\ No newline at end of file+}diff --git a/crates/compositor/src/vk_shaders/layer.wgsl b/crates/compositor/src/vk_shaders/layer.wgslindex 1ef475661..ed67dc147 100644--- a/crates/compositor/src/vk_shaders/layer.wgsl+++ b/crates/compositor/src/vk_shaders/layer.wgsl@@ -32,7 +32,7 @@ struct Layer {@group(0) @binding(0) var<uniform> layer: Layer;@group(0) @binding(1) var texY: texture_2d<f32>; // R8Unorm, sample .r ; modes 7, 13 et 15 : le sprite RGBA-@group(0) @binding(2) var texU: texture_2d<f32>; // R8Unorm, sample .r ; mode 15 : le champ R16F du sprite+@group(0) @binding(2) var texU: texture_2d<f32>; // R8Unorm, sample .r ; mode 15 : distance + relief RG16F@group(0) @binding(3) var samp: sampler;// Masque de segmentation du sujet webcam, R8. Une vue 1x1 est liee quand aucun masque// n'existe : la branche n'est de toute facon prise que si layer.fx.z > 0.5.@@ -447,10 +447,10 @@ fn blur_webcam_bg(uv: vec2<f32>, intensity: f32, qpx: vec2<f32>, local_px: vec2<// le plan de l'ecran. Constantes : miroir exact de `frame_geometry.rs` (MODEL_*), emplacements du// cbuffer : `cursor_model_cb`.// Textures : le sprite RGBA (alpha droit) au binding 1 (`texY`, comme aux modes 7 et 13), son-// champ R16F au binding 2 (`texU`), sur le meme rect ; `color.rg` = coin du sprite dans le repere-// du modele, `sprite_size()` = sa taille (w/h dans `radius_px`), `color.b` = un texel du sprite (unites-// du modele).+// champ RG16F au binding 2 (`texU`), sur le meme rect ; `color.rg` = coin du sprite dans le repere+// du modele, `sprite_size()` = sa taille (w/h dans `radius_px`), `color.b` = l'ecrasement au clic.const MODEL_THICK: f32 = 0.19;+const MODEL_RELIEF_MAX: f32 = 0.12;const MODEL_BEVEL: f32 = 0.045;const MODEL_LIGHT = vec3<f32>(-0.4194, -0.5792, 0.6990);const MODEL_AMBIENT: f32 = 0.36;@@ -491,9 +491,19 @@ fn sd_sprite2(p: vec2<f32>) -> f32 {return select(d, sqrt(out2 + e * e), out2 > 0.0);}+fn model_top_height(p: vec2<f32>) -> f32 {+ let lo = layer.color.rg;+ let c = clamp(p, lo, lo + sprite_size());+ let relief = textureSampleLevel(texU, samp, (c - lo) / sprite_size(), 0.0).g;+ return clamp(relief * layer.color.b, 0.0, MODEL_RELIEF_MAX);+}+fn sd_model(p: vec3<f32>) -> f32 {- let half_t = model_thick() * 0.5;- let w = vec2<f32>(sd_sprite2(p.xy) + MODEL_BEVEL, abs(p.z + half_t) - (half_t - MODEL_BEVEL));+ let top = model_top_height(p.xy);+ let thick = model_thick();+ let half_t = (top + thick) * 0.5;+ let center_z = (top - thick) * 0.5;+ let w = vec2<f32>(sd_sprite2(p.xy) + MODEL_BEVEL, abs(p.z - center_z) - (half_t - MODEL_BEVEL));return min(max(w.x, w.y), 0.0) + length(max(w, vec2<f32>(0.0))) - MODEL_BEVEL;}@@ -594,7 +604,7 @@ fn cursor_model(local: vec2<f32>) -> vec4<f32> {let unit = layer.src.w;let tip = layer.src_prev.xyz;let lo = vec3<f32>(layer.color.rg, -model_thick());- let hi = vec3<f32>(layer.color.rg + sprite_size(), 0.0);+ let hi = vec3<f32>(layer.color.rg + sprite_size(), MODEL_RELIEF_MAX);let dw = vec3<f32>(local + layer.src.xy, -persp);let dlen = length(dw);diff --git a/design/cursors/3d-direction.md b/design/cursors/3d-direction.mdindex 262e635d6..2274bc836 100644--- a/design/cursors/3d-direction.md+++ b/design/cursors/3d-direction.md@@ -1,18 +1,25 @@-# Direction for modelled cursor themes+# Modelled cursor themes-`3d-concept.png` is a visual reference, not a render from OpenScreen.-The current compositor's mode 15 rounds an extruded 2D silhouette. It does-not make a convex palm, separate fingers, or a sculpted arrow body. Do not-present a bevel adjustment as the finished 3D treatment.+`3d-concept.png` is a visual reference, not a render from OpenScreen. Mode 15+now ray-marches each cursor silhouette with an authored grayscale height map+for its top surface. This changes the surface normals, lighting and shadow as+the cursor tilts; it is still a raster height-field model rather than an+individually rigged mesh.-The production 3D version should have authored geometry and materials for-each cursor theme and state, anchored to the same arrow tip or raised-fingertip as its flat PNG. The flat PNG supplies a palette and design-reference; using it unchanged as a 3D face texture would bake its 2D ink-contour onto the model. Decide separately whether each contour becomes a-physical inlay, a side material, or disappears. Pop Coral's decorative-offset layer and rays belong to its flat art, not its 3D body. Its prepared-single-surface PNGs are colour references, not final 3D textures.+The five original packs have separate PNG faces and relief maps for their+arrow and pointing hand. Their model hotspots are authored independently from+the 2D hotspots. Text, resize, move and other OS cursor states keep their own+built-in shapes and use the compositor's beveled extrusion while 3D is on.+Themes without a dedicated model face use the same state-specific fallback.++The face PNG supplies color only. Its alpha defines the silhouette and its+separate grayscale PNG defines height (black at the edge, brighter at the+raised face). The height scale is 0.12 model units. Pop Coral's decorative+offset and rays are omitted from the sculpted face; Pixel Candy uses stepped+height bands; Prism Glow varies its facets; Studio Ink recesses the ivory+inlay and removes the glove outline; Star Sprout raises the star and leaves.+Regenerate both faces and relief maps with+`node scripts/generate-original-cursor-themes.mjs`.| Theme | Arrow model | Hand model || --- | --- | --- |@@ -22,7 +29,8 @@ single-surface PNGs are colour references, not final 3D textures.| Pixel Candy | Pink and mint face voxels; purple is visible side/back blocks, not a painted line. | Distinct finger voxels and small bevels; purple stays as real side/back blocks. || Star Sprout | Mint ceramic body without a heavy blue border; star and leaves are attached raised pieces. | Ivory glove without blue border; mint cuff and tiny star/leaves are separate parts. |-The model needs a true changing surface normal across the face, visible-depth in a three-quarter view, correct contact shadows, and a stable hotspot-during yaw, pitch, click and size changes. A static PNG of a 3D render is-insufficient: the compositor's camera and lighting must see the geometry.+The model keeps the compositor's contact shadows and stable hotspot during+yaw, pitch, click and size changes. A future mesh pipeline could give fingers+more undercut and independent articulation; the current height field already+provides a style-specific convex palm, raised finger ridges and sculpted arrow+faces while remaining compatible with the shared ray-march renderer.diff --git a/design/cursors/README.md b/design/cursors/README.mdindex a63bb5f19..991cc2b44 100644--- a/design/cursors/README.md+++ b/design/cursors/README.md@@ -15,16 +15,21 @@ original high-resolution masters; there is no SVG conversion step.Each `source.png` contains an arrow on the left and a hand on the right. Run`node scripts/generate-original-cursor-themes.mjs` to crop, remove low-alphafringe pixels, and resize them into transparent 128 × 128 PNGs under-`public/cursors/<theme>/`. The script prints the normalized tip hotspots;-copy them into `src/lib/cursor/cursorThemes.ts` after changing a master.+`public/cursors/<theme>/`. Each `model-source.png` is a separate raster face+pair for the 3D option. The same script builds the model face PNGs and aligned+grayscale relief PNGs; the relief is not vector art. It prints the normalized+tip hotspots; copy them into `src/lib/cursor/cursorThemes.ts` after changing a+master.-Pop Coral has an additional `source-3d.png` without its decorative offset-layer or floating rays. Its `arrow-3d.png` and `pointer-3d.png` are prepared-surface art for a future 3D model, not a finished model. The current compositor-still limits its simple 3D extrusion to the built-in default theme. Cursor-states not supplied by a theme use the built-in art.+The model face is selected only while the existing 3D option is enabled. The+theme picker and normal cursor rendering continue to use each flat `source.png`+version. Text, resize, move and other states remain state-accurate through the+built-in art and receive the shared 3D extrusion. Pop Coral's older+`source-3d.png` remains a reference for its offset-free treatment.`contact-sheet.png` shows the sprites enlarged on a light background;`dark-32px.png` shows them at their 32-pixel reference size on a dark background.-The separate 3D modeling direction and concept image are in `3d-direction.md`-and `3d-concept.png`.+`model-face-sheet.png` compares the separate 3D arrow and hand faces.+The 3D modeling direction and concept image are in `3d-direction.md` and+`3d-concept.png`.+The consolidated acceptance list is in `requirements.md`.diff --git a/design/cursors/model-face-sheet.png b/design/cursors/model-face-sheet.pngnew file mode 100644index 000000000..fc3ea30ecBinary files /dev/null and b/design/cursors/model-face-sheet.png differdiff --git a/design/cursors/pixel-candy/model-source.png b/design/cursors/pixel-candy/model-source.pngnew file mode 100644index 000000000..1447b17c0Binary files /dev/null and b/design/cursors/pixel-candy/model-source.png differdiff --git a/design/cursors/pop-coral/model-source.png b/design/cursors/pop-coral/model-source.pngnew file mode 100644index 000000000..651148a00Binary files /dev/null and b/design/cursors/pop-coral/model-source.png differdiff --git a/design/cursors/prism-glow/model-source.png b/design/cursors/prism-glow/model-source.pngnew file mode 100644index 000000000..5a732c57aBinary files /dev/null and b/design/cursors/prism-glow/model-source.png differdiff --git a/design/cursors/requirements.md b/design/cursors/requirements.mdnew file mode 100644index 000000000..59e772b46--- /dev/null+++ b/design/cursors/requirements.md@@ -0,0 +1,60 @@+# Cursor refresh requirements++This file consolidates the cursor decisions from the design and implementation+conversation. It is the working acceptance list for the replacement themes and+their 3D models.++## Replacement artwork++- Remove the Sweezy packs because redistribution rights are unclear or+ insufficient.+- Ship original OpenScreen cursor artwork as clean, transparent PNGs. Do not+ vectorize the generated artwork or ship SVG intermediates.+- Preserve cursor readability and useful choices for users who liked the old+ pixel, character, colorful, glossy, or playful cursors.+- Keep the range professional, attractive, and varied without copying+ Screen Studio or third-party packs.+- Keep correct arrow-tip and raised-fingertip hotspots and preserve other OS+ cursor states through the built-in artwork.++## 3D option++- Every replacement theme and supported cursor state must work with the+ existing 3D cursor option.+- Every replacement arrow and hand has its own PNG face and aligned grayscale+ relief map. The compositor ray-marches the varying top surface so lighting,+ normals and contact shadows respond to cursor tilt and rotation.+- A rounded extrusion of the PNG silhouette remains the fallback for cursor+ states that do not have a dedicated theme model. The five replacement packs+ add style-specific volume: a convex palm and separate finger ridges, faceted+ crystal faces, puffy rubber, stepped voxel heights, and ceramic accents.+- Model the arrow and hand separately for every theme. Do not apply one+ contour, material, or roundness rule to all designs.+- Preserve the cursor hotspot through hover, tilt, yaw, click, and size changes.+- Reuse the compositor's 3D lighting and contact shadows. The surface must+ change with the compositor camera; a static image of a 3D render is not a+ model.++## Theme-specific shape and outline decisions++| Theme | Arrow | Hand |+| --- | --- | --- |+| Studio Ink | Matte black sculpted body; ivory mark becomes an inset groove. | Ivory glove with a convex palm and separate fingers; remove the dark outline. |+| Prism Glow | Translucent faceted crystal; no navy ink contour. | Crystal palm and distinct faceted fingers; no navy ink contour. |+| Pop Coral | Rounded coral rubber; omit the yellow offset and navy rim. | Plump yellow rubber glove; no navy outline, accents become physical details. |+| Pixel Candy | Keep the stepped voxel form; purple is side/back blocks, not a flat outline. | Stepped voxel fingers and palm; preserve purple as physical side/back blocks. |+| Star Sprout | Soft mint ceramic; no heavy blue outline, raised star and leaves. | Rounded ivory glove with no blue outline; separate mint cuff, star, and leaves. |++The 2D PNG may keep a drawn contour where it helps readability. Its contour+must not be copied blindly onto the 3D material: decide per model whether it+becomes an inlay, side material, separate piece, or disappears.++## Review references++- `contact-sheet.png`: 2D PNG themes.+- `3d-concept.png`: visual direction only, not rendered by the app.+- `3d-direction.md`: per-theme modeling notes.+- `README.md`: source PNG and preparation workflow.++The intended deliverable is the actual in-app 3D treatment, not just these+references.diff --git a/design/cursors/star-sprout/model-source.png b/design/cursors/star-sprout/model-source.pngnew file mode 100644index 000000000..7a34a12a8Binary files /dev/null and b/design/cursors/star-sprout/model-source.png differdiff --git a/design/cursors/studio-ink/model-source.png b/design/cursors/studio-ink/model-source.pngnew file mode 100644index 000000000..186abe1feBinary files /dev/null and b/design/cursors/studio-ink/model-source.png differdiff --git a/electron/native-bridge/services/compositorViewService.test.ts b/electron/native-bridge/services/compositorViewService.test.tsindex aa3b88a1d..55a5c05e1 100644--- a/electron/native-bridge/services/compositorViewService.test.ts+++ b/electron/native-bridge/services/compositorViewService.test.ts@@ -311,7 +311,10 @@ describe("resolveSceneAssetPaths", () => {fs.mkdirSync(modelDir, { recursive: true });fs.writeFileSync(path.join(modelDir, "selfie_segmentation_landscape.onnx"), "onnx");const assetPaths = [- ...Object.values(themed?.assets ?? {}).map((a) => a.assetPath),+ ...Object.values(themed?.assets ?? {}).flatMap((asset) => [+ asset.assetPath,+ ...(asset.model3d ? [asset.model3d.assetPath, asset.model3d.depthPath] : []),+ ]),...Object.values(DEFAULT_CURSOR_SPRITES).map((s) => s.assetPath),];for (const assetPath of assetPaths) {@@ -348,7 +351,12 @@ describe("resolveSceneAssetPaths", () => {/** What `resolveSceneAssetPaths` writes into `cursor.cursorSprites` — same shape the* service declares for the sprite map it builds. */- type ResolvedSprite = { path: string; hotspotX: number; hotspotY: number };+ type ResolvedSprite = {+ path: string;+ hotspotX: number;+ hotspotY: number;+ modelDepthPath?: string;+ };// The renderer asks for an effect and knows nothing about the disk; this process answers// where the model is. Same division as the wallpaper and the cursor sprites above.@@ -445,6 +453,18 @@ describe("resolveSceneAssetPaths", () => {expect(fs.existsSync(arrow.path)).toBe(true);});+ it("resolves a themed 3D face and its relief map to paths that exist on disk", () => {+ const model3d = themed?.assets.arrow?.model3d;+ if (!themed || !model3d) throw new Error("a bundled theme needs a 3D arrow face");+ const arrow = resolved({ cursor: { theme: themed.id, model3d: true } }).cursor.cursorSprites+ .arrow;++ expect(arrow.path).toBe(path.join(resources, model3d.assetPath));+ expect(arrow.modelDepthPath).toBe(path.join(resources, model3d.depthPath));+ expect(fs.existsSync(arrow.path)).toBe(true);+ expect(fs.existsSync(arrow.modelDepthPath!)).toBe(true);+ });+it("fills the states a theme doesn't ship with the built-in art", () => {if (!themed) return;const sprites = resolved({ cursor: { theme: themed.id } }).cursor.cursorSprites;diff --git a/electron/native-bridge/services/compositorViewService.ts b/electron/native-bridge/services/compositorViewService.tsindex 5875b9780..39e64827d 100644--- a/electron/native-bridge/services/compositorViewService.ts+++ b/electron/native-bridge/services/compositorViewService.ts@@ -102,15 +102,23 @@ export function resolveSceneAssetPath(relativePath: string): string | null {function resolveCursorSpritePaths(themeId: string,alwaysArrow: boolean,-): Record<string, { path: string; hotspotX: number; hotspotY: number }> {- const resolved: Record<string, { path: string; hotspotX: number; hotspotY: number }> = {};- for (const [type, sprite] of Object.entries(resolveCursorSprites(themeId, alwaysArrow))) {+ model3d = false,+): Record<string, { path: string; hotspotX: number; hotspotY: number; modelDepthPath?: string }> {+ const resolved: Record<+ string,+ { path: string; hotspotX: number; hotspotY: number; modelDepthPath?: string }+ > = {};+ for (const [type, sprite] of Object.entries(+ resolveCursorSprites(themeId, alwaysArrow, model3d),+ )) {const absolute = resolveSceneAssetPath(sprite.assetPath);if (absolute) {+ const depthPath = sprite.modelDepthPath ? resolveSceneAssetPath(sprite.modelDepthPath) : null;resolved[type] = {path: absolute,hotspotX: sprite.hotspotX,hotspotY: sprite.hotspotY,+ ...(depthPath ? { modelDepthPath: depthPath } : {}),};}}@@ -129,7 +137,11 @@ export function resolveSceneAssetPaths(sceneJson: string): string {cursor?: {theme?: string;alwaysArrow?: boolean;- cursorSprites?: Record<string, { path: string; hotspotX: number; hotspotY: number }>;+ model3d?: boolean;+ cursorSprites?: Record<+ string,+ { path: string; hotspotX: number; hotspotY: number; modelDepthPath?: string }+ >;};webcamEffect?: {mode?: string;@@ -164,6 +176,7 @@ export function resolveSceneAssetPaths(sceneJson: string): string {scene.cursor.cursorSprites = resolveCursorSpritePaths(scene.cursor.theme,scene.cursor.alwaysArrow === true,+ scene.cursor.model3d === true,);changed = true;}diff --git a/public/cursors/pixel-candy/model-arrow-depth.png b/public/cursors/pixel-candy/model-arrow-depth.pngnew file mode 100644index 000000000..ab56d559dBinary files /dev/null and b/public/cursors/pixel-candy/model-arrow-depth.png differdiff --git a/public/cursors/pixel-candy/model-arrow.png b/public/cursors/pixel-candy/model-arrow.pngnew file mode 100644index 000000000..4ce1b459eBinary files /dev/null and b/public/cursors/pixel-candy/model-arrow.png differdiff --git a/public/cursors/pixel-candy/model-pointer-depth.png b/public/cursors/pixel-candy/model-pointer-depth.pngnew file mode 100644index 000000000..c0cfb3142Binary files /dev/null and b/public/cursors/pixel-candy/model-pointer-depth.png differdiff --git a/public/cursors/pixel-candy/model-pointer.png b/public/cursors/pixel-candy/model-pointer.pngnew file mode 100644index 000000000..0ad6acf45Binary files /dev/null and b/public/cursors/pixel-candy/model-pointer.png differdiff --git a/public/cursors/pop-coral/model-arrow-depth.png b/public/cursors/pop-coral/model-arrow-depth.pngnew file mode 100644index 000000000..e9a71d215Binary files /dev/null and b/public/cursors/pop-coral/model-arrow-depth.png differdiff --git a/public/cursors/pop-coral/model-arrow.png b/public/cursors/pop-coral/model-arrow.pngnew file mode 100644index 000000000..203ee4308Binary files /dev/null and b/public/cursors/pop-coral/model-arrow.png differdiff --git a/public/cursors/pop-coral/model-pointer-depth.png b/public/cursors/pop-coral/model-pointer-depth.pngnew file mode 100644index 000000000..dd432eff9Binary files /dev/null and b/public/cursors/pop-coral/model-pointer-depth.png differdiff --git a/public/cursors/pop-coral/model-pointer.png b/public/cursors/pop-coral/model-pointer.pngnew file mode 100644index 000000000..8a5fc1996Binary files /dev/null and b/public/cursors/pop-coral/model-pointer.png differdiff --git a/public/cursors/prism-glow/model-arrow-depth.png b/public/cursors/prism-glow/model-arrow-depth.pngnew file mode 100644index 000000000..46be0f675Binary files /dev/null and b/public/cursors/prism-glow/model-arrow-depth.png differdiff --git a/public/cursors/prism-glow/model-arrow.png b/public/cursors/prism-glow/model-arrow.pngnew file mode 100644index 000000000..f0f31a8a4Binary files /dev/null and b/public/cursors/prism-glow/model-arrow.png differdiff --git a/public/cursors/prism-glow/model-pointer-depth.png b/public/cursors/prism-glow/model-pointer-depth.pngnew file mode 100644index 000000000..d99ea491dBinary files /dev/null and b/public/cursors/prism-glow/model-pointer-depth.png differdiff --git a/public/cursors/prism-glow/model-pointer.png b/public/cursors/prism-glow/model-pointer.pngnew file mode 100644index 000000000..53df9aa1bBinary files /dev/null and b/public/cursors/prism-glow/model-pointer.png differdiff --git a/public/cursors/star-sprout/model-arrow-depth.png b/public/cursors/star-sprout/model-arrow-depth.pngnew file mode 100644index 000000000..394eff6aaBinary files /dev/null and b/public/cursors/star-sprout/model-arrow-depth.png differdiff --git a/public/cursors/star-sprout/model-arrow.png b/public/cursors/star-sprout/model-arrow.pngnew file mode 100644index 000000000..4eadc2249Binary files /dev/null and b/public/cursors/star-sprout/model-arrow.png differdiff --git a/public/cursors/star-sprout/model-pointer-depth.png b/public/cursors/star-sprout/model-pointer-depth.pngnew file mode 100644index 000000000..66cc3f7f4Binary files /dev/null and b/public/cursors/star-sprout/model-pointer-depth.png differdiff --git a/public/cursors/star-sprout/model-pointer.png b/public/cursors/star-sprout/model-pointer.pngnew file mode 100644index 000000000..c5acf9a83Binary files /dev/null and b/public/cursors/star-sprout/model-pointer.png differdiff --git a/public/cursors/studio-ink/model-arrow-depth.png b/public/cursors/studio-ink/model-arrow-depth.pngnew file mode 100644index 000000000..21fb37806Binary files /dev/null and b/public/cursors/studio-ink/model-arrow-depth.png differdiff --git a/public/cursors/studio-ink/model-arrow.png b/public/cursors/studio-ink/model-arrow.pngnew file mode 100644index 000000000..4e30e03fdBinary files /dev/null and b/public/cursors/studio-ink/model-arrow.png differdiff --git a/public/cursors/studio-ink/model-pointer-depth.png b/public/cursors/studio-ink/model-pointer-depth.pngnew file mode 100644index 000000000..bc808d07cBinary files /dev/null and b/public/cursors/studio-ink/model-pointer-depth.png differdiff --git a/public/cursors/studio-ink/model-pointer.png b/public/cursors/studio-ink/model-pointer.pngnew file mode 100644index 000000000..6ae633f31Binary files /dev/null and b/public/cursors/studio-ink/model-pointer.png differdiff --git a/scripts/generate-original-cursor-themes.mjs b/scripts/generate-original-cursor-themes.mjsindex 4fb3b5f80..4d6118d4e 100644--- a/scripts/generate-original-cursor-themes.mjs+++ b/scripts/generate-original-cursor-themes.mjs@@ -15,16 +15,37 @@ const INNER_SIZE = 112;// Fingertip and arrow tip coordinates in the 1774 × 887 source PNGs.const themes = [- { id: "studio-ink", hotspots: { arrow: [158, 48], pointer: [1258, 50] } },- { id: "prism-glow", hotspots: { arrow: [208, 42], pointer: [1220, 50] } },- { id: "pop-coral", hotspots: { arrow: [265, 58], pointer: [1245, 65] } },- { id: "pixel-candy", hotspots: { arrow: [273, 76], pointer: [1218, 78] } },- { id: "star-sprout", hotspots: { arrow: [210, 65], pointer: [1218, 65] } },+ {+ id: "studio-ink",+ hotspots: { arrow: [158, 48], pointer: [1258, 50] },+ modelHotspots: { arrow: [158, 44], pointer: [1256, 86] },+ },+ {+ id: "prism-glow",+ hotspots: { arrow: [208, 42], pointer: [1220, 50] },+ modelHotspots: { arrow: [204, 40], pointer: [1219, 55] },+ },+ {+ id: "pop-coral",+ hotspots: { arrow: [265, 58], pointer: [1245, 65] },+ modelHotspots: { arrow: [254, 61], pointer: [1263, 92] },+ },+ {+ id: "pixel-candy",+ hotspots: { arrow: [273, 76], pointer: [1218, 78] },+ modelHotspots: { arrow: [294, 113], pointer: [1238, 112] },+ },+ {+ id: "star-sprout",+ hotspots: { arrow: [210, 65], pointer: [1218, 65] },+ modelHotspots: { arrow: [234, 119], pointer: [1227, 103] },+ },];const browser = await chromium.launch();try {const page = await browser.newPage();+ const modelFaces = [];await page.goto("about:blank");for (const theme of themes) {const output = path.join(PUBLIC_DIR, theme.id);@@ -107,7 +128,349 @@ try {);}}++ // The model face is authored separately from its flat 2D face. The relief PNG is+ // grayscale height data, aligned pixel-for-pixel with model-arrow/model-pointer.png.+ const modelSource = await readFile(path.join(SOURCE_DIR, theme.id, "model-source.png"));+ for (const type of ["arrow", "pointer"]) {+ const result = await page.evaluate(+ async ({ png, type, size, innerSize, hotspot, themeId }) => {+ const image = new Image();+ image.src = `data:image/png;base64,${png}`;+ await image.decode();+ const halfWidth = Math.floor(image.width / 2);+ const sourceX = type === "arrow" ? 0 : halfWidth;+ const sourceCanvas = document.createElement("canvas");+ sourceCanvas.width = halfWidth;+ sourceCanvas.height = image.height;+ const sourceContext = sourceCanvas.getContext("2d", { willReadFrequently: true });+ sourceContext.drawImage(image, -sourceX, 0);+ const sourcePixels = sourceContext.getImageData(0, 0, halfWidth, image.height);+ const sourceMask = new Uint8Array(halfWidth * image.height);+ for (let i = 0; i < sourceMask.length; i++) {+ const alphaIndex = i * 4 + 3;+ if (+ themeId === "studio-ink" &&+ type === "pointer" &&+ sourcePixels.data[alphaIndex] >= 32+ ) {+ const colorIndex = i * 4;+ const luminance =+ 0.2126 * sourcePixels.data[colorIndex] ++ 0.7152 * sourcePixels.data[colorIndex + 1] ++ 0.0722 * sourcePixels.data[colorIndex + 2];+ // The 3D glove is ivory ceramic. Drop the generated dark ink fringe so+ // that it cannot become a fake blue/black sidewall in the volume.+ if (luminance < 84) sourcePixels.data[alphaIndex] = 0;+ }+ if (sourcePixels.data[alphaIndex] < 32) sourcePixels.data[alphaIndex] = 0;+ sourceMask[i] = sourcePixels.data[alphaIndex] >= 32 ? 1 : 0;+ }++ // Drop disconnected specks from the transparent cutout without trimming the+ // separate Star Sprout charm, which is deliberately a second modeled piece.+ const visited = new Uint8Array(sourceMask.length);+ const queue = new Int32Array(sourceMask.length);+ const smallComponents = [];+ for (let start = 0; start < sourceMask.length; start++) {+ if (!sourceMask[start] || visited[start]) continue;+ let head = 0;+ let tail = 0;+ queue[tail++] = start;+ visited[start] = 1;+ while (head < tail) {+ const at = queue[head++];+ const x = at % halfWidth;+ const y = Math.floor(at / halfWidth);+ for (let oy = -1; oy <= 1; oy++) {+ for (let ox = -1; ox <= 1; ox++) {+ const nx = x + ox;+ const ny = y + oy;+ if (nx < 0 || nx >= halfWidth || ny < 0 || ny >= image.height) continue;+ const next = ny * halfWidth + nx;+ if (sourceMask[next] && !visited[next]) {+ visited[next] = 1;+ queue[tail++] = next;+ }+ }+ }+ }+ if (tail < 180) smallComponents.push(queue.slice(0, tail));+ }+ for (const component of smallComponents) {+ for (const at of component) sourcePixels.data[at * 4 + 3] = 0;+ }+ sourceContext.putImageData(sourcePixels, 0, 0);++ let minX = halfWidth;+ let minY = image.height;+ let maxX = 0;+ let maxY = 0;+ for (let y = 0; y < image.height; y++) {+ for (let x = 0; x < halfWidth; x++) {+ if (sourcePixels.data[(y * halfWidth + x) * 4 + 3] < 28) continue;+ minX = Math.min(minX, x);+ minY = Math.min(minY, y);+ maxX = Math.max(maxX, x);+ maxY = Math.max(maxY, y);+ }+ }+ if (minX > maxX || minY > maxY) throw new Error(`${themeId}/${type}: empty model art`);+ const width = maxX - minX + 1;+ const height = maxY - minY + 1;+ const scale = innerSize / Math.max(width, height);+ const targetWidth = width * scale;+ const targetHeight = height * scale;+ const targetX = (size - targetWidth) / 2;+ const targetY = (size - targetHeight) / 2;+ const canvas = document.createElement("canvas");+ canvas.width = canvas.height = size;+ const context = canvas.getContext("2d", { willReadFrequently: true });+ context.imageSmoothingQuality = "high";+ context.drawImage(+ sourceCanvas,+ minX,+ minY,+ width,+ height,+ targetX,+ targetY,+ targetWidth,+ targetHeight,+ );+ const face = context.getImageData(0, 0, size, size);+ const mask = new Uint8Array(size * size);+ const distance = new Float32Array(size * size);+ const inf = 10000;+ let bx0 = size;+ let by0 = size;+ let bx1 = 0;+ let by1 = 0;+ for (let y = 0; y < size; y++) {+ for (let x = 0; x < size; x++) {+ const i = y * size + x;+ mask[i] = face.data[i * 4 + 3] >= 96 ? 1 : 0;+ distance[i] = mask[i] ? inf : 0;+ if (mask[i]) {+ bx0 = Math.min(bx0, x);+ by0 = Math.min(by0, y);+ bx1 = Math.max(bx1, x);+ by1 = Math.max(by1, y);+ }+ }+ }+ const diagonal = Math.SQRT2;+ for (let y = 0; y < size; y++) {+ for (let x = 0; x < size; x++) {+ const i = y * size + x;+ if (!mask[i]) continue;+ let d = distance[i];+ if (x > 0) d = Math.min(d, distance[i - 1] + 1);+ if (y > 0) d = Math.min(d, distance[i - size] + 1);+ if (x > 0 && y > 0) d = Math.min(d, distance[i - size - 1] + diagonal);+ if (x + 1 < size && y > 0) d = Math.min(d, distance[i - size + 1] + diagonal);+ distance[i] = d;+ }+ }+ for (let y = size - 1; y >= 0; y--) {+ for (let x = size - 1; x >= 0; x--) {+ const i = y * size + x;+ if (!mask[i]) continue;+ let d = distance[i];+ if (x + 1 < size) d = Math.min(d, distance[i + 1] + 1);+ if (y + 1 < size) d = Math.min(d, distance[i + size] + 1);+ if (x + 1 < size && y + 1 < size) d = Math.min(d, distance[i + size + 1] + diagonal);+ if (x > 0 && y + 1 < size) d = Math.min(d, distance[i + size - 1] + diagonal);+ distance[i] = d;+ }+ }++ const smooth = (a, b, x) => {+ const t = Math.max(0, Math.min(1, (x - a) / (b - a)));+ return t * t * (3 - 2 * t);+ };+ const clamp01 = (x) => Math.max(0, Math.min(1, x));+ const segment = (u, v, a, b, c, d) => {+ const vx = c - a;+ const vy = d - b;+ const t = clamp01(((u - a) * vx + (v - b) * vy) / (vx * vx + vy * vy));+ return Math.hypot(u - (a + vx * t), v - (b + vy * t));+ };+ const ridgeSegments = [+ [0.37, 0.0, 0.39, 0.52, 0.075],+ [0.57, 0.12, 0.58, 0.55, 0.075],+ [0.76, 0.23, 0.77, 0.57, 0.075],+ [0.92, 0.36, 0.92, 0.6, 0.075],+ [0.12, 0.47, 0.34, 0.68, 0.09],+ ];+ const ridge = (u, v) =>+ Math.max(+ ...ridgeSegments.map(([ax, ay, bx, by, radius]) =>+ Math.exp(-((segment(u, v, ax, ay, bx, by) / radius) ** 2) * 2.2),+ ),+ );+ const modelCanvas = document.createElement("canvas");+ modelCanvas.width = modelCanvas.height = size;+ const modelContext = modelCanvas.getContext("2d");+ const heightMap = modelContext.createImageData(size, size);+ const bw = Math.max(bx1 - bx0, 1);+ const bh = Math.max(by1 - by0, 1);+ let peak = 0;+ for (let y = 0; y < size; y++) {+ for (let x = 0; x < size; x++) {+ const i = y * size + x;+ const out = i * 4;+ let top = 0;+ if (mask[i]) {+ const u = (x - bx0) / bw;+ const v = (y - by0) / bh;+ const edge = smooth(0.5, 12, distance[i]);+ let [r, g, b] = [0, 1, 2].map((channel) => face.data[out + channel] / 255);+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;+ switch (themeId) {+ case "studio-ink":+ top = 0.022 + 0.024 * edge - 0.014 * smooth(0.56, 0.88, luminance);+ if (type === "pointer") {+ top +=+ 0.014 *+ Math.max(+ 0.46 * Math.exp(-(((u - 0.55) / 0.43) ** 2 + ((v - 0.72) / 0.33) ** 2)),+ 0.52 * ridge(u, v),+ );+ }+ break;+ case "prism-glow": {+ const gx = u * 7;+ const gy = v * 7;+ const fx = gx - Math.floor(gx);+ const fy = gy - Math.floor(gy);+ const facet = Math.abs(+ (Math.floor(gx) + Math.floor(gy)) % 2 === 0 ? fx - fy : fx + fy - 1,+ );+ const facetHeight = 1 - smooth(0.02, 0.5, facet);+ top = 0.016 + 0.028 * edge + 0.022 * facetHeight + 0.012 * (1 - luminance);+ break;+ }+ case "pop-coral": {+ const dome = Math.max(+ 0,+ 1 - ((u - 0.5) / 0.59) ** 2 - ((v - 0.52) / 0.75) ** 2,+ );+ top = 0.015 + 0.075 * dome + (type === "pointer" ? 0.013 * ridge(u, v) : 0);+ break;+ }+ case "pixel-candy": {+ const stair = Math.floor(Math.min(distance[i], 16) / 3);+ const block = (Math.floor(u * 16) + 2 * Math.floor(v * 16)) % 3;+ const side =+ distance[i] <= 5 && ((u > 0.64 && v > 0.18) || v > 0.78 || u < 0.11);+ if (side) {+ // Keep the original plum palette as a stepped rear/side face.+ // It is directional and recessed instead of a uniform ink outline.+ [r, g, b] = [0.36, 0.19, 0.47];+ face.data[out] = Math.round(r * 255);+ face.data[out + 1] = Math.round(g * 255);+ face.data[out + 2] = Math.round(b * 255);+ top = 0.012 + Math.max(0, stair - 1) * 0.003;+ } else {+ top =+ 0.012 + stair * 0.0045 + block * 0.002 + 0.012 * smooth(0.7, 1, luminance);+ if (type === "pointer") top += Math.floor(ridge(u, v) * 4) * 0.004;+ }+ break;+ }+ case "star-sprout": {+ const yellow = r > 0.55 && g > 0.3 && b < 0.48;+ const leaf = g > r * 1.08 && g > b * 0.72;+ const dome = Math.max(+ 0,+ 1 - ((u - 0.5) / 0.62) ** 2 - ((v - 0.52) / 0.75) ** 2,+ );+ top =+ 0.016 ++ 0.045 * dome ++ (yellow ? 0.035 : 0) ++ (leaf ? 0.018 : 0) ++ (type === "pointer" ? 0.018 * ridge(u, v) : 0);+ break;+ }+ }+ top = Math.min(top, 0.12);+ peak = Math.max(peak, top);+ }+ const encoded = Math.round((top / 0.12) * 255);+ heightMap.data[out] = encoded;+ heightMap.data[out + 1] = encoded;+ heightMap.data[out + 2] = encoded;+ heightMap.data[out + 3] = 255;+ }+ }+ context.putImageData(face, 0, 0);+ modelContext.putImageData(heightMap, 0, 0);+ const colorPng = canvas.toDataURL("image/png").split(",")[1];+ const heightPng = modelCanvas.toDataURL("image/png").split(",")[1];+ return {+ colorPng,+ heightPng,+ peak,+ hotspotX: (targetX + (hotspot[0] - sourceX - minX) * scale) / size,+ hotspotY: (targetY + (hotspot[1] - minY) * scale) / size,+ };+ },+ {+ png: modelSource.toString("base64"),+ type,+ size: SIZE,+ innerSize: INNER_SIZE,+ hotspot: theme.modelHotspots[type],+ themeId: theme.id,+ },+ );+ const base = `model-${type}`;+ await writeFile(path.join(output, `${base}.png`), Buffer.from(result.colorPng, "base64"));+ await writeFile(+ path.join(output, `${base}-depth.png`),+ Buffer.from(result.heightPng, "base64"),+ );+ modelFaces.push({ theme: theme.id, type, png: result.colorPng });+ console.log(+ `${theme.id}/${base}.png: hotspot ${result.hotspotX.toFixed(4)}, ${result.hotspotY.toFixed(4)}, relief ${result.peak.toFixed(3)}`,+ );+ }}+ const sheet = await page.evaluate(async (items) => {+ const canvas = document.createElement("canvas");+ canvas.width = 1150;+ canvas.height = 540;+ const context = canvas.getContext("2d");+ context.fillStyle = "#eef2f8";+ context.fillRect(0, 0, canvas.width, canvas.height);+ for (let index = 0; index < items.length; index++) {+ const item = items[index];+ const column = Math.floor(index / 2);+ const row = index % 2;+ const x = column * 230 + 8;+ const y = row * 270 + 8;+ context.fillStyle = "#ffffff";+ context.fillRect(x, y, 214, 254);+ context.strokeStyle = "#d9e1ec";+ context.strokeRect(x + 0.5, y + 0.5, 213, 253);+ context.fillStyle = "#283347";+ context.font = "600 14px system-ui, sans-serif";+ context.textAlign = "center";+ context.fillText(item.theme.replaceAll("-", " "), x + 107, y + 22);+ context.fillStyle = "#68758a";+ context.font = "11px system-ui, sans-serif";+ context.fillText(item.type === "arrow" ? "ARROW" : "POINTING HAND", x + 107, y + 42);+ const image = new Image();+ image.src = `data:image/png;base64,${item.png}`;+ await image.decode();+ context.imageSmoothingEnabled = item.theme !== "pixel-candy";+ context.drawImage(image, x + 28, y + 52, 158, 158);+ }+ return canvas.toDataURL("image/png").split(",")[1];+ }, modelFaces);+ await writeFile(path.join(SOURCE_DIR, "model-face-sheet.png"), Buffer.from(sheet, "base64"));} finally {await browser.close();}diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.jsonindex bed175662..735f48c64 100644--- a/src/i18n/locales/ar/settings.json+++ b/src/i18n/locales/ar/settings.json@@ -414,7 +414,7 @@"smoothing": "التنعيم","clickBounce": "ارتداد النقر","model3d": "مؤشر ثلاثي الأبعاد",- "model3dHint": "النمط الافتراضي: تصبح كل أشكال المؤشر ثلاثية الأبعاد. تبقى الأنماط الأخرى مسطحة.",+ "model3dHint": "يستخدم كل نمط مؤشر شكلاً ثلاثي الأبعاد يناسب تصميمه.","model3dNeedsCursor": "فعّل «إظهار المؤشر» لاستخدام المؤشر ثلاثي الأبعاد.","help": "عرض المؤشر اعتمادًا على بيانات التتبع المسجّلة: السمة، والحجم، والتنعيم، وضبابية الحركة، وارتداد النقر.","size": "الحجم",diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.jsonindex 7a07edc18..ce077374e 100644--- a/src/i18n/locales/cs/settings.json+++ b/src/i18n/locales/cs/settings.json@@ -414,7 +414,7 @@"smoothing": "Vyhlazení","clickBounce": "Odraz při kliknutí","model3d": "3D kurzor",- "model3dHint": "Výchozí styl: všechny tvary kurzoru budou 3D. Ostatní styly zůstanou ploché.",+ "model3dHint": "Každý styl kurzoru získá 3D tvar odpovídající svému designu.","model3dNeedsCursor": "Zapněte „Zobrazit kurzor“, abyste mohli použít 3D kurzor.","help": "Renderování kurzoru ze zaznamenané telemetrie: motiv, velikost, vyhlazení, pohybové rozmazání a zdůraznění odrazu při kliknutí.","size": "Velikost",diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.jsonindex 019dc03f4..9c536aeac 100644--- a/src/i18n/locales/de/settings.json+++ b/src/i18n/locales/de/settings.json@@ -414,7 +414,7 @@"smoothing": "Glättung","clickBounce": "Klick-Federung","model3d": "3D-Cursor",- "model3dHint": "Standardstil: Jede Cursorform wird 3D. Andere Stile bleiben flach.",+ "model3dHint": "Jeder Cursorstil erhält eine an sein Design angepasste 3D-Form.","model3dNeedsCursor": "Aktiviere „Cursor anzeigen“, um den 3D-Cursor zu verwenden.","help": "Cursor-Darstellung aus der aufgezeichneten Telemetrie: Stil, Größe, Glättung, Bewegungsunschärfe und Klick-Federung.","size": "Größe",diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.jsonindex 89804b53b..ce4b0fff1 100644--- a/src/i18n/locales/en/settings.json+++ b/src/i18n/locales/en/settings.json@@ -414,7 +414,7 @@"smoothing": "Smoothing","clickBounce": "Click bounce","model3d": "3D cursor",- "model3dHint": "Default style: every cursor shape turns 3D. Other styles stay flat.",+ "model3dHint": "Every cursor style uses a 3D shape suited to its design.","model3dNeedsCursor": "Turn on “Show cursor” to use the 3D cursor.","help": "How the recorded cursor is drawn: style, size, smoothing, motion blur and click bounce.","size": "Size",diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.jsonindex 3434312dd..cd4e6a609 100644--- a/src/i18n/locales/es/settings.json+++ b/src/i18n/locales/es/settings.json@@ -414,7 +414,7 @@"smoothing": "Suavizado","clickBounce": "Rebote al clic","model3d": "Cursor 3D",- "model3dHint": "Estilo predeterminado: todas las formas del cursor pasan a 3D. Los demás estilos siguen planos.",+ "model3dHint": "Cada estilo de cursor adopta una forma 3D acorde con su diseño.","model3dNeedsCursor": "Activa «Mostrar cursor» para usar el cursor 3D.","help": "Representación del cursor a partir de la telemetría grabada: tema, tamaño, suavizado, desenfoque de movimiento y rebote al hacer clic.","size": "Tamaño",diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.jsonindex 89c5ab615..1460efee0 100644--- a/src/i18n/locales/fr/settings.json+++ b/src/i18n/locales/fr/settings.json@@ -414,7 +414,7 @@"smoothing": "Lissage","clickBounce": "Rebond au clic","model3d": "Curseur 3D",- "model3dHint": "Style par défaut : toutes les formes du curseur passent en 3D. Les autres styles restent plats.",+ "model3dHint": "Chaque style de curseur adopte un volume 3D adapté à son design.","model3dNeedsCursor": "Activez « Afficher le curseur » pour utiliser le curseur 3D.","help": "Rendu du curseur à partir de la télémétrie enregistrée : thème, taille, lissage, flou de mouvement et rebond au clic.","size": "Taille",diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.jsonindex 94046d278..a8c3afc69 100644--- a/src/i18n/locales/it/settings.json+++ b/src/i18n/locales/it/settings.json@@ -414,7 +414,7 @@"smoothing": "Smussatura","clickBounce": "Rimbalzo clic","model3d": "Cursore 3D",- "model3dHint": "Stile predefinito: tutte le forme del cursore diventano 3D. Gli altri stili restano piatti.",+ "model3dHint": "Ogni stile di cursore assume una forma 3D adatta al suo design.","model3dNeedsCursor": "Attiva «Mostra cursore» per usare il cursore 3D.","help": "Resa del cursore dalla telemetria registrata: tema, dimensione, smussatura, sfocatura di movimento e rimbalzo al clic.","size": "Dimensione",diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.jsonindex 15c38efbb..18cf00052 100644--- a/src/i18n/locales/ja-JP/settings.json+++ b/src/i18n/locales/ja-JP/settings.json@@ -414,7 +414,7 @@"smoothing": "スムージング","clickBounce": "クリックバウンス","model3d": "3D カーソル",- "model3dHint": "デフォルトのスタイル:すべてのカーソル形状が 3D になります。その他のスタイルは平面のままです。",+ "model3dHint": "各カーソルスタイルのデザインに合わせた3D形状を表示します。","model3dNeedsCursor": "3D カーソルを使うには「カーソルを表示」をオンにしてください。","help": "記録されたテレメトリからのカーソル描画: テーマ、サイズ、スムージング、モーションブラー、クリック時のバウンス。","size": "サイズ",diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.jsonindex 23df69303..a9a1a454c 100644--- a/src/i18n/locales/ko-KR/settings.json+++ b/src/i18n/locales/ko-KR/settings.json@@ -414,7 +414,7 @@"smoothing": "부드러움","clickBounce": "클릭 바운스","model3d": "3D 커서",- "model3dHint": "기본 스타일: 모든 커서 모양이 3D로 바뀝니다. 다른 스타일은 평면으로 유지됩니다.",+ "model3dHint": "커서 스타일마다 디자인에 맞는 3D 형태를 적용합니다.","model3dNeedsCursor": "3D 커서를 사용하려면 '커서 표시'를 켜세요.","help": "기록된 텔레메트리를 기반으로 한 커서 렌더링: 테마, 크기, 스무딩, 모션 블러, 클릭 바운스.","size": "크기",diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.jsonindex 6d3cae2d2..eeb627fce 100644--- a/src/i18n/locales/pt-BR/settings.json+++ b/src/i18n/locales/pt-BR/settings.json@@ -414,7 +414,7 @@"smoothing": "Suavização","clickBounce": "Rebote ao clicar","model3d": "Cursor 3D",- "model3dHint": "Estilo padrão: todas as formas do cursor ficam em 3D. Os outros estilos continuam planos.",+ "model3dHint": "Cada estilo de cursor ganha uma forma 3D adequada ao seu design.","model3dNeedsCursor": "Ative “Mostrar cursor” para usar o cursor 3D.","help": "Renderização do cursor a partir da telemetria gravada: tema, tamanho, suavização, desfoque de movimento e salto ao clicar.","size": "Tamanho",diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.jsonindex a90bcc22b..8f2e4c93e 100644--- a/src/i18n/locales/ru/settings.json+++ b/src/i18n/locales/ru/settings.json@@ -414,7 +414,7 @@"smoothing": "Сглаживание","clickBounce": "Отскок при клике","model3d": "3D-курсор",- "model3dHint": "Стиль по умолчанию: все формы курсора становятся объёмными. Остальные стили остаются плоскими.",+ "model3dHint": "Каждый стиль курсора получает объёмную 3D-форму, соответствующую его дизайну.","model3dNeedsCursor": "Включите «Показывать курсор», чтобы использовать 3D-курсор.","help": "Отрисовка курсора по записанной телеметрии: тема, размер, сглаживание, размытие движения и отскок при клике.","size": "Размер",diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.jsonindex ce2d59373..51ffcdfa6 100644--- a/src/i18n/locales/tr/settings.json+++ b/src/i18n/locales/tr/settings.json@@ -414,7 +414,7 @@"smoothing": "Yumuşatma","clickBounce": "Tıklama Sıçraması","model3d": "3B imleç",- "model3dHint": "Varsayılan stil: tüm imleç şekilleri 3B olur. Diğer stiller düz kalır.",+ "model3dHint": "Her imleç stili, tasarımına uygun bir 3B şekil kullanır.","model3dNeedsCursor": "3B imleci kullanmak için «İmleci Göster»i açın.","help": "Kaydedilen telemetriden imleç çizimi: tema, boyut, yumuşatma, hareket bulanıklığı ve tıklama sıçraması.","size": "Boyut",diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.jsonindex 2b004b764..a99e79dd1 100644--- a/src/i18n/locales/vi/settings.json+++ b/src/i18n/locales/vi/settings.json@@ -414,7 +414,7 @@"smoothing": "Làm mượt","clickBounce": "Nảy khi nhấp","model3d": "Con trỏ 3D",- "model3dHint": "Kiểu mặc định: mọi hình dạng con trỏ đều thành 3D. Các kiểu khác vẫn phẳng.",+ "model3dHint": "Mỗi kiểu con trỏ có hình khối 3D phù hợp với thiết kế.","model3dNeedsCursor": "Bật “Hiện con trỏ” để dùng con trỏ 3D.","help": "Cách vẽ con trỏ từ dữ liệu đã ghi: chủ đề, kích thước, làm mượt, mờ chuyển động và hiệu ứng nảy khi nhấp.","size": "Kích thước",diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonindex cbdf536e4..bb6f18838 100644--- a/src/i18n/locales/zh-CN/settings.json+++ b/src/i18n/locales/zh-CN/settings.json@@ -414,7 +414,7 @@"smoothing": "平滑","clickBounce": "点击弹跳","model3d": "3D 光标",- "model3dHint": "默认样式:所有光标形状都变为 3D。其他样式保持平面。",+ "model3dHint": "每种光标样式都会采用与其设计相符的 3D 形态。","model3dNeedsCursor": "开启“显示光标”后才能使用 3D 光标。","help": "基于录制遥测数据的光标渲染:主题、大小、平滑、运动模糊和点击回弹。","size": "大小",diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.jsonindex fc8173600..11d17185f 100644--- a/src/i18n/locales/zh-TW/settings.json+++ b/src/i18n/locales/zh-TW/settings.json@@ -414,7 +414,7 @@"smoothing": "平滑","clickBounce": "點擊彈跳","model3d": "3D 游標",- "model3dHint": "預設樣式:所有游標形狀都會變成 3D。其他樣式維持平面。",+ "model3dHint": "每種游標樣式都會採用符合其設計的 3D 外型。","model3dNeedsCursor": "開啟「顯示游標」後才能使用 3D 游標。","help": "根據錄製的遙測資料繪製游標:主題、大小、平滑、動態模糊與點擊回彈。","size": "大小",diff --git a/src/lib/cursor/cursorThemes.test.ts b/src/lib/cursor/cursorThemes.test.tsindex 07b072a60..a2886cbca 100644--- a/src/lib/cursor/cursorThemes.test.ts+++ b/src/lib/cursor/cursorThemes.test.ts@@ -60,6 +60,26 @@ describe("normalizeCursorThemeId", () => {expect(png.readUInt32BE(20)).toBe(128);}});++ it.each(CURSOR_THEMES)("ships aligned 3D arrow and hand assets for $name", (theme) => {+ const sprites = resolveCursorSprites(theme.id, false, true);+ for (const state of ["arrow", "pointer"] as const) {+ const asset = theme.assets[state];+ if (!asset?.model3d) throw new Error(`${theme.id}/${state} needs a 3D face and relief map`);++ expect(sprites[state].assetPath).toBe(asset.model3d.assetPath);+ expect(sprites[state].modelDepthPath).toBe(asset.model3d.depthPath);+ expect(sprites[state].hotspotX).toBeCloseTo(asset.model3d.hotspotX / 32);+ expect(sprites[state].hotspotY).toBeCloseTo(asset.model3d.hotspotY / 32);++ for (const path of [asset.model3d.assetPath, asset.model3d.depthPath]) {+ const png = readFileSync(join(process.cwd(), "public", path));+ expect(png.subarray(0, 8).toString("hex")).toBe("89504e470d0a1a0a");+ expect(png.readUInt32BE(16)).toBe(128);+ expect(png.readUInt32BE(20)).toBe(128);+ }+ }+ });});describe("themePickerPreviewAssets", () => {diff --git a/src/lib/cursor/cursorThemes.ts b/src/lib/cursor/cursorThemes.tsindex 8ab6e554b..5cb373a85 100644--- a/src/lib/cursor/cursorThemes.ts+++ b/src/lib/cursor/cursorThemes.ts@@ -15,6 +15,14 @@ export interface CursorThemeAsset {height: number;hotspotX: number;hotspotY: number;+ /** Face and grayscale relief map for the optional modelled cursor. Hotspots use the same+ * 32-logical-pixel reference as the flat asset above. */+ model3d?: {+ assetPath: string;+ depthPath: string;+ hotspotX: number;+ hotspotY: number;+ };}export interface CursorTheme {@@ -48,6 +56,8 @@ export interface CursorSprite {/** Hotspot as a fraction of the image width / height. */hotspotX: number;hotspotY: number;+ /** Optional per-pixel top-surface height map used by the 3D cursor model. */+ modelDepthPath?: string;}/**@@ -93,7 +103,7 @@ export const DEFAULT_CURSOR_SPRITES: Record<NativeCursorType, CursorSprite> = {** To add one: drop arrow.png/pointer.png into public/cursors/<id>/ and add an entry here* with hotspots normalized to the 32-logical reference (divide a 128px-pack hotspot by 4).- * No renderer changes needed. An id that leaves this list reads back as the default art+ * Add a model3d face and depth map when the theme has its own 3D treatment. An id that leaves this list reads back as the default art* through `normalizeCursorThemeId`, so a project saved with it still opens.*/export const CURSOR_THEMES: readonly CursorTheme[] = [@@ -107,6 +117,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 6.2304,hotspotY: 2.0992,+ model3d: {+ assetPath: "cursors/studio-ink/model-arrow.png",+ depthPath: "cursors/studio-ink/model-arrow-depth.png",+ hotspotX: 6.3264,+ hotspotY: 2.032,+ },},pointer: {assetPath: "cursors/studio-ink/pointer.png",@@ -114,6 +130,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 12.848,hotspotY: 2.0704,+ model3d: {+ assetPath: "cursors/studio-ink/model-pointer.png",+ depthPath: "cursors/studio-ink/model-pointer-depth.png",+ hotspotX: 12.2304,+ hotspotY: 1.9232,+ },},},},@@ -127,6 +149,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 6.3456,hotspotY: 2.0672,+ model3d: {+ assetPath: "cursors/prism-glow/model-arrow.png",+ depthPath: "cursors/prism-glow/model-arrow-depth.png",+ hotspotX: 6.5728,+ hotspotY: 1.9296,+ },},pointer: {assetPath: "cursors/prism-glow/pointer.png",@@ -134,6 +162,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 11.968,hotspotY: 2.0352,+ model3d: {+ assetPath: "cursors/prism-glow/model-pointer.png",+ depthPath: "cursors/prism-glow/model-pointer-depth.png",+ hotspotX: 11.4816,+ hotspotY: 2.0,+ },},},},@@ -147,6 +181,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 10.4768,hotspotY: 2.1792,+ model3d: {+ assetPath: "cursors/pop-coral/model-arrow.png",+ depthPath: "cursors/pop-coral/model-arrow-depth.png",+ hotspotX: 7.2224,+ hotspotY: 1.9648,+ },},pointer: {assetPath: "cursors/pop-coral/pointer.png",@@ -154,6 +194,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 12.3456,hotspotY: 2,+ model3d: {+ assetPath: "cursors/pop-coral/model-pointer.png",+ depthPath: "cursors/pop-coral/model-pointer-depth.png",+ hotspotX: 12.1152,+ hotspotY: 1.9616,+ },},},},@@ -167,6 +213,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 7.3664,hotspotY: 2,+ model3d: {+ assetPath: "cursors/pixel-candy/model-arrow.png",+ depthPath: "cursors/pixel-candy/model-arrow-depth.png",+ hotspotX: 7.8176,+ hotspotY: 1.9616,+ },},pointer: {assetPath: "cursors/pixel-candy/pointer.png",@@ -174,6 +226,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 13.376,hotspotY: 1.9264,+ model3d: {+ assetPath: "cursors/pixel-candy/model-pointer.png",+ depthPath: "cursors/pixel-candy/model-pointer-depth.png",+ hotspotX: 13.6256,+ hotspotY: 1.92,+ },},},},@@ -187,6 +245,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 4.7232,hotspotY: 2.1152,+ model3d: {+ assetPath: "cursors/star-sprout/model-arrow.png",+ depthPath: "cursors/star-sprout/model-arrow-depth.png",+ hotspotX: 3.7824,+ hotspotY: 1.9136,+ },},pointer: {assetPath: "cursors/star-sprout/pointer.png",@@ -194,6 +258,12 @@ export const CURSOR_THEMES: readonly CursorTheme[] = [height: 32,hotspotX: 13.1712,hotspotY: 2.0384,+ model3d: {+ assetPath: "cursors/star-sprout/model-pointer.png",+ depthPath: "cursors/star-sprout/model-pointer-depth.png",+ hotspotX: 12.8352,+ hotspotY: 2.0,+ },},},},@@ -252,6 +322,7 @@ export function normalizeCursorThemeId(id: unknown): string {export function resolveCursorSprites(themeId: string | null | undefined,alwaysArrow = false,+ model3d = false,): Record<NativeCursorType, CursorSprite> {const sprites = { ...DEFAULT_CURSOR_SPRITES };for (const [type, asset] of Object.entries(getCursorTheme(themeId)?.assets ?? {})) {@@ -259,11 +330,12 @@ export function resolveCursorSprites(continue;}sprites[type as NativeCursorType] = {- assetPath: asset.assetPath,+ assetPath: model3d && asset.model3d ? asset.model3d.assetPath : asset.assetPath,// Theme hotspots are authored against the asset's own 32-logical reference;// the contract is a fraction of the image. See CursorSprite.- hotspotX: asset.hotspotX / asset.width,- hotspotY: asset.hotspotY / asset.height,+ hotspotX: (model3d && asset.model3d ? asset.model3d.hotspotX : asset.hotspotX) / asset.width,+ hotspotY: (model3d && asset.model3d ? asset.model3d.hotspotY : asset.hotspotY) / asset.height,+ ...(model3d && asset.model3d ? { modelDepthPath: asset.model3d.depthPath } : {}),};}// "Always use arrow": one consistent pointer for the whole recording, the I-beam and the