@3driseai/3drise-viewer 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +9 -5
- package/dist/animationsV2/clipUtils.d.ts +9 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -1
- package/dist/animationsV2/clipUtils.js +11 -2
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +2 -0
- package/dist/animationsV2/types.d.ts +4 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/api/sceneHandle.d.ts +40 -3
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +40 -0
- package/dist/components/GalleryObject.d.ts +13 -0
- package/dist/components/GalleryObject.d.ts.map +1 -0
- package/dist/components/GalleryObject.js +46 -0
- package/dist/components/ImageObject.d.ts +9 -0
- package/dist/components/ImageObject.d.ts.map +1 -0
- package/dist/components/ImageObject.js +26 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +11 -5
- package/dist/components/ProjectLoader.d.ts +2 -0
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +2 -2
- package/dist/components/SceneBuilder.d.ts +10 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +3 -2
- package/dist/components/gallery/BasicCarouselGallery.d.ts +18 -0
- package/dist/components/gallery/BasicCarouselGallery.d.ts.map +1 -0
- package/dist/components/gallery/BasicCarouselGallery.js +9 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts +18 -0
- package/dist/components/gallery/ContourLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/ContourLinesGallery.js +9 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts +18 -0
- package/dist/components/gallery/DepthLayersGallery.d.ts.map +1 -0
- package/dist/components/gallery/DepthLayersGallery.js +9 -0
- package/dist/components/gallery/EngravingGallery.d.ts +18 -0
- package/dist/components/gallery/EngravingGallery.d.ts.map +1 -0
- package/dist/components/gallery/EngravingGallery.js +9 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts +18 -0
- package/dist/components/gallery/FlowLinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/FlowLinesGallery.js +9 -0
- package/dist/components/gallery/FoldGallery.d.ts +18 -0
- package/dist/components/gallery/FoldGallery.d.ts.map +1 -0
- package/dist/components/gallery/FoldGallery.js +9 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts +18 -0
- package/dist/components/gallery/GlassPanesGallery.d.ts.map +1 -0
- package/dist/components/gallery/GlassPanesGallery.js +9 -0
- package/dist/components/gallery/HaloGallery.d.ts +18 -0
- package/dist/components/gallery/HaloGallery.d.ts.map +1 -0
- package/dist/components/gallery/HaloGallery.js +9 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts +18 -0
- package/dist/components/gallery/LightThreadsGallery.d.ts.map +1 -0
- package/dist/components/gallery/LightThreadsGallery.js +9 -0
- package/dist/components/gallery/LoomGallery.d.ts +18 -0
- package/dist/components/gallery/LoomGallery.d.ts.map +1 -0
- package/dist/components/gallery/LoomGallery.js +9 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts +18 -0
- package/dist/components/gallery/PaperLanternsGallery.d.ts.map +1 -0
- package/dist/components/gallery/PaperLanternsGallery.js +9 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts +18 -0
- package/dist/components/gallery/ParticleShiftGallery.d.ts.map +1 -0
- package/dist/components/gallery/ParticleShiftGallery.js +9 -0
- package/dist/components/gallery/PinscreenGallery.d.ts +18 -0
- package/dist/components/gallery/PinscreenGallery.d.ts.map +1 -0
- package/dist/components/gallery/PinscreenGallery.js +9 -0
- package/dist/components/gallery/PopUpGallery.d.ts +18 -0
- package/dist/components/gallery/PopUpGallery.d.ts.map +1 -0
- package/dist/components/gallery/PopUpGallery.js +9 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts +18 -0
- package/dist/components/gallery/PrismSplitGallery.d.ts.map +1 -0
- package/dist/components/gallery/PrismSplitGallery.js +9 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts +18 -0
- package/dist/components/gallery/RidgelinesGallery.d.ts.map +1 -0
- package/dist/components/gallery/RidgelinesGallery.js +9 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts +18 -0
- package/dist/components/gallery/ShadowBoxGallery.d.ts.map +1 -0
- package/dist/components/gallery/ShadowBoxGallery.js +9 -0
- package/dist/components/gallery/SilkGallery.d.ts +18 -0
- package/dist/components/gallery/SilkGallery.d.ts.map +1 -0
- package/dist/components/gallery/SilkGallery.js +9 -0
- package/dist/components/gallery/SlatsGallery.d.ts +18 -0
- package/dist/components/gallery/SlatsGallery.d.ts.map +1 -0
- package/dist/components/gallery/SlatsGallery.js +9 -0
- package/dist/components/gallery/StrataGallery.d.ts +18 -0
- package/dist/components/gallery/StrataGallery.d.ts.map +1 -0
- package/dist/components/gallery/StrataGallery.js +9 -0
- package/dist/components/gallery/TerracesGallery.d.ts +18 -0
- package/dist/components/gallery/TerracesGallery.d.ts.map +1 -0
- package/dist/components/gallery/TerracesGallery.js +9 -0
- package/dist/components/gallery/WireReliefGallery.d.ts +18 -0
- package/dist/components/gallery/WireReliefGallery.d.ts.map +1 -0
- package/dist/components/gallery/WireReliefGallery.js +9 -0
- package/dist/components/gallery/index.d.ts +46 -0
- package/dist/components/gallery/index.d.ts.map +1 -0
- package/dist/components/gallery/index.js +22 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts +68 -0
- package/dist/components/gallery/kit/GalleryVariant.d.ts.map +1 -0
- package/dist/components/gallery/kit/GalleryVariant.js +231 -0
- package/dist/components/gallery/kit/feeds.d.ts +7 -0
- package/dist/components/gallery/kit/feeds.d.ts.map +1 -0
- package/dist/components/gallery/kit/feeds.js +83 -0
- package/dist/components/gallery/kit/galleryKit.d.ts +118 -0
- package/dist/components/gallery/kit/galleryKit.d.ts.map +1 -0
- package/dist/components/gallery/kit/galleryKit.js +298 -0
- package/dist/components/gallery/kit/lookBase.d.ts +157 -0
- package/dist/components/gallery/kit/lookBase.d.ts.map +1 -0
- package/dist/components/gallery/kit/lookBase.js +211 -0
- package/dist/components/gallery/kit/pictures.d.ts +14 -0
- package/dist/components/gallery/kit/pictures.d.ts.map +1 -0
- package/dist/components/gallery/kit/pictures.js +81 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts +177 -0
- package/dist/components/gallery/looks/basicCarousel.d.ts.map +1 -0
- package/dist/components/gallery/looks/basicCarousel.js +315 -0
- package/dist/components/gallery/looks/contourLines.d.ts +153 -0
- package/dist/components/gallery/looks/contourLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/contourLines.js +91 -0
- package/dist/components/gallery/looks/depthLayers.d.ts +155 -0
- package/dist/components/gallery/looks/depthLayers.d.ts.map +1 -0
- package/dist/components/gallery/looks/depthLayers.js +87 -0
- package/dist/components/gallery/looks/engraving.d.ts +162 -0
- package/dist/components/gallery/looks/engraving.d.ts.map +1 -0
- package/dist/components/gallery/looks/engraving.js +96 -0
- package/dist/components/gallery/looks/flowLines.d.ts +180 -0
- package/dist/components/gallery/looks/flowLines.d.ts.map +1 -0
- package/dist/components/gallery/looks/flowLines.js +113 -0
- package/dist/components/gallery/looks/fold.d.ts +209 -0
- package/dist/components/gallery/looks/fold.d.ts.map +1 -0
- package/dist/components/gallery/looks/fold.js +155 -0
- package/dist/components/gallery/looks/glassPanes.d.ts +133 -0
- package/dist/components/gallery/looks/glassPanes.d.ts.map +1 -0
- package/dist/components/gallery/looks/glassPanes.js +208 -0
- package/dist/components/gallery/looks/halo.d.ts +100 -0
- package/dist/components/gallery/looks/halo.d.ts.map +1 -0
- package/dist/components/gallery/looks/halo.js +119 -0
- package/dist/components/gallery/looks/lightThreads.d.ts +199 -0
- package/dist/components/gallery/looks/lightThreads.d.ts.map +1 -0
- package/dist/components/gallery/looks/lightThreads.js +246 -0
- package/dist/components/gallery/looks/loom.d.ts +238 -0
- package/dist/components/gallery/looks/loom.d.ts.map +1 -0
- package/dist/components/gallery/looks/loom.js +256 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts +181 -0
- package/dist/components/gallery/looks/paperLanterns.d.ts.map +1 -0
- package/dist/components/gallery/looks/paperLanterns.js +399 -0
- package/dist/components/gallery/looks/particleShift.d.ts +193 -0
- package/dist/components/gallery/looks/particleShift.d.ts.map +1 -0
- package/dist/components/gallery/looks/particleShift.js +282 -0
- package/dist/components/gallery/looks/pinscreen.d.ts +175 -0
- package/dist/components/gallery/looks/pinscreen.d.ts.map +1 -0
- package/dist/components/gallery/looks/pinscreen.js +96 -0
- package/dist/components/gallery/looks/popUp.d.ts +206 -0
- package/dist/components/gallery/looks/popUp.d.ts.map +1 -0
- package/dist/components/gallery/looks/popUp.js +132 -0
- package/dist/components/gallery/looks/prismSplit.d.ts +151 -0
- package/dist/components/gallery/looks/prismSplit.d.ts.map +1 -0
- package/dist/components/gallery/looks/prismSplit.js +84 -0
- package/dist/components/gallery/looks/ridgelines.d.ts +179 -0
- package/dist/components/gallery/looks/ridgelines.d.ts.map +1 -0
- package/dist/components/gallery/looks/ridgelines.js +111 -0
- package/dist/components/gallery/looks/shadowBox.d.ts +152 -0
- package/dist/components/gallery/looks/shadowBox.d.ts.map +1 -0
- package/dist/components/gallery/looks/shadowBox.js +82 -0
- package/dist/components/gallery/looks/silk.d.ts +140 -0
- package/dist/components/gallery/looks/silk.d.ts.map +1 -0
- package/dist/components/gallery/looks/silk.js +346 -0
- package/dist/components/gallery/looks/slats.d.ts +176 -0
- package/dist/components/gallery/looks/slats.d.ts.map +1 -0
- package/dist/components/gallery/looks/slats.js +93 -0
- package/dist/components/gallery/looks/strata.d.ts +172 -0
- package/dist/components/gallery/looks/strata.d.ts.map +1 -0
- package/dist/components/gallery/looks/strata.js +88 -0
- package/dist/components/gallery/looks/terraces.d.ts +168 -0
- package/dist/components/gallery/looks/terraces.d.ts.map +1 -0
- package/dist/components/gallery/looks/terraces.js +91 -0
- package/dist/components/gallery/looks/wireRelief.d.ts +153 -0
- package/dist/components/gallery/looks/wireRelief.d.ts.map +1 -0
- package/dist/components/gallery/looks/wireRelief.js +128 -0
- package/dist/components/image/ContourImage.d.ts +7 -0
- package/dist/components/image/ContourImage.d.ts.map +1 -0
- package/dist/components/image/ContourImage.js +6 -0
- package/dist/components/image/EngravingImage.d.ts +7 -0
- package/dist/components/image/EngravingImage.d.ts.map +1 -0
- package/dist/components/image/EngravingImage.js +6 -0
- package/dist/components/image/FrostImage.d.ts +7 -0
- package/dist/components/image/FrostImage.d.ts.map +1 -0
- package/dist/components/image/FrostImage.js +6 -0
- package/dist/components/image/LenticularImage.d.ts +7 -0
- package/dist/components/image/LenticularImage.d.ts.map +1 -0
- package/dist/components/image/LenticularImage.js +6 -0
- package/dist/components/image/PinscreenImage.d.ts +7 -0
- package/dist/components/image/PinscreenImage.d.ts.map +1 -0
- package/dist/components/image/PinscreenImage.js +6 -0
- package/dist/components/image/PrismImage.d.ts +7 -0
- package/dist/components/image/PrismImage.d.ts.map +1 -0
- package/dist/components/image/PrismImage.js +6 -0
- package/dist/components/image/ProjectorImage.d.ts +7 -0
- package/dist/components/image/ProjectorImage.d.ts.map +1 -0
- package/dist/components/image/ProjectorImage.js +6 -0
- package/dist/components/image/ReliefImage.d.ts +7 -0
- package/dist/components/image/ReliefImage.d.ts.map +1 -0
- package/dist/components/image/ReliefImage.js +6 -0
- package/dist/components/image/RollImage.d.ts +7 -0
- package/dist/components/image/RollImage.d.ts.map +1 -0
- package/dist/components/image/RollImage.js +6 -0
- package/dist/components/image/ShardsImage.d.ts +126 -0
- package/dist/components/image/ShardsImage.d.ts.map +1 -0
- package/dist/components/image/ShardsImage.js +470 -0
- package/dist/components/image/core/contour.d.ts +126 -0
- package/dist/components/image/core/contour.d.ts.map +1 -0
- package/dist/components/image/core/contour.js +123 -0
- package/dist/components/image/core/engraving.d.ts +135 -0
- package/dist/components/image/core/engraving.d.ts.map +1 -0
- package/dist/components/image/core/engraving.js +163 -0
- package/dist/components/image/core/frost.d.ts +126 -0
- package/dist/components/image/core/frost.d.ts.map +1 -0
- package/dist/components/image/core/frost.js +156 -0
- package/dist/components/image/core/imageCore.d.ts +110 -0
- package/dist/components/image/core/imageCore.d.ts.map +1 -0
- package/dist/components/image/core/imageCore.js +269 -0
- package/dist/components/image/core/lenticular.d.ts +129 -0
- package/dist/components/image/core/lenticular.d.ts.map +1 -0
- package/dist/components/image/core/lenticular.js +132 -0
- package/dist/components/image/core/pinscreen.d.ts +126 -0
- package/dist/components/image/core/pinscreen.d.ts.map +1 -0
- package/dist/components/image/core/pinscreen.js +147 -0
- package/dist/components/image/core/prism.d.ts +120 -0
- package/dist/components/image/core/prism.d.ts.map +1 -0
- package/dist/components/image/core/prism.js +164 -0
- package/dist/components/image/core/projector.d.ts +135 -0
- package/dist/components/image/core/projector.d.ts.map +1 -0
- package/dist/components/image/core/projector.js +225 -0
- package/dist/components/image/core/relief.d.ts +111 -0
- package/dist/components/image/core/relief.d.ts.map +1 -0
- package/dist/components/image/core/relief.js +94 -0
- package/dist/components/image/core/roll.d.ts +114 -0
- package/dist/components/image/core/roll.d.ts.map +1 -0
- package/dist/components/image/core/roll.js +116 -0
- package/dist/components/image/imageVariant.d.ts +46 -0
- package/dist/components/image/imageVariant.d.ts.map +1 -0
- package/dist/components/image/imageVariant.js +128 -0
- package/dist/components/image/index.d.ts +22 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +10 -0
- package/dist/components/image/pictureCycle.d.ts +15 -0
- package/dist/components/image/pictureCycle.d.ts.map +1 -0
- package/dist/components/image/pictureCycle.js +82 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +9 -7
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +39 -27
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/galleryRuntime.d.ts +57 -0
- package/dist/galleryRuntime.d.ts.map +1 -0
- package/dist/galleryRuntime.js +105 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/keyPad/KeyPadControls.d.ts +16 -0
- package/dist/keyPad/KeyPadControls.d.ts.map +1 -0
- package/dist/keyPad/KeyPadControls.js +176 -0
- package/dist/keyPad/index.d.ts +16 -0
- package/dist/keyPad/index.d.ts.map +1 -0
- package/dist/keyPad/index.js +8 -0
- package/dist/keyPad/keyBindings.d.ts +43 -0
- package/dist/keyPad/keyBindings.d.ts.map +1 -0
- package/dist/keyPad/keyBindings.js +92 -0
- package/dist/keyPad/keyPadAnimation.d.ts +28 -0
- package/dist/keyPad/keyPadAnimation.d.ts.map +1 -0
- package/dist/keyPad/keyPadAnimation.js +131 -0
- package/dist/keyPad/keyPadMotion.d.ts +68 -0
- package/dist/keyPad/keyPadMotion.d.ts.map +1 -0
- package/dist/keyPad/keyPadMotion.js +283 -0
- package/dist/keyPad/keyPadStore.d.ts +25 -0
- package/dist/keyPad/keyPadStore.d.ts.map +1 -0
- package/dist/keyPad/keyPadStore.js +63 -0
- package/dist/keyPad/types.d.ts +23 -0
- package/dist/keyPad/types.d.ts.map +1 -0
- package/dist/keyPad/types.js +9 -0
- package/dist/operations/catalogue/visibility.d.ts.map +1 -1
- package/dist/operations/catalogue/visibility.js +23 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts +2 -1
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudResolveMaterial.js +37 -12
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts +4 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts.map +1 -1
- package/dist/shaders/clouds/CloudVolumeMaterial.js +15 -3
- package/dist/triggers/kinds/gallery.d.ts +2 -0
- package/dist/triggers/kinds/gallery.d.ts.map +1 -0
- package/dist/triggers/kinds/gallery.js +39 -0
- package/dist/triggers/kinds/index.d.ts +1 -0
- package/dist/triggers/kinds/index.d.ts.map +1 -1
- package/dist/triggers/kinds/index.js +1 -0
- package/dist/ui/UiLayers.d.ts +17 -1
- package/dist/ui/UiLayers.d.ts.map +1 -1
- package/dist/ui/UiLayers.js +76 -3
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// The approved lab module, verbatim but for its import paths and the lab's picture loader (Claude outputs/gallery-lab/
|
|
2
|
+
// glass.mjs). Plain JS-shaped code (the viewer compiles non-strict); typed at its one door, kit/GalleryVariant.tsx. Its own DEFAULTS only fill knobs the
|
|
3
|
+
// core defaults (DEFAULT_GALLERY_OBJECTS.glassPanes) do not carry; its own autoplay is never used.
|
|
4
|
+
// glass — the pictures are printed inside thick panes of glass: a picture plate sealed behind a slab of real
|
|
5
|
+
// glass (physical transmission, roughness, thickness, clearcoat — the room refracts through it). The row slides
|
|
6
|
+
// on a damped spring; the pane at the front steps forward, the others stand back at depth, dimmer. Everything is
|
|
7
|
+
// lit by the scene (the studio's lights); the gallery adds none. Cursor: the panes lean toward it.
|
|
8
|
+
import * as THREE from 'three';
|
|
9
|
+
import { fragHead, col, smooth, createScroll, sliceTextures, withLean } from '../kit/galleryKit.js';
|
|
10
|
+
import { createLayout, LAYOUT_GUI } from '../kit/galleryKit.js';
|
|
11
|
+
export const catalog = { key: 'glass', name: 'Glass Panes', camera: { position: [0.6, 0.35, 5.0], target: [0, -0.15, 0] },
|
|
12
|
+
description: 'Pictures sealed inside thick physical glass panes, lit by the scene; a change slides the row along. Use for architecture, luxury, product and corporate showcases.',
|
|
13
|
+
tags: ['gallery', 'glass', 'refraction', 'navigation', 'interactive'] };
|
|
14
|
+
export const DEFAULTS = {
|
|
15
|
+
type: 'glass', enabled: true, lean: 1, imageUrls: [], autoplay: 0, intensity: 1, opacity: 1,
|
|
16
|
+
aspect: 1.4, width: 1.6, thickness: 0.09, // structural
|
|
17
|
+
layout: 'row', spacing: 1.25, depth: 0.7, visible: 2.6, shape: 1, dim: 0.3, focusLift: 0.35,
|
|
18
|
+
stiffness: 34, damping: 9, throwing: 0.12,
|
|
19
|
+
turnTime: 1.4, turnAngle: 0,
|
|
20
|
+
edgeGlow: 0, roughness: 0.06, ior: 1.5, tint: '#dfe9ff', edgeColor: '#9ad7ff',
|
|
21
|
+
pointerMode: 'none', pointerStrength: 1, pointerRadius: 1.5, pointerColor: '#ffd9a6',
|
|
22
|
+
};
|
|
23
|
+
export const STRUCTURAL = ['imageUrls', 'aspect', 'width', 'thickness'];
|
|
24
|
+
export const POINTER_MODES = ['tilt'];
|
|
25
|
+
export const GUI = [
|
|
26
|
+
{ key: 'lean', min: 0, max: 3, step: 0.01, tip: 'The gallery turns toward the cursor' },
|
|
27
|
+
{ key: 'aspect', min: 0.6, max: 2.5, step: 0.01 }, { key: 'width', min: 0.6, max: 3, step: 0.01 }, { key: 'thickness', min: 0.02, max: 0.25, step: 0.005 },
|
|
28
|
+
...LAYOUT_GUI, { key: 'dim', min: 0, max: 1, step: 0.01 }, { key: 'focusLift', min: 0, max: 1.5, step: 0.01 },
|
|
29
|
+
{ key: 'stiffness', min: 5, max: 120, step: 1 }, { key: 'damping', min: 2, max: 30, step: 0.1 },
|
|
30
|
+
{ key: 'roughness', min: 0, max: 0.5, step: 0.005 }, { key: 'ior', min: 1, max: 2.3, step: 0.01 },
|
|
31
|
+
{ key: 'autoplay', min: 0, max: 20, step: 0.5 },
|
|
32
|
+
{ key: 'pointerMode', options: ['none', ...POINTER_MODES] }, { key: 'pointerStrength', min: 0, max: 3, step: 0.01 }, { key: 'pointerRadius', min: 0.2, max: 4, step: 0.01 },
|
|
33
|
+
{ key: 'intensity', min: 0, max: 3, step: 0.01 }, { key: 'opacity', min: 0, max: 1, step: 0.01 },
|
|
34
|
+
{ key: 'tint', color: true }, { key: 'pointerColor', color: true },
|
|
35
|
+
];
|
|
36
|
+
export const PRESETS = [
|
|
37
|
+
{ name: 'Showroom', description: 'The default.', patch: {} },
|
|
38
|
+
{ name: 'Museum', description: 'Thin, very clear glass.', patch: { thickness: 0.04, roughness: 0.02 } },
|
|
39
|
+
{ name: 'Thick slab', description: 'Heavy blue-tinted glass, frosted a little.', patch: { thickness: 0.18, roughness: 0.14, tint: '#c9d8ff' } },
|
|
40
|
+
];
|
|
41
|
+
export function createUniforms() {
|
|
42
|
+
return { uTex: { value: null }, uIntensity: { value: 1 }, uOpacity: { value: 1 }, uKey: { value: new THREE.Vector3(0.2, 0.8, 0.5).normalize() }, uEdgeColor: { value: col('#9ad7ff') }, uEdgeGlow: { value: 1.2 }, uPointerColor: { value: col('#ffd9a6') } };
|
|
43
|
+
}
|
|
44
|
+
export function applyConfig(u, c) {
|
|
45
|
+
const set = (k, v) => { if (v === undefined)
|
|
46
|
+
return; if (u[k].value && u[k].value.isColor) {
|
|
47
|
+
if (v.isColor)
|
|
48
|
+
u[k].value.copy(v);
|
|
49
|
+
else
|
|
50
|
+
u[k].value.set(v);
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
u[k].value = v; };
|
|
54
|
+
set('uIntensity', c.intensity);
|
|
55
|
+
set('uOpacity', c.opacity);
|
|
56
|
+
set('uEdgeColor', c.edgeColor);
|
|
57
|
+
set('uEdgeGlow', c.edgeGlow);
|
|
58
|
+
set('uPointerColor', c.pointerColor);
|
|
59
|
+
}
|
|
60
|
+
const picVert = /* glsl */ `
|
|
61
|
+
varying vec2 vUv; varying vec3 vN; varying vec3 vV;
|
|
62
|
+
void main(){ vUv = uv; vN = normalize(normalMatrix * normal); vec4 mv = modelViewMatrix * vec4(position, 1.0); vV = -mv.xyz; gl_Position = projectionMatrix * mv; }
|
|
63
|
+
`;
|
|
64
|
+
const picFrag = /* glsl */ `
|
|
65
|
+
${fragHead}
|
|
66
|
+
precision highp sampler2DArray;
|
|
67
|
+
uniform sampler2DArray uTex; uniform float uLayer, uDimK, uFade, uIntensity, uOpacity, uHover; uniform vec3 uKey, uPointerColor;
|
|
68
|
+
varying vec2 vUv; varying vec3 vN; varying vec3 vV;
|
|
69
|
+
void main(){
|
|
70
|
+
vec3 pic = texture(uTex, vec3(vUv, uLayer)).rgb;
|
|
71
|
+
vec3 N = normalize(vN); vec3 L = normalize((viewMatrix * vec4(uKey, 0.0)).xyz);
|
|
72
|
+
float lam = 0.65 + 0.35 * max(dot(N, L), 0.0);
|
|
73
|
+
vec3 c = pic * lam * uDimK + uPointerColor * uHover * 0.15;
|
|
74
|
+
float a = uOpacity * uFade; if (a < 0.2) discard;
|
|
75
|
+
gl_FragColor = vec4(c * uIntensity, 1.0);
|
|
76
|
+
#include <tonemapping_fragment>
|
|
77
|
+
#include <colorspace_fragment>
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
const edgeVert = /* glsl */ `
|
|
81
|
+
attribute float aT; varying float vT; varying vec3 vP;
|
|
82
|
+
void main(){ vT = aT; vP = (modelMatrix * vec4(position, 1.0)).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
|
|
83
|
+
`;
|
|
84
|
+
const edgeFrag = /* glsl */ `
|
|
85
|
+
${fragHead}
|
|
86
|
+
uniform vec3 uEdgeColor, uPic; uniform float uEdgeGlow, uDimK, uFade, uIntensity, uOpacity, uTime, uSpin;
|
|
87
|
+
varying float vT; varying vec3 vP;
|
|
88
|
+
void main(){
|
|
89
|
+
// light trapped in the slab: brightest where it enters (the lit top edge) and in a slow travelling pulse
|
|
90
|
+
float pulse = 0.6 + 0.4 * sin(vT * 12.566 - uTime * 1.2);
|
|
91
|
+
float spinFlash = 1.0 + 2.5 * uSpin;
|
|
92
|
+
vec3 c = mix(uEdgeColor, uPic, 0.45) * uEdgeGlow * 3.0 * pulse * spinFlash * uDimK;
|
|
93
|
+
float a = uFade * uOpacity; if (a < 0.003) discard;
|
|
94
|
+
gl_FragColor = vec4(c * uIntensity * a, 0.0);
|
|
95
|
+
#include <tonemapping_fragment>
|
|
96
|
+
#include <colorspace_fragment>
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
export function build(u, c) { return withLean(buildGallery(u, c), c); }
|
|
100
|
+
function buildGallery(u, c) {
|
|
101
|
+
const MAX = 32, W = c.width, H = W / c.aspect, T = c.thickness;
|
|
102
|
+
const object = new THREE.Group();
|
|
103
|
+
const railMat = new THREE.MeshStandardMaterial({ color: '#2a2d35', roughness: 0.5, metalness: 0.7 });
|
|
104
|
+
const rail = new THREE.Mesh(new THREE.BoxGeometry(1, 0.03, 0.26), railMat);
|
|
105
|
+
rail.position.y = -H / 2 - 0.02;
|
|
106
|
+
rail.receiveShadow = true;
|
|
107
|
+
rail.visible = false;
|
|
108
|
+
object.add(rail);
|
|
109
|
+
const glassMat = new THREE.MeshPhysicalMaterial({ color: c.tint, roughness: c.roughness, metalness: 0, transmission: 1, thickness: T * 3, ior: c.ior, transparent: true, envMapIntensity: 1, clearcoat: 1, clearcoatRoughness: 0.05, side: THREE.DoubleSide });
|
|
110
|
+
const slabGeo = new THREE.BoxGeometry(W, H, T);
|
|
111
|
+
const edgeGeo = (() => {
|
|
112
|
+
const pts = [[-W / 2, -H / 2], [W / 2, -H / 2], [W / 2, H / 2], [-W / 2, H / 2]];
|
|
113
|
+
const pos = [], t = [];
|
|
114
|
+
for (let i = 0; i < 4; i++) {
|
|
115
|
+
const a = pts[i], b = pts[(i + 1) % 4];
|
|
116
|
+
for (const z of [-T / 2, T / 2]) {
|
|
117
|
+
pos.push(a[0], a[1], z, b[0], b[1], z);
|
|
118
|
+
t.push(i / 4, (i + 1) / 4);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const g = new THREE.BufferGeometry();
|
|
122
|
+
g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3));
|
|
123
|
+
g.setAttribute('aT', new THREE.Float32BufferAttribute(t, 1));
|
|
124
|
+
return g;
|
|
125
|
+
})();
|
|
126
|
+
const panes = [];
|
|
127
|
+
const picGeo = new THREE.PlaneGeometry(W * 0.96, H * 0.96);
|
|
128
|
+
for (let i = 0; i < MAX; i++) {
|
|
129
|
+
const hinge = new THREE.Group();
|
|
130
|
+
// the print behind the glass: lit by the scene; opaque, because the transmission pass only sees opaque objects
|
|
131
|
+
const picMat = new THREE.MeshStandardMaterial({ color: '#ffffff', roughness: 0.55, metalness: 0, side: THREE.DoubleSide });
|
|
132
|
+
const pic = new THREE.Mesh(picGeo, picMat);
|
|
133
|
+
pic.position.z = -T * 0.25;
|
|
134
|
+
const slab = new THREE.Mesh(slabGeo, glassMat);
|
|
135
|
+
slab.castShadow = false;
|
|
136
|
+
slab.receiveShadow = false;
|
|
137
|
+
const edgeMat = new THREE.ShaderMaterial({ uniforms: { uEdgeColor: u.uEdgeColor, uEdgeGlow: u.uEdgeGlow, uPic: { value: new THREE.Color('#ffffff') }, uDimK: { value: 1 }, uFade: { value: 1 }, uIntensity: u.uIntensity, uOpacity: u.uOpacity, uTime: { value: 0 }, uSpin: { value: 0 } }, vertexShader: edgeVert, fragmentShader: edgeFrag, glslVersion: THREE.GLSL3, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, premultipliedAlpha: true });
|
|
138
|
+
const edges = new THREE.LineSegments(edgeGeo, edgeMat);
|
|
139
|
+
hinge.add(pic, slab);
|
|
140
|
+
hinge.visible = false;
|
|
141
|
+
hinge.matrixAutoUpdate = false;
|
|
142
|
+
object.add(hinge);
|
|
143
|
+
panes.push({ hinge, pic, picMat, edgeMat, spin: 0, spinDir: 1 });
|
|
144
|
+
}
|
|
145
|
+
const pick = new THREE.Mesh(new THREE.PlaneGeometry(W, H), new THREE.MeshBasicMaterial({ visible: false }));
|
|
146
|
+
object.add(pick);
|
|
147
|
+
const cfg = { ...c };
|
|
148
|
+
const scroll = createScroll(cfg, (dir) => { for (const p of panes)
|
|
149
|
+
if (p.hinge.visible) {
|
|
150
|
+
p.spin = 0.0001;
|
|
151
|
+
p.spinDir = dir;
|
|
152
|
+
} });
|
|
153
|
+
scroll.st.pitch = W * c.spacing;
|
|
154
|
+
const st = { time: 0, avg: [], tex: [] };
|
|
155
|
+
const layout = createLayout(W, H), _m = new THREE.Matrix4(), _r = new THREE.Matrix4();
|
|
156
|
+
const controls = Object.assign(scroll.controls, {
|
|
157
|
+
setTexture(tex, count) {
|
|
158
|
+
for (const t of st.tex ?? [])
|
|
159
|
+
t.dispose();
|
|
160
|
+
scroll.st.count = Math.min(count, MAX);
|
|
161
|
+
[st.tex] = sliceTextures(tex, scroll.st.count);
|
|
162
|
+
tex.dispose();
|
|
163
|
+
st.tex.forEach((t, i) => { panes[i].picMat.map = t; panes[i].picMat.needsUpdate = true; });
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
object.userData.gallery = controls;
|
|
167
|
+
return {
|
|
168
|
+
object, controls, pickMesh: pick, materials: [glassMat, railMat, ...panes.map(p => p.picMat), ...panes.map(p => p.edgeMat)],
|
|
169
|
+
apply(k) { Object.assign(cfg, k); applyConfig(u, k); scroll.st.pitch = W * cfg.spacing; if (k.tint)
|
|
170
|
+
glassMat.color.set(k.tint); if (k.roughness !== undefined)
|
|
171
|
+
glassMat.roughness = k.roughness; if (k.ior !== undefined)
|
|
172
|
+
glassMat.ior = k.ior; },
|
|
173
|
+
update(dt, pointer) {
|
|
174
|
+
dt = Math.min(dt, 0.05);
|
|
175
|
+
st.time += dt;
|
|
176
|
+
scroll.step(dt, pointer);
|
|
177
|
+
const n = scroll.st.count, s0 = scroll.st.s, pitch = W * cfg.spacing;
|
|
178
|
+
const span = Math.min(n, 2 * cfg.visible + 1) * pitch;
|
|
179
|
+
rail.scale.x = span;
|
|
180
|
+
rail.position.x = 0;
|
|
181
|
+
for (let i = 0; i < n; i++) {
|
|
182
|
+
const p = panes[i];
|
|
183
|
+
const { d, focus, fade } = layout.place(i, s0, n, cfg, p.hinge.matrix);
|
|
184
|
+
const vis = fade > 0.05;
|
|
185
|
+
p.hinge.visible = vis;
|
|
186
|
+
if (!vis)
|
|
187
|
+
continue;
|
|
188
|
+
// the front pane steps forward out of its place (along its own normal)
|
|
189
|
+
let yaw = 0;
|
|
190
|
+
if (pointer && cfg.pointerMode === 'tilt') {
|
|
191
|
+
const dx = pointer.x - p.hinge.matrix.elements[12];
|
|
192
|
+
const w = 1 - smooth(0, cfg.pointerRadius, Math.abs(dx));
|
|
193
|
+
yaw = Math.atan2(dx, 3) * 0.4 * w * cfg.pointerStrength;
|
|
194
|
+
}
|
|
195
|
+
p.hinge.matrix.multiply(_m.makeTranslation(0, 0, cfg.focusLift * focus)).multiply(_r.makeRotationY(yaw));
|
|
196
|
+
p.hinge.matrixWorldNeedsUpdate = true;
|
|
197
|
+
p.picMat.color.setScalar((1 - cfg.dim * (1 - focus)) * fade * cfg.intensity);
|
|
198
|
+
}
|
|
199
|
+
pick.position.x = 0;
|
|
200
|
+
},
|
|
201
|
+
dispose() { slabGeo.dispose(); picGeo.dispose(); edgeGeo.dispose(); glassMat.dispose(); railMat.dispose(); rail.geometry.dispose(); for (const p of panes) {
|
|
202
|
+
p.picMat.dispose();
|
|
203
|
+
p.edgeMat.dispose();
|
|
204
|
+
} pick.geometry.dispose(); if (u.uTex.value)
|
|
205
|
+
u.uTex.value.dispose(); for (const t of st.tex ?? [])
|
|
206
|
+
t.dispose(); },
|
|
207
|
+
};
|
|
208
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare const catalog: {
|
|
2
|
+
key: string;
|
|
3
|
+
name: string;
|
|
4
|
+
camera: {
|
|
5
|
+
position: number[];
|
|
6
|
+
target: number[];
|
|
7
|
+
};
|
|
8
|
+
description: string;
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const DEFAULTS: {
|
|
12
|
+
type: string;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
lean: number;
|
|
15
|
+
imageUrls: any[];
|
|
16
|
+
autoplay: number;
|
|
17
|
+
intensity: number;
|
|
18
|
+
opacity: number;
|
|
19
|
+
aspect: number;
|
|
20
|
+
width: number;
|
|
21
|
+
layout: string;
|
|
22
|
+
spacing: number;
|
|
23
|
+
depth: number;
|
|
24
|
+
visible: number;
|
|
25
|
+
shape: number;
|
|
26
|
+
stepOut: number;
|
|
27
|
+
focusScale: number;
|
|
28
|
+
stiffness: number;
|
|
29
|
+
damping: number;
|
|
30
|
+
throwing: number;
|
|
31
|
+
changeTime: number;
|
|
32
|
+
dim: number;
|
|
33
|
+
roughness: number;
|
|
34
|
+
pointerMode: string;
|
|
35
|
+
pointerStrength: number;
|
|
36
|
+
pointerRadius: number;
|
|
37
|
+
pointerColor: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const STRUCTURAL: string[];
|
|
40
|
+
export declare const POINTER_MODES: any[];
|
|
41
|
+
export declare const GUI: ({
|
|
42
|
+
key: string;
|
|
43
|
+
options: string[];
|
|
44
|
+
tip: string;
|
|
45
|
+
min?: undefined;
|
|
46
|
+
max?: undefined;
|
|
47
|
+
step?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
key: string;
|
|
50
|
+
min: number;
|
|
51
|
+
max: number;
|
|
52
|
+
step: number;
|
|
53
|
+
tip: string;
|
|
54
|
+
options?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
key: string;
|
|
57
|
+
min: number;
|
|
58
|
+
max: number;
|
|
59
|
+
step: number;
|
|
60
|
+
options?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
key: string;
|
|
63
|
+
options: any[];
|
|
64
|
+
min?: undefined;
|
|
65
|
+
max?: undefined;
|
|
66
|
+
step?: undefined;
|
|
67
|
+
})[];
|
|
68
|
+
export declare const PRESETS: ({
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
patch: {
|
|
72
|
+
shape?: undefined;
|
|
73
|
+
stepOut?: undefined;
|
|
74
|
+
spacing?: undefined;
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
patch: {
|
|
80
|
+
shape: number;
|
|
81
|
+
stepOut: number;
|
|
82
|
+
spacing?: undefined;
|
|
83
|
+
};
|
|
84
|
+
} | {
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
patch: {
|
|
88
|
+
shape: number;
|
|
89
|
+
spacing: number;
|
|
90
|
+
stepOut?: undefined;
|
|
91
|
+
};
|
|
92
|
+
})[];
|
|
93
|
+
export declare function createUniforms(): {
|
|
94
|
+
uTex: {
|
|
95
|
+
value: any;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export declare function applyConfig(): void;
|
|
99
|
+
export declare function build(u: any, c: any): any;
|
|
100
|
+
//# sourceMappingURL=halo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halo.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/looks/halo.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,OAAO;;;;;;;;;CAE6D,CAAC;AAElF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOpB,CAAC;AACF,eAAO,MAAM,UAAU,UAAmC,CAAC;AAC3D,eAAO,MAAM,aAAa,OAAK,CAAC;AAChC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;IAUf,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;IAInB,CAAC;AACF,wBAAgB,cAAc;;;;EAAwC;AACtE,wBAAgB,WAAW,SAAK;AAchC,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,OAA6C"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// The approved lab module, verbatim but for its import paths and the lab's picture loader (Claude outputs/gallery-lab/
|
|
2
|
+
// halo.mjs). Plain JS-shaped code (the viewer compiles non-strict); typed at its one door, kit/GalleryVariant.tsx. Its own DEFAULTS only fill knobs the
|
|
3
|
+
// core defaults (DEFAULT_GALLERY_OBJECTS.halo) do not carry; its own autoplay is never used.
|
|
4
|
+
// halo — the front picture steps out. Prints lit by the scene (the studio's lights; the gallery adds none): the
|
|
5
|
+
// picture that comes to the front steps out of its place toward the viewer, grows and comes to full colour; the
|
|
6
|
+
// others sit back, faded and grey. Made for the Ring layout (the default) but rides any layout.
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { createScroll, approach, sliceTextures, withLean } from '../kit/galleryKit.js';
|
|
9
|
+
import { createLayout, LAYOUT_GUI } from '../kit/galleryKit.js';
|
|
10
|
+
export const catalog = { key: 'halo', name: 'Halo', camera: { position: [0, 0.35, 5.2], target: [0, -0.2, -1.4] },
|
|
11
|
+
description: 'Scene-lit prints; the one that comes to the front steps out toward the viewer, grows and comes to full colour, the others sit back faded and grey. On a tilted ring by default. Use for brand rings, collections, hero rotations.',
|
|
12
|
+
tags: ['gallery', 'ring', 'orbit', 'rotation', 'navigation', 'interactive'] };
|
|
13
|
+
export const DEFAULTS = {
|
|
14
|
+
type: 'halo', enabled: true, lean: 1, imageUrls: [], autoplay: 0, intensity: 1, opacity: 1,
|
|
15
|
+
aspect: 1.4, width: 1.6, // structural
|
|
16
|
+
layout: 'ring', spacing: 1.0, depth: 0, visible: 2.4, shape: 1, stepOut: 0.7, focusScale: 1.3,
|
|
17
|
+
stiffness: 26, damping: 8, throwing: 0.12,
|
|
18
|
+
changeTime: 0.9, dim: 0.35, roughness: 0.6,
|
|
19
|
+
pointerMode: 'none', pointerStrength: 1, pointerRadius: 3, pointerColor: '#ffd9a6',
|
|
20
|
+
};
|
|
21
|
+
export const STRUCTURAL = ['imageUrls', 'aspect', 'width'];
|
|
22
|
+
export const POINTER_MODES = [];
|
|
23
|
+
export const GUI = [
|
|
24
|
+
{ key: 'lean', min: 0, max: 3, step: 0.01, tip: 'The gallery turns toward the cursor' },
|
|
25
|
+
{ key: 'aspect', min: 0.6, max: 2.5, step: 0.01 }, { key: 'width', min: 0.4, max: 2.5, step: 0.01 },
|
|
26
|
+
...LAYOUT_GUI,
|
|
27
|
+
{ key: 'stepOut', min: 0, max: 2, step: 0.01 }, { key: 'focusScale', min: 1, max: 2, step: 0.01 },
|
|
28
|
+
{ key: 'stiffness', min: 5, max: 120, step: 1 }, { key: 'damping', min: 2, max: 30, step: 0.1 },
|
|
29
|
+
{ key: 'changeTime', min: 0.2, max: 3, step: 0.05 }, { key: 'dim', min: 0, max: 1, step: 0.01 }, { key: 'roughness', min: 0, max: 1, step: 0.01 },
|
|
30
|
+
{ key: 'autoplay', min: 0, max: 20, step: 0.5 },
|
|
31
|
+
{ key: 'pointerMode', options: ['none', ...POINTER_MODES] }, { key: 'pointerStrength', min: 0, max: 3, step: 0.01 }, { key: 'pointerRadius', min: 0.2, max: 6, step: 0.01 },
|
|
32
|
+
{ key: 'intensity', min: 0, max: 3, step: 0.01 }, { key: 'opacity', min: 0, max: 1, step: 0.01 },
|
|
33
|
+
];
|
|
34
|
+
export const PRESETS = [
|
|
35
|
+
{ name: 'Halo', description: 'The default.', patch: {} },
|
|
36
|
+
{ name: 'Edge-on', description: 'A flat ring seen from its rim.', patch: { shape: 0.3, stepOut: 0.9 } },
|
|
37
|
+
{ name: 'Crown', description: 'A steep, wide ring.', patch: { shape: 4, spacing: 1.25 } },
|
|
38
|
+
];
|
|
39
|
+
export function createUniforms() { return { uTex: { value: null } }; }
|
|
40
|
+
export function applyConfig() { }
|
|
41
|
+
/** A standard (scene-lit) material whose colour can drain to grey: uSat 1 = the picture, 0 = its luminance. */
|
|
42
|
+
function printMaterial() {
|
|
43
|
+
const m = new THREE.MeshStandardMaterial({ color: '#ffffff', roughness: 0.6, metalness: 0, side: THREE.DoubleSide, transparent: true });
|
|
44
|
+
m.userData.uSat = { value: 1 };
|
|
45
|
+
m.onBeforeCompile = (sh) => {
|
|
46
|
+
sh.uniforms.uSat = m.userData.uSat;
|
|
47
|
+
sh.fragmentShader = sh.fragmentShader.replace('#include <common>', '#include <common>\nuniform float uSat;')
|
|
48
|
+
.replace('#include <map_fragment>', '#include <map_fragment>\n diffuseColor.rgb = mix(vec3(dot(diffuseColor.rgb, vec3(0.299, 0.587, 0.114))), diffuseColor.rgb, uSat);');
|
|
49
|
+
};
|
|
50
|
+
return m;
|
|
51
|
+
}
|
|
52
|
+
export function build(u, c) { return withLean(buildGallery(u, c), c); }
|
|
53
|
+
function buildGallery(u, c) {
|
|
54
|
+
const MAX = 32, W = c.width, H = W / c.aspect;
|
|
55
|
+
const object = new THREE.Group();
|
|
56
|
+
const ring = new THREE.Group();
|
|
57
|
+
object.add(ring);
|
|
58
|
+
const geo = new THREE.PlaneGeometry(W, H);
|
|
59
|
+
const items = [];
|
|
60
|
+
for (let i = 0; i < MAX; i++) {
|
|
61
|
+
const mat = printMaterial();
|
|
62
|
+
const m = new THREE.Mesh(geo, mat);
|
|
63
|
+
m.castShadow = true;
|
|
64
|
+
m.receiveShadow = true;
|
|
65
|
+
m.visible = false;
|
|
66
|
+
m.matrixAutoUpdate = false;
|
|
67
|
+
ring.add(m);
|
|
68
|
+
items.push({ mesh: m, mat, act: 0 });
|
|
69
|
+
}
|
|
70
|
+
const pick = new THREE.Mesh(new THREE.PlaneGeometry(W * 1.3, H * 1.3), new THREE.MeshBasicMaterial({ visible: false }));
|
|
71
|
+
object.add(pick);
|
|
72
|
+
const cfg = { ...c };
|
|
73
|
+
const scroll = createScroll(cfg, () => { });
|
|
74
|
+
scroll.st.pitch = W * c.spacing;
|
|
75
|
+
const layout = createLayout(W, H), _t = new THREE.Matrix4();
|
|
76
|
+
const st = { time: 0, tex: [], lean: 0 };
|
|
77
|
+
const controls = Object.assign(scroll.controls, {
|
|
78
|
+
setTexture(tex, count) {
|
|
79
|
+
for (const t of st.tex)
|
|
80
|
+
t.dispose();
|
|
81
|
+
scroll.st.count = Math.min(count, MAX);
|
|
82
|
+
[st.tex] = sliceTextures(tex, scroll.st.count);
|
|
83
|
+
tex.dispose();
|
|
84
|
+
st.tex.forEach((t, i) => { items[i].mat.map = t; items[i].mat.needsUpdate = true; });
|
|
85
|
+
items.forEach((it, i) => { it.act = i === controls.index ? 1 : 0; });
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
object.userData.gallery = controls;
|
|
89
|
+
return {
|
|
90
|
+
object, controls, pickMesh: pick, materials: items.map(i => i.mat),
|
|
91
|
+
apply(k) { Object.assign(cfg, k); for (const it of items)
|
|
92
|
+
it.mat.roughness = cfg.roughness; },
|
|
93
|
+
update(dt, pointer) {
|
|
94
|
+
dt = Math.min(dt, 0.05);
|
|
95
|
+
st.time += dt;
|
|
96
|
+
scroll.step(dt, pointer);
|
|
97
|
+
const n = scroll.st.count, s0 = scroll.st.s;
|
|
98
|
+
for (let i = 0; i < n; i++) {
|
|
99
|
+
const it = items[i];
|
|
100
|
+
const { focus, fade } = layout.place(i, s0, n, cfg, it.mesh.matrix);
|
|
101
|
+
it.mesh.visible = fade > 0.002;
|
|
102
|
+
it.act = approach(it.act, focus > 0.5 ? 1 : 0, dt, cfg.changeTime);
|
|
103
|
+
const e = it.act * it.act * (3 - 2 * it.act);
|
|
104
|
+
// steps out of its place toward the viewer (along its own normal) and grows as it becomes the active one
|
|
105
|
+
it.mesh.matrix.multiply(_t.makeTranslation(0, 0, cfg.stepOut * e)).multiply(_t.makeScale(1 + (cfg.focusScale - 1) * e, 1 + (cfg.focusScale - 1) * e, 1));
|
|
106
|
+
it.mesh.matrixWorldNeedsUpdate = true;
|
|
107
|
+
it.mat.userData.uSat.value = e;
|
|
108
|
+
it.mat.color.setScalar((cfg.dim + (1 - cfg.dim) * e) * cfg.intensity);
|
|
109
|
+
it.mat.opacity = cfg.opacity * fade;
|
|
110
|
+
}
|
|
111
|
+
for (let i = n; i < MAX; i++)
|
|
112
|
+
items[i].mesh.visible = false;
|
|
113
|
+
pick.position.set(0, 0, cfg.stepOut);
|
|
114
|
+
},
|
|
115
|
+
dispose() { geo.dispose(); for (const it of items)
|
|
116
|
+
it.mat.dispose(); for (const t of st.tex)
|
|
117
|
+
t.dispose(); pick.geometry.dispose(); },
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const catalog: {
|
|
3
|
+
key: string;
|
|
4
|
+
name: string;
|
|
5
|
+
camera: {
|
|
6
|
+
position: number[];
|
|
7
|
+
target: number[];
|
|
8
|
+
};
|
|
9
|
+
description: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULTS: {
|
|
13
|
+
type: string;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
lean: number;
|
|
16
|
+
imageUrls: any[];
|
|
17
|
+
autoplay: number;
|
|
18
|
+
intensity: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
aspect: number;
|
|
21
|
+
threads: number;
|
|
22
|
+
width: number;
|
|
23
|
+
layout: string;
|
|
24
|
+
spacing: number;
|
|
25
|
+
depth: number;
|
|
26
|
+
visible: number;
|
|
27
|
+
shape: number;
|
|
28
|
+
dim: number;
|
|
29
|
+
stiffness: number;
|
|
30
|
+
damping: number;
|
|
31
|
+
throwing: number;
|
|
32
|
+
restring: number;
|
|
33
|
+
sweep: number;
|
|
34
|
+
headGlow: number;
|
|
35
|
+
beads: number;
|
|
36
|
+
rail: boolean;
|
|
37
|
+
threadColor: string;
|
|
38
|
+
railColor: string;
|
|
39
|
+
pointerMode: string;
|
|
40
|
+
pointerStrength: number;
|
|
41
|
+
pointerRadius: number;
|
|
42
|
+
pointerColor: string;
|
|
43
|
+
};
|
|
44
|
+
export declare const STRUCTURAL: string[];
|
|
45
|
+
export declare const POINTER_MODES: string[];
|
|
46
|
+
export declare const GUI: ({
|
|
47
|
+
key: string;
|
|
48
|
+
options: string[];
|
|
49
|
+
tip: string;
|
|
50
|
+
min?: undefined;
|
|
51
|
+
max?: undefined;
|
|
52
|
+
step?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
key: string;
|
|
55
|
+
min: number;
|
|
56
|
+
max: number;
|
|
57
|
+
step: number;
|
|
58
|
+
tip: string;
|
|
59
|
+
options?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
key: string;
|
|
62
|
+
min: number;
|
|
63
|
+
max: number;
|
|
64
|
+
step: number;
|
|
65
|
+
options?: undefined;
|
|
66
|
+
color?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
key: string;
|
|
69
|
+
min?: undefined;
|
|
70
|
+
max?: undefined;
|
|
71
|
+
step?: undefined;
|
|
72
|
+
options?: undefined;
|
|
73
|
+
color?: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
key: string;
|
|
76
|
+
options: string[];
|
|
77
|
+
min?: undefined;
|
|
78
|
+
max?: undefined;
|
|
79
|
+
step?: undefined;
|
|
80
|
+
color?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
key: string;
|
|
83
|
+
color: boolean;
|
|
84
|
+
min?: undefined;
|
|
85
|
+
max?: undefined;
|
|
86
|
+
step?: undefined;
|
|
87
|
+
options?: undefined;
|
|
88
|
+
})[];
|
|
89
|
+
export declare const PRESETS: ({
|
|
90
|
+
name: string;
|
|
91
|
+
description: string;
|
|
92
|
+
patch: {
|
|
93
|
+
threads?: undefined;
|
|
94
|
+
beads?: undefined;
|
|
95
|
+
restring?: undefined;
|
|
96
|
+
headGlow?: undefined;
|
|
97
|
+
};
|
|
98
|
+
} | {
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
patch: {
|
|
102
|
+
threads: number;
|
|
103
|
+
beads: number;
|
|
104
|
+
restring?: undefined;
|
|
105
|
+
headGlow?: undefined;
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
patch: {
|
|
111
|
+
threads: number;
|
|
112
|
+
restring: number;
|
|
113
|
+
headGlow: number;
|
|
114
|
+
beads?: undefined;
|
|
115
|
+
};
|
|
116
|
+
})[];
|
|
117
|
+
export declare function createUniforms(): {
|
|
118
|
+
uTex: {
|
|
119
|
+
value: any;
|
|
120
|
+
};
|
|
121
|
+
uS: {
|
|
122
|
+
value: number;
|
|
123
|
+
};
|
|
124
|
+
uCount: {
|
|
125
|
+
value: number;
|
|
126
|
+
};
|
|
127
|
+
uTime: {
|
|
128
|
+
value: number;
|
|
129
|
+
};
|
|
130
|
+
uReveal: {
|
|
131
|
+
value: Float32Array<ArrayBuffer>;
|
|
132
|
+
};
|
|
133
|
+
uSpacing: {
|
|
134
|
+
value: number;
|
|
135
|
+
};
|
|
136
|
+
uDepth: {
|
|
137
|
+
value: number;
|
|
138
|
+
};
|
|
139
|
+
uScatter: {
|
|
140
|
+
value: number;
|
|
141
|
+
};
|
|
142
|
+
uVisible: {
|
|
143
|
+
value: number;
|
|
144
|
+
};
|
|
145
|
+
uDim: {
|
|
146
|
+
value: number;
|
|
147
|
+
};
|
|
148
|
+
uHead: {
|
|
149
|
+
value: number;
|
|
150
|
+
};
|
|
151
|
+
uBeads: {
|
|
152
|
+
value: number;
|
|
153
|
+
};
|
|
154
|
+
uSway: {
|
|
155
|
+
value: number;
|
|
156
|
+
};
|
|
157
|
+
uIntensity: {
|
|
158
|
+
value: number;
|
|
159
|
+
};
|
|
160
|
+
uOpacity: {
|
|
161
|
+
value: number;
|
|
162
|
+
};
|
|
163
|
+
uThreadColor: {
|
|
164
|
+
value: THREE.Color;
|
|
165
|
+
};
|
|
166
|
+
uPointerColor: {
|
|
167
|
+
value: THREE.Color;
|
|
168
|
+
};
|
|
169
|
+
uPointer: {
|
|
170
|
+
value: THREE.Vector3;
|
|
171
|
+
};
|
|
172
|
+
uPointerActive: {
|
|
173
|
+
value: number;
|
|
174
|
+
};
|
|
175
|
+
uPointerMode: {
|
|
176
|
+
value: number;
|
|
177
|
+
};
|
|
178
|
+
uPointerStrength: {
|
|
179
|
+
value: number;
|
|
180
|
+
};
|
|
181
|
+
uPointerRadius: {
|
|
182
|
+
value: number;
|
|
183
|
+
};
|
|
184
|
+
uW: {
|
|
185
|
+
value: number;
|
|
186
|
+
};
|
|
187
|
+
uH: {
|
|
188
|
+
value: number;
|
|
189
|
+
};
|
|
190
|
+
uN: {
|
|
191
|
+
value: number;
|
|
192
|
+
};
|
|
193
|
+
uPlace: {
|
|
194
|
+
value: THREE.Matrix4[];
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
export declare function applyConfig(u: any, c: any): void;
|
|
198
|
+
export declare function build(u: any, c: any): any;
|
|
199
|
+
//# sourceMappingURL=lightThreads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightThreads.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/looks/lightThreads.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,OAAO;;;;;;;;;CAE+E,CAAC;AAEpG,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASpB,CAAC;AACF,eAAO,MAAM,UAAU,UAA8C,CAAC;AACtE,eAAO,MAAM,aAAa,UAAa,CAAC;AACxC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUf,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;IAInB,CAAC;AAGF,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B;AACD,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,QAM/B;AAqED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,OAA6C"}
|