sync: update core and viewer from monorepo (#143)
Major changes: - Roof system rewrite with roof-segment support - Scene store refactor - Spatial grid improvements - Item light system - Post-processing and selection manager updates - Perf monitor component Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bafc5973a3
commit
1d28e4208f
@@ -0,0 +1,53 @@
|
||||
import type { AnyNodeId, Interactive, LightEffect, SliderControl } from '@pascal-app/core'
|
||||
import { create } from 'zustand'
|
||||
|
||||
export type LightRegistration = {
|
||||
nodeId: AnyNodeId
|
||||
effect: LightEffect
|
||||
toggleIndex: number
|
||||
sliderIndex: number
|
||||
sliderMin: number
|
||||
sliderMax: number
|
||||
hasSlider: boolean
|
||||
}
|
||||
|
||||
type ItemLightPoolStore = {
|
||||
registrations: Map<string, LightRegistration>
|
||||
register: (key: string, nodeId: AnyNodeId, effect: LightEffect, interactive: Interactive) => void
|
||||
unregister: (key: string) => void
|
||||
}
|
||||
|
||||
export const useItemLightPool = create<ItemLightPoolStore>((set) => ({
|
||||
registrations: new Map(),
|
||||
|
||||
register: (key, nodeId, effect, interactive) => {
|
||||
const toggleIndex = interactive.controls.findIndex((c) => c.kind === 'toggle')
|
||||
const sliderIndex = interactive.controls.findIndex((c) => c.kind === 'slider')
|
||||
const sliderControl =
|
||||
sliderIndex >= 0 ? (interactive.controls[sliderIndex] as SliderControl) : null
|
||||
|
||||
const registration: LightRegistration = {
|
||||
nodeId,
|
||||
effect,
|
||||
toggleIndex,
|
||||
sliderIndex,
|
||||
hasSlider: sliderControl !== null,
|
||||
sliderMin: sliderControl?.min ?? 0,
|
||||
sliderMax: sliderControl?.max ?? 1,
|
||||
}
|
||||
|
||||
set((s) => {
|
||||
const next = new Map(s.registrations)
|
||||
next.set(key, registration)
|
||||
return { registrations: next }
|
||||
})
|
||||
},
|
||||
|
||||
unregister: (key) => {
|
||||
set((s) => {
|
||||
const next = new Map(s.registrations)
|
||||
next.delete(key)
|
||||
return { registrations: next }
|
||||
})
|
||||
},
|
||||
}))
|
||||
@@ -61,6 +61,9 @@ type ViewerState = {
|
||||
exportScene: (() => Promise<void>) | null
|
||||
setExportScene: (fn: (() => Promise<void>) | null) => void
|
||||
|
||||
debugColors: boolean
|
||||
setDebugColors: (enabled: boolean) => void
|
||||
|
||||
cameraDragging: boolean
|
||||
setCameraDragging: (dragging: boolean) => void
|
||||
}
|
||||
@@ -173,6 +176,9 @@ const useViewer = create<ViewerState>()(
|
||||
exportScene: null,
|
||||
setExportScene: (fn) => set({ exportScene: fn }),
|
||||
|
||||
debugColors: false,
|
||||
setDebugColors: (enabled) => set({ debugColors: enabled }),
|
||||
|
||||
cameraDragging: false,
|
||||
setCameraDragging: (dragging) => set({ cameraDragging: dragging }),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user