@@ -42,6 +42,10 @@ interface SerializedGallerySceneOptions {
4242 shadow ?: boolean ;
4343 self ?: boolean ;
4444 reach ?: number ;
45+ sp ?: boolean ;
46+ sd ?: number ;
47+ sst ?: SceneOptionsState [ "shadowStyle" ] ;
48+ sfa ?: boolean ;
4549 ground ?: boolean ;
4650 gc ?: string ;
4751 fl ?: boolean ;
@@ -101,6 +105,10 @@ const COMPACT_KEY_BY_OPTION: Record<SerializedGallerySceneOptionKey, string> = {
101105 shadow : "S" ,
102106 self : "Z" ,
103107 reach : "E" ,
108+ sp : "D" ,
109+ sd : "F" ,
110+ sst : "H" ,
111+ sfa : "I" ,
104112 ground : "g" ,
105113 gc : "G" ,
106114 fl : "L" ,
@@ -134,6 +142,7 @@ const BOOLEAN_OPTIONS = new Set<SerializedGallerySceneOptionKey>([
134142 "ap" , "c" , "i" , "ar" , "axes" , "sel" , "hov" , "helper" ,
135143 "solid" , "fill" , "outline" , "shadow" , "ground" ,
136144 "fl" , "fm" , "fj" , "fc" , "fiy" ,
145+ "self" , "sp" , "sfa" ,
137146] ) ;
138147
139148function getRoutePresetValue ( ) : string {
@@ -274,6 +283,10 @@ function sceneOptionsPayload(
274283 addBoolean ( out , "shadow" , options . castShadow , defaults . castShadow ) ;
275284 addBoolean ( out , "self" , options . selfShadow , defaults . selfShadow ) ;
276285 addNumber ( out , "reach" , options . shadowMaxExtend , defaults . shadowMaxExtend ) ;
286+ addBoolean ( out , "sp" , options . shadowParametric , defaults . shadowParametric ) ;
287+ addNumber ( out , "sd" , options . shadowDefinition , defaults . shadowDefinition ) ;
288+ addString ( out , "sst" , options . shadowStyle , defaults . shadowStyle ) ;
289+ addBoolean ( out , "sfa" , options . shadowFollowAnimation , defaults . shadowFollowAnimation ) ;
277290 addBoolean ( out , "ground" , options . showGround , defaults . showGround ) ;
278291 addString ( out , "gc" , options . groundColor , defaults . groundColor ) ;
279292 addBoolean ( out , "fl" , options . fpvLook , defaults . fpvLook ) ;
@@ -377,6 +390,9 @@ function encodeCompactValue(key: SerializedGallerySceneOptionKey, value: Seriali
377390 if ( key === "drag" && ( value === "orbit" || value === "pan" || value === "fpv" ) ) {
378391 return encodeEnum ( value , { orbit : "o" , pan : "p" , fpv : "f" } ) ;
379392 }
393+ if ( key === "sst" && ( value === "vector" || value === "pixel" ) ) {
394+ return encodeEnum ( value , { vector : "v" , pixel : "p" } ) ;
395+ }
380396 return typeof value === "string" ? value : undefined ;
381397}
382398
@@ -444,6 +460,10 @@ function isDragMode(value: unknown): value is SceneOptionsState["dragMode"] {
444460 return value === "orbit" || value === "pan" || value === "fpv" ;
445461}
446462
463+ function isShadowStyle ( value : unknown ) : value is SceneOptionsState [ "shadowStyle" ] {
464+ return value === "vector" || value === "pixel" ;
465+ }
466+
447467function isVec3 ( value : unknown ) : value is SceneTarget {
448468 return Array . isArray ( value ) &&
449469 value . length === 3 &&
@@ -493,6 +513,10 @@ function sceneOptionsFromPayload(o: SerializedGallerySceneOptions): Partial<Scen
493513 ...( isBoolean ( o . shadow ) ? { castShadow : o . shadow } : null ) ,
494514 ...( isBoolean ( o . self ) ? { selfShadow : o . self } : null ) ,
495515 ...( isFiniteNumber ( o . reach ) ? { shadowMaxExtend : o . reach } : null ) ,
516+ ...( isBoolean ( o . sp ) ? { shadowParametric : o . sp } : null ) ,
517+ ...( isFiniteNumber ( o . sd ) ? { shadowDefinition : o . sd } : null ) ,
518+ ...( isShadowStyle ( o . sst ) ? { shadowStyle : o . sst } : null ) ,
519+ ...( isBoolean ( o . sfa ) ? { shadowFollowAnimation : o . sfa } : null ) ,
496520 ...( isBoolean ( o . ground ) ? { showGround : o . ground } : null ) ,
497521 ...( isHexColor ( o . gc ) ? { groundColor : o . gc . toLowerCase ( ) } : null ) ,
498522 ...( isBoolean ( o . fl ) ? { fpvLook : o . fl } : null ) ,
@@ -527,6 +551,7 @@ function decodeDottedCompactValue(key: SerializedGallerySceneOptionKey, value: s
527551 if ( key === "mp" || key === "bp" ) return value === "e" ? "exact" : value ;
528552 if ( key === "mr" ) return decodeEnum ( value , { lossless : "x" , lossy : "y" , disabled : "d" } ) ;
529553 if ( key === "drag" ) return decodeEnum ( value , { orbit : "o" , pan : "p" , fpv : "f" } ) ;
554+ if ( key === "sst" ) return decodeEnum ( value , { vector : "v" , pixel : "p" } ) ;
530555 return decodeCompactNumber ( value ) ?? value ;
531556}
532557
@@ -604,6 +629,10 @@ function readPackedValue(
604629 const value = decodeEnum ( routeValue [ index ] ?? "" , { orbit : "o" , pan : "p" , fpv : "f" } ) ;
605630 return value ? { value, next : index + 1 } : undefined ;
606631 }
632+ if ( key === "sst" ) {
633+ const value = decodeEnum ( routeValue [ index ] ?? "" , { vector : "v" , pixel : "p" } ) ;
634+ return value ? { value, next : index + 1 } : undefined ;
635+ }
607636 return readPackedNumber ( routeValue , index ) ;
608637}
609638
0 commit comments