Finished up most documentation

This commit is contained in:
2026-09-10 21:11:07 -07:00
parent 2cfa0ca690
commit 8355743ada
14 changed files with 1871 additions and 868 deletions

View File

@@ -720,6 +720,8 @@ async function preparePack() {
packLoading = true
packError = undefined
updatePackUI()
let preparedPack: PackOpening | undefined
let textures: THREE.Texture[] = []
try {
// Separate texture ownership keeps local artwork, experiments and fixture disposal independent.
const paths = [fixtureAssets.David.artwork, fixtureAssets.David.mask,
@@ -732,12 +734,12 @@ async function preparePack() {
}
throw failure.reason
}
const textures = results.map((result, index) => {
textures = results.map((result, index) => {
if (result.status !== 'fulfilled') throw new Error(`Missing pack asset: ${paths[index]}`)
configureFrontTexture(result.value, index % 2 ? THREE.NoColorSpace : THREE.SRGBColorSpace)
return result.value
})
pack = new PackOpening({
preparedPack = new PackOpening({
canvas,
textures: {
David: { artwork: textures[0], mask: textures[1] },
@@ -749,12 +751,24 @@ async function preparePack() {
lightPosition,
onChange: () => { packUIDirty = true },
})
scene.add(pack.root)
pack.syncLighting(frontMaterial)
pack.setActive(mode === 'Pack')
pack.resize(canvas.clientWidth, canvas.clientHeight)
preparedPack.resize(canvas.clientWidth, canvas.clientHeight)
let preparedEnvironment: THREE.Texture | null
let preparedLightType: LightType
do {
preparedEnvironment = scene.environment
preparedLightType = controls.lightType
preparedPack.syncLighting(frontMaterial)
await preparedPack.prepareGPU(renderer, scene)
} while (scene.environment !== preparedEnvironment || controls.lightType !== preparedLightType)
preparedPack.syncLighting(frontMaterial)
preparedPack.resize(canvas.clientWidth, canvas.clientHeight)
preparedPack.setActive(mode === 'Pack')
scene.add(preparedPack.root)
pack = preparedPack
} catch (error) {
packError = `Pack assets unavailable: ${error instanceof Error ? error.message : String(error)}`
preparedPack?.dispose()
for (const texture of textures) texture.dispose()
packError = `Pack unavailable: ${error instanceof Error ? error.message : String(error)}`
console.error('Could not prepare pack prototype', error)
} finally {
packLoading = false