@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,123 @@
|
|
|
1
|
+
// GENERATED from the lab (Claude outputs/gallery-lab/image/contour.mjs) by emit_image.mjs — change the lab and re-emit.
|
|
2
|
+
// contour — an image variant (type 'image', config.type 'contour'). Material: own ShaderMaterial, self-coloured (no
|
|
3
|
+
// scene lighting; object effects do not attach).
|
|
4
|
+
//
|
|
5
|
+
// The picture as a topographic map of itself. Its luminance (a soft mip) is a height field; the change interpolates
|
|
6
|
+
// the two fields, Φ = mix(L_A, L_B, s), and draws Φ's level sets — so mid-change the contour lines of the old
|
|
7
|
+
// picture flow continuously into the contour lines of the new one (level sets of a continuous blend move, they
|
|
8
|
+
// never jump). Under the travelling front the picture darkens away and its contours lift off into depth: the
|
|
9
|
+
// lines are split into K bands by level and each band is drawn on its own sheet, offset in z by its level, so the
|
|
10
|
+
// change is a floating, slowly re-forming contour stack you can see around when the camera moves. Lines are
|
|
11
|
+
// hairline, anti-aliased with fwidth, coloured by the picture under them. Idle: the faintest contours remain and
|
|
12
|
+
// drift a fraction of a level over a long cycle. Cursor: `open` — the picture opens into its contour stack around
|
|
13
|
+
// the cursor; `ripple` — the levels near the cursor bend in a slow ring.
|
|
14
|
+
import * as THREE from 'three';
|
|
15
|
+
import { baseUniforms, applyBase, setU, createPicture, stepPointer, GLSL_COMMON, fragHead } from './imageCore.js';
|
|
16
|
+
export const POINTER_MODES = ['open', 'ripple'];
|
|
17
|
+
const K = 6;
|
|
18
|
+
export const STRUCTURAL = ['imageUrls'];
|
|
19
|
+
export function createUniforms() {
|
|
20
|
+
return { ...baseUniforms(), uLevels: { value: 26 }, uLineW: { value: 0.9 }, uDepth: { value: 1 }, uOpen: { value: 0.95 }, uSmooth: { value: 3.2 }, uIdle: { value: 0.04 }, uTint: { value: 0.35 }, uLineColor: { value: new THREE.Color('#cfe6ff') } };
|
|
21
|
+
}
|
|
22
|
+
export function applyConfig(u, c) {
|
|
23
|
+
applyBase(u, c, POINTER_MODES);
|
|
24
|
+
setU(u, 'uLevels', c.levels);
|
|
25
|
+
setU(u, 'uLineW', c.lineWidth);
|
|
26
|
+
setU(u, 'uDepth', c.depth);
|
|
27
|
+
setU(u, 'uOpen', c.open);
|
|
28
|
+
setU(u, 'uSmooth', c.smoothing);
|
|
29
|
+
setU(u, 'uIdle', c.idleLines);
|
|
30
|
+
setU(u, 'uTint', c.tint);
|
|
31
|
+
setU(u, 'uLineColor', c.lineColor);
|
|
32
|
+
}
|
|
33
|
+
const pars = /* glsl */ `
|
|
34
|
+
uniform float uLevels, uLineW, uDepth, uOpen, uSmooth, uIdle, uTint, uBand; uniform vec3 uLineColor;
|
|
35
|
+
varying vec2 vPic; varying float vL;
|
|
36
|
+
// how open the picture is at uv: the front, plus the cursor in 'open' mode
|
|
37
|
+
float openAt(vec2 uv, float l){
|
|
38
|
+
float o = pow(sin(PI * l), 0.8);
|
|
39
|
+
if (uPointerMode > -0.5 && uPointerMode < 0.5) o = max(o, smoothstep(0.0, 0.8, pointerBump((uv - 0.5) * uSize)));
|
|
40
|
+
return o;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const vert = /* glsl */ `
|
|
44
|
+
${GLSL_COMMON}
|
|
45
|
+
${pars}
|
|
46
|
+
void main(){
|
|
47
|
+
vec2 uv = position.xy + 0.5;
|
|
48
|
+
float l = localP(uv);
|
|
49
|
+
float z = (uBand < -0.5) ? 0.0 : ((uBand + 0.5) / ${K}.0) * uDepth * 0.4 * openAt(uv, l) + 0.002 * (uBand + 1.0);
|
|
50
|
+
vPic = uv; vL = l;
|
|
51
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position.xy * uSize, z, 1.0);
|
|
52
|
+
}`;
|
|
53
|
+
const baseFrag = /* glsl */ `
|
|
54
|
+
${fragHead}
|
|
55
|
+
${GLSL_COMMON}
|
|
56
|
+
${pars}
|
|
57
|
+
void main(){
|
|
58
|
+
float l = localP(vPic); float s = sstep(l);
|
|
59
|
+
vec3 c = mix(picA(vPic), picB(vPic), s);
|
|
60
|
+
float o = openAt(vPic, l);
|
|
61
|
+
c *= 1.0 - uOpen * 0.9 * o;
|
|
62
|
+
gl_FragColor = vec4(c * uIntensity, uOpacity);
|
|
63
|
+
#include <tonemapping_fragment>
|
|
64
|
+
#include <colorspace_fragment>
|
|
65
|
+
}`;
|
|
66
|
+
const lineFrag = /* glsl */ `
|
|
67
|
+
${fragHead}
|
|
68
|
+
${GLSL_COMMON}
|
|
69
|
+
${pars}
|
|
70
|
+
void main(){
|
|
71
|
+
float l = localP(vPic); float s = sstep(l);
|
|
72
|
+
float lod = uSmooth;
|
|
73
|
+
float LA = luma(picAL(vPic, lod)), LB = luma(picBL(vPic, lod));
|
|
74
|
+
float phi = mix(LA, LB, s);
|
|
75
|
+
float v = phi * uLevels + uBreathe * 0.25 * sin(uTime * 0.12); // the idle drift: a fraction of a level
|
|
76
|
+
if (uPointerMode > 0.5) { vec2 q = (vPic - 0.5) * uSize; float d = length(q - uPointer.xy); v += 0.7 * pointerBump(q) * sin(d * 22.0 - uTime * 2.0); }
|
|
77
|
+
float lev = floor(v + 0.5);
|
|
78
|
+
float band = floor(clamp(lev / uLevels, 0.0, 0.9999) * ${K}.0);
|
|
79
|
+
if (abs(band - uBand) > 0.5) discard;
|
|
80
|
+
float fw = max(fwidth(v), 1e-4);
|
|
81
|
+
float dpx = abs(v - lev) / fw;
|
|
82
|
+
float line = 1.0 - smoothstep(0.5 * uLineW - 0.5, 0.5 * uLineW + 0.5, dpx);
|
|
83
|
+
float o = openAt(vPic, l);
|
|
84
|
+
float vis = max(uIdle, o);
|
|
85
|
+
vec3 pc = mix(picAL(vPic, 1.0), picBL(vPic, 1.0), s);
|
|
86
|
+
pc = pc / max(luma(pc), 0.08) * 0.55; // keep the hue, even out the brightness
|
|
87
|
+
vec3 col = mix(pc, uLineColor, uTint) * (0.75 + 0.5 * o);
|
|
88
|
+
float a = line * vis * uOpacity;
|
|
89
|
+
if (a < 0.003) discard;
|
|
90
|
+
gl_FragColor = vec4(col * uIntensity * a, a);
|
|
91
|
+
#include <tonemapping_fragment>
|
|
92
|
+
#include <colorspace_fragment>
|
|
93
|
+
}`;
|
|
94
|
+
export function build(u, c) {
|
|
95
|
+
const object = new THREE.Group();
|
|
96
|
+
const geo = new THREE.PlaneGeometry(1, 1, 96, 60);
|
|
97
|
+
const baseMat = new THREE.ShaderMaterial({ uniforms: { ...u, uBand: { value: -1 } }, vertexShader: vert, fragmentShader: baseFrag, glslVersion: THREE.GLSL3, transparent: false });
|
|
98
|
+
const base = new THREE.Mesh(geo, baseMat);
|
|
99
|
+
base.frustumCulled = false;
|
|
100
|
+
object.add(base);
|
|
101
|
+
const mats = [baseMat];
|
|
102
|
+
for (let k = 0; k < K; k++) {
|
|
103
|
+
const m = new THREE.ShaderMaterial({ uniforms: { ...u, uBand: { value: k } }, vertexShader: vert, fragmentShader: lineFrag, glslVersion: THREE.GLSL3, transparent: true, depthWrite: false, premultipliedAlpha: true, side: THREE.DoubleSide });
|
|
104
|
+
const mesh = new THREE.Mesh(geo, m);
|
|
105
|
+
mesh.frustumCulled = false;
|
|
106
|
+
mesh.renderOrder = 3 + k;
|
|
107
|
+
object.add(mesh);
|
|
108
|
+
mats.push(m);
|
|
109
|
+
}
|
|
110
|
+
const cfg = { ...c };
|
|
111
|
+
const pic = createPicture(u, cfg);
|
|
112
|
+
const pst = {};
|
|
113
|
+
const api = {
|
|
114
|
+
object, materials: mats,
|
|
115
|
+
controls: { show: (t) => pic.show(t), get busy() { return pic.busy; }, pic },
|
|
116
|
+
apply(k) { Object.assign(cfg, k); applyConfig(u, k); if (k.opacity !== undefined)
|
|
117
|
+
baseMat.transparent = k.opacity < 1; },
|
|
118
|
+
update(dt, pointer) { dt = Math.min(dt, 0.1); u.uTime.value += dt; pic.step(dt); stepPointer(u, pointer, dt, pst); },
|
|
119
|
+
dispose() { geo.dispose(); for (const m of mats)
|
|
120
|
+
m.dispose(); pic.dispose(); },
|
|
121
|
+
};
|
|
122
|
+
return api;
|
|
123
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const POINTER_MODES: string[];
|
|
3
|
+
export declare const STRUCTURAL: string[];
|
|
4
|
+
export declare function createUniforms(): {
|
|
5
|
+
uGrid: {
|
|
6
|
+
value: THREE.Vector2;
|
|
7
|
+
};
|
|
8
|
+
uHatch: {
|
|
9
|
+
value: number;
|
|
10
|
+
};
|
|
11
|
+
uLen: {
|
|
12
|
+
value: number;
|
|
13
|
+
};
|
|
14
|
+
uWeight: {
|
|
15
|
+
value: number;
|
|
16
|
+
};
|
|
17
|
+
uRelief: {
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
uLift: {
|
|
21
|
+
value: number;
|
|
22
|
+
};
|
|
23
|
+
uFlow: {
|
|
24
|
+
value: number;
|
|
25
|
+
};
|
|
26
|
+
uFill: {
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
uTint: {
|
|
30
|
+
value: number;
|
|
31
|
+
};
|
|
32
|
+
uInk: {
|
|
33
|
+
value: THREE.Color;
|
|
34
|
+
};
|
|
35
|
+
uPlate: {
|
|
36
|
+
value: THREE.Color;
|
|
37
|
+
};
|
|
38
|
+
uTexA: {
|
|
39
|
+
value: any;
|
|
40
|
+
};
|
|
41
|
+
uTexB: {
|
|
42
|
+
value: any;
|
|
43
|
+
};
|
|
44
|
+
uFitA: {
|
|
45
|
+
value: THREE.Vector2;
|
|
46
|
+
};
|
|
47
|
+
uFitB: {
|
|
48
|
+
value: THREE.Vector2;
|
|
49
|
+
};
|
|
50
|
+
uP: {
|
|
51
|
+
value: number;
|
|
52
|
+
};
|
|
53
|
+
uHasA: {
|
|
54
|
+
value: number;
|
|
55
|
+
};
|
|
56
|
+
uSeq: {
|
|
57
|
+
value: number;
|
|
58
|
+
};
|
|
59
|
+
uSize: {
|
|
60
|
+
value: THREE.Vector2;
|
|
61
|
+
};
|
|
62
|
+
uTime: {
|
|
63
|
+
value: number;
|
|
64
|
+
};
|
|
65
|
+
uDir: {
|
|
66
|
+
value: THREE.Vector2;
|
|
67
|
+
};
|
|
68
|
+
uSpread: {
|
|
69
|
+
value: number;
|
|
70
|
+
};
|
|
71
|
+
uBlank: {
|
|
72
|
+
value: THREE.Color;
|
|
73
|
+
};
|
|
74
|
+
uIntensity: {
|
|
75
|
+
value: number;
|
|
76
|
+
};
|
|
77
|
+
uOpacity: {
|
|
78
|
+
value: number;
|
|
79
|
+
};
|
|
80
|
+
uBreathe: {
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
uPointer: {
|
|
84
|
+
value: THREE.Vector3;
|
|
85
|
+
};
|
|
86
|
+
uPointerVel: {
|
|
87
|
+
value: THREE.Vector2;
|
|
88
|
+
};
|
|
89
|
+
uPointerActive: {
|
|
90
|
+
value: number;
|
|
91
|
+
};
|
|
92
|
+
uPointerMode: {
|
|
93
|
+
value: number;
|
|
94
|
+
};
|
|
95
|
+
uPointerStrength: {
|
|
96
|
+
value: number;
|
|
97
|
+
};
|
|
98
|
+
uPointerRadius: {
|
|
99
|
+
value: number;
|
|
100
|
+
};
|
|
101
|
+
uPointerColor: {
|
|
102
|
+
value: THREE.Color;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export declare function applyConfig(u: any, c: any): void;
|
|
106
|
+
export declare function build(u: any, c: any): {
|
|
107
|
+
object: THREE.Group<THREE.Object3DEventMap>;
|
|
108
|
+
materials: THREE.ShaderMaterial[];
|
|
109
|
+
controls: {
|
|
110
|
+
show: (t: any) => void;
|
|
111
|
+
readonly busy: boolean;
|
|
112
|
+
pic: {
|
|
113
|
+
st: {
|
|
114
|
+
A: any;
|
|
115
|
+
B: any;
|
|
116
|
+
aspA: number;
|
|
117
|
+
aspB: number;
|
|
118
|
+
p: number;
|
|
119
|
+
dir: number;
|
|
120
|
+
pending: any;
|
|
121
|
+
seq: number;
|
|
122
|
+
frame: number;
|
|
123
|
+
};
|
|
124
|
+
show: (tex: any) => void;
|
|
125
|
+
jump: (tex: any) => void;
|
|
126
|
+
step: (dt: any) => void;
|
|
127
|
+
readonly busy: boolean;
|
|
128
|
+
dispose(): void;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
apply(k: any): void;
|
|
132
|
+
update(dt: any, pointer: any): void;
|
|
133
|
+
dispose(): void;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=engraving.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engraving.d.ts","sourceRoot":"","sources":["../../../../src/components/image/core/engraving.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,aAAa,UAAoB,CAAC;AAC/C,eAAO,MAAM,UAAU,UAAwB,CAAC;AAEhD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7B;AACD,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,QAG/B;AA0FD,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BzB"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// GENERATED from the lab (Claude outputs/gallery-lab/image/engraving.mjs) by emit_image.mjs — change the lab and re-emit.
|
|
2
|
+
// engraving — an image variant (type 'image', config.type 'engraving'). Material: own ShaderMaterial, self-coloured
|
|
3
|
+
// (no scene lighting; object effects do not attach).
|
|
4
|
+
//
|
|
5
|
+
// The picture drawn as an engraving in ink on paper: a field of fine strokes, one per cell, each laid along the picture's
|
|
6
|
+
// isophote (perpendicular to the luminance gradient of a soft mip, so strokes follow forms the way a burin does),
|
|
7
|
+
// as wide as the picture is dark there and inked in its hue; strokes stand at a depth set by brightness, so
|
|
8
|
+
// the plate has a fine relief that parallaxes when the camera moves. Where the gradient is too weak to give a
|
|
9
|
+
// direction, strokes fall back to a slow, smooth flow field (never random). A change re-lays every stroke: as the
|
|
10
|
+
// front passes, a stroke shortens a little, lifts off the plate, turns the shortest way (lines are π-periodic) to
|
|
11
|
+
// its new isophote, takes on its new width and colour and settles — the whole plate re-aligns like filings in a
|
|
12
|
+
// moving field. The first picture is drawn in from an empty plate. Idle: strokes sway a degree or two in a slow
|
|
13
|
+
// flow. One instanced draw (+ a faint backing plate). Cursor: `comb` — strokes near the cursor align with its
|
|
14
|
+
// motion; `swirl` — they wind around it.
|
|
15
|
+
import * as THREE from 'three';
|
|
16
|
+
import { baseUniforms, applyBase, setU, createPicture, stepPointer, GLSL_COMMON, fragHead, mulberry32 } from './imageCore.js';
|
|
17
|
+
export const POINTER_MODES = ['comb', 'swirl'];
|
|
18
|
+
export const STRUCTURAL = ['imageUrls', 'cols'];
|
|
19
|
+
export function createUniforms() {
|
|
20
|
+
return { ...baseUniforms(), uGrid: { value: new THREE.Vector2(160, 104) }, uHatch: { value: 0.61 }, uLen: { value: 2.3 }, uWeight: { value: 0.85 }, uRelief: { value: 1 }, uLift: { value: 1 }, uFlow: { value: 3.2 }, uFill: { value: 0.12 }, uTint: { value: 0.6 }, uInk: { value: new THREE.Color('#1a1c22') }, uPlate: { value: new THREE.Color('#ece6d9') } };
|
|
21
|
+
}
|
|
22
|
+
export function applyConfig(u, c) {
|
|
23
|
+
applyBase(u, c, POINTER_MODES);
|
|
24
|
+
setU(u, 'uLen', c.length);
|
|
25
|
+
if (c.hatch !== undefined)
|
|
26
|
+
u.uHatch.value = c.hatch * Math.PI / 180;
|
|
27
|
+
setU(u, 'uWeight', c.weight);
|
|
28
|
+
setU(u, 'uRelief', c.relief);
|
|
29
|
+
setU(u, 'uLift', c.lift);
|
|
30
|
+
setU(u, 'uFlow', c.flow);
|
|
31
|
+
setU(u, 'uFill', c.fill);
|
|
32
|
+
setU(u, 'uPlate', c.plateColor);
|
|
33
|
+
setU(u, 'uInk', c.inkColor);
|
|
34
|
+
setU(u, 'uTint', c.tint);
|
|
35
|
+
}
|
|
36
|
+
const pars = /* glsl */ `
|
|
37
|
+
uniform vec2 uGrid; uniform vec3 uInk; uniform float uTint, uHatch, uLen, uWeight, uRelief, uLift, uFlow, uFill; uniform vec3 uPlate;
|
|
38
|
+
`;
|
|
39
|
+
const strokeVert = /* glsl */ `
|
|
40
|
+
${GLSL_COMMON}
|
|
41
|
+
${pars}
|
|
42
|
+
attribute vec3 aCell; // uv of the stroke, random
|
|
43
|
+
varying vec2 vQ; varying vec3 vCol; varying float vA;
|
|
44
|
+
// isophote angle of a picture at uv (and the gradient strength, for the fallback blend)
|
|
45
|
+
vec2 iso(sampler2D t, vec2 fitS, vec2 uv, float has){
|
|
46
|
+
vec2 e = vec2(1.5 / uGrid.x, 1.5 / uGrid.y);
|
|
47
|
+
vec2 a = 0.5 + (uv - 0.5) * fitS;
|
|
48
|
+
float lx = luma(textureLod(t, a + vec2(e.x, 0.0) * fitS, uFlow).rgb) - luma(textureLod(t, a - vec2(e.x, 0.0) * fitS, uFlow).rgb);
|
|
49
|
+
float ly = luma(textureLod(t, a + vec2(0.0, e.y) * fitS, uFlow).rgb) - luma(textureLod(t, a - vec2(0.0, e.y) * fitS, uFlow).rgb);
|
|
50
|
+
vec2 g = vec2(lx / uSize.x, ly / uSize.y) * has;
|
|
51
|
+
float flowA = uHatch + 0.5 * (vnoise(uv * 1.6 + 3.0) - 0.5); // the calm fallback: the plate's hatch direction, gently bent
|
|
52
|
+
float m = smoothstep(0.02, 0.09, length(g)) * 0.85;
|
|
53
|
+
float th = atan(g.y, g.x) + 1.5707963;
|
|
54
|
+
// blend angles on the doubled circle (lines are pi-periodic)
|
|
55
|
+
vec2 d = mix(vec2(cos(2.0 * flowA), sin(2.0 * flowA)), vec2(cos(2.0 * th), sin(2.0 * th)), m);
|
|
56
|
+
return vec2(0.5 * atan(d.y, d.x), m);
|
|
57
|
+
}
|
|
58
|
+
void main(){
|
|
59
|
+
vec2 c = aCell.xy;
|
|
60
|
+
float l = localP(c); float s = sstep(l); float fly = sin(PI * l);
|
|
61
|
+
vec3 ca = picAL(c, 1.5), cb = picBL(c, 1.5);
|
|
62
|
+
float La = luma(ca) * uHasA, Lb = luma(cb);
|
|
63
|
+
float ta = iso(uTexA, uFitA, c, uHasA).x, tb = iso(uTexB, uFitB, c, 1.0).x;
|
|
64
|
+
float dth = mod(tb - ta + 1.5707963, 3.14159265) - 1.5707963; // the shortest way round
|
|
65
|
+
float th = ta + dth * s;
|
|
66
|
+
th += uBreathe * 0.03 * sin(uTime * 0.3 + c.x * 5.0 + c.y * 3.0);
|
|
67
|
+
vec2 xy = (c - 0.5) * uSize;
|
|
68
|
+
float pb = pointerBump(xy);
|
|
69
|
+
if (pb > 0.0) {
|
|
70
|
+
float tp = th;
|
|
71
|
+
if (uPointerMode < 0.5) { vec2 v = uPointerVel; tp = atan(v.y, v.x); pb *= smoothstep(0.05, 0.6, length(v)); }
|
|
72
|
+
else { vec2 d = xy - uPointer.xy; tp = atan(d.y, d.x) + 1.5707963; }
|
|
73
|
+
float dd = mod(tp - th + 1.5707963, 3.14159265) - 1.5707963;
|
|
74
|
+
th += dd * min(1.0, pb);
|
|
75
|
+
}
|
|
76
|
+
float L = mix(La, Lb, s);
|
|
77
|
+
vec2 pitch = uSize / uGrid;
|
|
78
|
+
float cell = min(pitch.x, pitch.y);
|
|
79
|
+
float len = cell * uLen * (1.0 - 0.35 * fly);
|
|
80
|
+
float w = cell * uWeight * (0.1 + 0.9 * (1.0 - L)); // ink: dense where the picture is dark
|
|
81
|
+
vec2 dir = vec2(cos(th), sin(th)), nrm = vec2(-dir.y, dir.x);
|
|
82
|
+
vec2 p = xy + dir * position.x * len + nrm * position.y * w;
|
|
83
|
+
float z = 0.004 + L * uRelief * 0.03 + fly * uLift * 0.06 * (0.6 + 0.8 * aCell.z);
|
|
84
|
+
vQ = position.xy * 2.0;
|
|
85
|
+
vec3 col = mix(ca, cb, s);
|
|
86
|
+
vec3 hue = col / max(luma(col), 0.05);
|
|
87
|
+
vCol = mix(uInk, hue * 0.4, uTint) * (0.2 + 0.5 * L);
|
|
88
|
+
vA = smoothstep(0.0, 0.06, w / cell) * (uHasA > 0.5 ? 1.0 : smoothstep(0.0, 0.6, l));
|
|
89
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(p, z, 1.0);
|
|
90
|
+
}`;
|
|
91
|
+
const strokeFrag = /* glsl */ `
|
|
92
|
+
${fragHead}
|
|
93
|
+
${pars}
|
|
94
|
+
uniform float uIntensity, uOpacity;
|
|
95
|
+
varying vec2 vQ; varying vec3 vCol; varying float vA;
|
|
96
|
+
void main(){
|
|
97
|
+
float fy = max(fwidth(vQ.y), 1e-4);
|
|
98
|
+
float across = 1.0 - smoothstep(1.0 - 1.5 * fy, 1.0, abs(vQ.y));
|
|
99
|
+
float ends = 1.0 - smoothstep(0.55, 1.0, abs(vQ.x)); // tapered ends, like a burin's cut
|
|
100
|
+
float a = across * ends * vA * uOpacity;
|
|
101
|
+
if (a < 0.004) discard;
|
|
102
|
+
gl_FragColor = vec4(vCol * uIntensity * a, a);
|
|
103
|
+
#include <tonemapping_fragment>
|
|
104
|
+
#include <colorspace_fragment>
|
|
105
|
+
}`;
|
|
106
|
+
const plateVert = /* glsl */ `
|
|
107
|
+
${GLSL_COMMON}
|
|
108
|
+
varying vec2 vPic;
|
|
109
|
+
void main(){ vPic = position.xy + 0.5; gl_Position = projectionMatrix * modelViewMatrix * vec4(position.xy * uSize, -0.01, 1.0); }`;
|
|
110
|
+
const plateFrag = /* glsl */ `
|
|
111
|
+
${fragHead}
|
|
112
|
+
${GLSL_COMMON}
|
|
113
|
+
${pars}
|
|
114
|
+
varying vec2 vPic;
|
|
115
|
+
void main(){
|
|
116
|
+
float s = sstep(localP(vPic));
|
|
117
|
+
vec3 c = mix(picAL(vPic, 2.0), picBL(vPic, 2.0), s);
|
|
118
|
+
vec3 wash = clamp(c / max(luma(c), 0.08), 0.0, 1.3); // the picture's hue as a light wash on the paper
|
|
119
|
+
gl_FragColor = vec4(uPlate * mix(vec3(1.0), wash, uFill) * uIntensity, uOpacity);
|
|
120
|
+
#include <tonemapping_fragment>
|
|
121
|
+
#include <colorspace_fragment>
|
|
122
|
+
}`;
|
|
123
|
+
export function build(u, c) {
|
|
124
|
+
const object = new THREE.Group();
|
|
125
|
+
const cols = Math.max(10, c.cols | 0), rows = Math.round(cols * 0.65);
|
|
126
|
+
u.uGrid.value.set(cols, rows);
|
|
127
|
+
const quad = new THREE.PlaneGeometry(1, 1);
|
|
128
|
+
const geo = new THREE.InstancedBufferGeometry();
|
|
129
|
+
geo.index = quad.index;
|
|
130
|
+
geo.setAttribute('position', quad.attributes.position);
|
|
131
|
+
const n = cols * rows, cell = new Float32Array(n * 3), rnd = mulberry32(9);
|
|
132
|
+
for (let j = 0; j < rows; j++)
|
|
133
|
+
for (let i = 0; i < cols; i++) {
|
|
134
|
+
const k = j * cols + i; // jittered so the hatch never reads as a grid
|
|
135
|
+
cell[k * 3] = (i + 0.5 + (rnd() - 0.5) * 0.2) / cols;
|
|
136
|
+
cell[k * 3 + 1] = (j + 0.5 + (rnd() - 0.5) * 0.2) / rows;
|
|
137
|
+
cell[k * 3 + 2] = rnd();
|
|
138
|
+
}
|
|
139
|
+
geo.setAttribute('aCell', new THREE.InstancedBufferAttribute(cell, 3));
|
|
140
|
+
geo.instanceCount = n;
|
|
141
|
+
geo.boundingSphere = new THREE.Sphere(new THREE.Vector3(), 1.4);
|
|
142
|
+
const strokeMat = new THREE.ShaderMaterial({ uniforms: u, vertexShader: strokeVert, fragmentShader: strokeFrag, glslVersion: THREE.GLSL3, transparent: true, depthWrite: false, premultipliedAlpha: true, side: THREE.DoubleSide });
|
|
143
|
+
const strokes = new THREE.Mesh(geo, strokeMat);
|
|
144
|
+
strokes.frustumCulled = false;
|
|
145
|
+
strokes.renderOrder = 2;
|
|
146
|
+
const plateGeo = new THREE.PlaneGeometry(1, 1);
|
|
147
|
+
const plateMat = new THREE.ShaderMaterial({ uniforms: u, vertexShader: plateVert, fragmentShader: plateFrag, glslVersion: THREE.GLSL3 });
|
|
148
|
+
const plate = new THREE.Mesh(plateGeo, plateMat);
|
|
149
|
+
plate.frustumCulled = false;
|
|
150
|
+
object.add(plate, strokes);
|
|
151
|
+
const cfg = { ...c };
|
|
152
|
+
const pic = createPicture(u, cfg);
|
|
153
|
+
const pst = {};
|
|
154
|
+
const api = {
|
|
155
|
+
object, materials: [strokeMat, plateMat],
|
|
156
|
+
controls: { show: (t) => pic.show(t), get busy() { return pic.busy; }, pic },
|
|
157
|
+
apply(k) { Object.assign(cfg, k); applyConfig(u, k); if (k.opacity !== undefined)
|
|
158
|
+
plateMat.transparent = k.opacity < 1; },
|
|
159
|
+
update(dt, pointer) { dt = Math.min(dt, 0.1); u.uTime.value += dt; pic.step(dt); stepPointer(u, pointer, dt, pst); },
|
|
160
|
+
dispose() { quad.dispose(); geo.dispose(); plateGeo.dispose(); strokeMat.dispose(); plateMat.dispose(); pic.dispose(); },
|
|
161
|
+
};
|
|
162
|
+
return api;
|
|
163
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const POINTER_MODES: string[];
|
|
3
|
+
export declare const STRUCTURAL: string[];
|
|
4
|
+
export declare function createUniforms(): {
|
|
5
|
+
uFrost: {
|
|
6
|
+
value: number;
|
|
7
|
+
};
|
|
8
|
+
uWhite: {
|
|
9
|
+
value: number;
|
|
10
|
+
};
|
|
11
|
+
uFeather: {
|
|
12
|
+
value: number;
|
|
13
|
+
};
|
|
14
|
+
uRim: {
|
|
15
|
+
value: number;
|
|
16
|
+
};
|
|
17
|
+
uSelf: {
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
uFrostColor: {
|
|
21
|
+
value: THREE.Color;
|
|
22
|
+
};
|
|
23
|
+
uTrail: {
|
|
24
|
+
value: THREE.Vector3[];
|
|
25
|
+
};
|
|
26
|
+
uRefrost: {
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
uTexA: {
|
|
30
|
+
value: any;
|
|
31
|
+
};
|
|
32
|
+
uTexB: {
|
|
33
|
+
value: any;
|
|
34
|
+
};
|
|
35
|
+
uFitA: {
|
|
36
|
+
value: THREE.Vector2;
|
|
37
|
+
};
|
|
38
|
+
uFitB: {
|
|
39
|
+
value: THREE.Vector2;
|
|
40
|
+
};
|
|
41
|
+
uP: {
|
|
42
|
+
value: number;
|
|
43
|
+
};
|
|
44
|
+
uHasA: {
|
|
45
|
+
value: number;
|
|
46
|
+
};
|
|
47
|
+
uSeq: {
|
|
48
|
+
value: number;
|
|
49
|
+
};
|
|
50
|
+
uSize: {
|
|
51
|
+
value: THREE.Vector2;
|
|
52
|
+
};
|
|
53
|
+
uTime: {
|
|
54
|
+
value: number;
|
|
55
|
+
};
|
|
56
|
+
uDir: {
|
|
57
|
+
value: THREE.Vector2;
|
|
58
|
+
};
|
|
59
|
+
uSpread: {
|
|
60
|
+
value: number;
|
|
61
|
+
};
|
|
62
|
+
uBlank: {
|
|
63
|
+
value: THREE.Color;
|
|
64
|
+
};
|
|
65
|
+
uIntensity: {
|
|
66
|
+
value: number;
|
|
67
|
+
};
|
|
68
|
+
uOpacity: {
|
|
69
|
+
value: number;
|
|
70
|
+
};
|
|
71
|
+
uBreathe: {
|
|
72
|
+
value: number;
|
|
73
|
+
};
|
|
74
|
+
uPointer: {
|
|
75
|
+
value: THREE.Vector3;
|
|
76
|
+
};
|
|
77
|
+
uPointerVel: {
|
|
78
|
+
value: THREE.Vector2;
|
|
79
|
+
};
|
|
80
|
+
uPointerActive: {
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
uPointerMode: {
|
|
84
|
+
value: number;
|
|
85
|
+
};
|
|
86
|
+
uPointerStrength: {
|
|
87
|
+
value: number;
|
|
88
|
+
};
|
|
89
|
+
uPointerRadius: {
|
|
90
|
+
value: number;
|
|
91
|
+
};
|
|
92
|
+
uPointerColor: {
|
|
93
|
+
value: THREE.Color;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export declare function applyConfig(u: any, c: any): void;
|
|
97
|
+
export declare function build(u: any, c: any): {
|
|
98
|
+
object: THREE.Group<THREE.Object3DEventMap>;
|
|
99
|
+
materials: any[];
|
|
100
|
+
controls: {
|
|
101
|
+
show: (t: any) => void;
|
|
102
|
+
readonly busy: boolean;
|
|
103
|
+
pic: {
|
|
104
|
+
st: {
|
|
105
|
+
A: any;
|
|
106
|
+
B: any;
|
|
107
|
+
aspA: number;
|
|
108
|
+
aspB: number;
|
|
109
|
+
p: number;
|
|
110
|
+
dir: number;
|
|
111
|
+
pending: any;
|
|
112
|
+
seq: number;
|
|
113
|
+
frame: number;
|
|
114
|
+
};
|
|
115
|
+
show: (tex: any) => void;
|
|
116
|
+
jump: (tex: any) => void;
|
|
117
|
+
step: (dt: any) => void;
|
|
118
|
+
readonly busy: boolean;
|
|
119
|
+
dispose(): void;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
apply(k: any): void;
|
|
123
|
+
update(dt: any, pointer: any): void;
|
|
124
|
+
dispose(): void;
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=frost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frost.d.ts","sourceRoot":"","sources":["../../../../src/components/image/core/frost.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,aAAa,UAAkB,CAAC;AAE7C,eAAO,MAAM,UAAU,UAAgB,CAAC;AAExC,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B;AACD,wBAAgB,WAAW,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,QAG/B;AAmED,wBAAgB,KAAK,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCzB"}
|