( node: CompositionChild, previous: SerializableCompositionChild, dirtyNodeIds: ReadonlySet<string>, context?: CompositionSerializationContext, path = "root", )
| 62 | } |
| 63 | |
| 64 | export interface NumericShaderUniformSnapshot { |
| 65 | values: number[]; |
| 66 | /** Undefined for scalar/vector uniforms; 1-4 for uniform arrays. */ |
| 67 | arrayElementWidth?: number; |
| 68 | } |
| 69 | |
| 70 | const SHADER_INPUT_STAGE_INDEX = 0xffff_ffff; |
| 71 | const PAINT_STAGE_INDEX = 0xffff_fffe; |
| 72 | const OVERLAY_STAGE_INDEX = 0xffff_fffd; |
| 73 | |
| 74 | export function serializeCompositionTree( |
| 75 | node: CompositionChild, |
| 76 | context?: CompositionSerializationContext, |
| 77 | path = "root", |
| 78 | ): SerializableCompositionChild { |
| 79 | if (typeof node === "string" || typeof node === "number") { |
| 80 | return node; |
| 81 | } |
| 82 | |
| 83 | return serializeElementNode(node, context, path); |
| 84 | } |
| 85 | |
| 86 | export function patchSerializedCompositionTree( |
| 87 | node: CompositionChild, |
| 88 | previous: SerializableCompositionChild, |
| 89 | dirtyNodeIds: ReadonlySet<string>, |
| 90 | context?: CompositionSerializationContext, |
| 91 | path = "root", |
| 92 | ): SerializableCompositionChild { |
| 93 | if (typeof node === "string" || typeof node === "number") { |
| 94 | return previous; |
| 95 | } |
| 96 | if (typeof previous === "string" || typeof previous === "number") { |
| 97 | return serializeCompositionTree(node, context, path); |
| 98 | } |
| 99 |
no test coverage detected