zincjs 2.4.1-beta.2 → 2.4.1-beta.3

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.
@@ -2,7 +2,9 @@ import * as THREE from 'three/webgpu';
2
2
  import { Fn, attribute, materialColor, materialOpacity, mix, uniform, vec4 } from 'three/tsl';
3
3
 
4
4
  //Maps a classic material's constructor name to its NodeMaterial
5
- //equivalent, since only NodeMaterial exposes colorNode.
5
+ //equivalent, since only NodeMaterial exposes colorNode/positionNode.
6
+ //Exported for reuse anywhere else a classic material needs upgrading to a
7
+ //NodeMaterial to attach a custom node to (see glyphRenderMaterial.js).
6
8
  const NODE_MATERIAL_CLASSES = {
7
9
  MeshBasicMaterial: THREE.MeshBasicNodeMaterial,
8
10
  MeshLambertMaterial: THREE.MeshLambertNodeMaterial,
@@ -16,15 +18,6 @@ const NODE_MATERIAL_CLASSES = {
16
18
  * targets {@link updateMorphColorAttribute} (in utilities.js) keeps
17
19
  * published as the 'morphColor0'/'morphColor1' geometry attributes -
18
20
  * whichever two morph targets currently have non-zero influence.
19
- *
20
- * This replaces the legacy `material.onBeforeCompile = augmentMorphColor`
21
- * approach, which patched raw GLSL into the classic WebGL shader and has no
22
- * effect once a material is compiled through the WebGPU/TSL pipeline.
23
- * three.js's own built-in WebGPU morph target system packs morph colour
24
- * data into its morph texture (see three's Morph.js) but its blend loop
25
- * only ever applies the result to position/normal, never colour, so this
26
- * has to be done by hand.
27
- *
28
21
  * Converts `material` to its NodeMaterial equivalent first if it isn't one
29
22
  * already, since only NodeMaterial exposes `colorNode`.
30
23
  *
@@ -47,9 +40,6 @@ const applyMorphColorNode = (material) => {
47
40
 
48
41
  const morphColorMix = uniform(0);
49
42
 
50
- //materialColor already folds in material.color and, if present, .map -
51
- //multiplying it by the blended per vertex morph colour keeps that
52
- //compositing instead of replacing it outright.
53
43
  target.colorNode = Fn(() => {
54
44
  const colorA = attribute('morphColor0', 'vec3');
55
45
  const colorB = attribute('morphColor1', 'vec3');
@@ -62,4 +52,4 @@ const applyMorphColorNode = (material) => {
62
52
  return target;
63
53
  };
64
54
 
65
- export { applyMorphColorNode };
55
+ export { applyMorphColorNode, NODE_MATERIAL_CLASSES };
@@ -11,6 +11,7 @@ import {
11
11
  If,
12
12
  varying,
13
13
  float,
14
+ sRGBTransferEOTF,
14
15
  } from 'three/tsl';
15
16
 
16
17
  export function createWebGPUMaterial() {
@@ -111,7 +112,9 @@ placeholderTexture.needsUpdate = true;
111
112
  // Contrast calculations
112
113
  const contrastedColor = brightenedColor.sub(vec3(0.5)).mul(uniforms.contrast).add(vec3(0.5));
113
114
 
114
- return vec4(contrastedColor, 1.0);
115
+ // WebGPURenderer always applies an sRGB OETF (linear -> sRGB) encode to
116
+ // the final composited frame, we are applying an sRGB -> linear here to cancel out the effect.
117
+ return vec4(sRGBTransferEOTF(contrastedColor), 1.0);
115
118
  });
116
119
 
117
120
  // Assign to NodeMaterial slots
package/vite.config.js CHANGED
@@ -27,6 +27,7 @@ export default defineConfig({
27
27
  'three/tsl': 'THREE',
28
28
  'three/webgpu': 'THREE',
29
29
  'three-spritetext': 'SpriteText',
30
+ 'three/examples/jsm/exporters/GLTFExporter': 'GLTFExporter',
30
31
  'three/examples/jsm/loaders/GLTFLoader': 'GLTFLoader',
31
32
  'fflate': 'fflate'
32
33
  }