|
@@ -27,8 +27,7 @@
|
|
<script type="module">
|
|
<script type="module">
|
|
|
|
|
|
import * as THREE from 'three';
|
|
import * as THREE from 'three';
|
|
- import * as Nodes from 'three/nodes';
|
|
|
|
- import { add, mul } from 'three/nodes';
|
|
|
|
|
|
+ import { MeshStandardNodeMaterial, NodeUpdateType, Node, uniform, attribute, cubeTexture, add, mul } from 'three/nodes';
|
|
|
|
|
|
import WebGPU from 'three/addons/capabilities/WebGPU.js';
|
|
import WebGPU from 'three/addons/capabilities/WebGPU.js';
|
|
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
|
|
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
|
|
@@ -39,15 +38,15 @@
|
|
|
|
|
|
import Stats from 'three/addons/libs/stats.module.js';
|
|
import Stats from 'three/addons/libs/stats.module.js';
|
|
|
|
|
|
- class InstanceUniformNode extends Nodes.Node {
|
|
|
|
|
|
+ class InstanceUniformNode extends Node {
|
|
|
|
|
|
constructor() {
|
|
constructor() {
|
|
|
|
|
|
super( 'vec3' );
|
|
super( 'vec3' );
|
|
|
|
|
|
- this.updateType = Nodes.NodeUpdateType.Object;
|
|
|
|
|
|
+ this.updateType = NodeUpdateType.Object;
|
|
|
|
|
|
- this.uniformNode = new Nodes.UniformNode( new THREE.Color() );
|
|
|
|
|
|
+ this.uniformNode = uniform( new THREE.Color() );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,7 +98,7 @@
|
|
// Grid
|
|
// Grid
|
|
|
|
|
|
const helper = new THREE.GridHelper( 1000, 40, 0x303030, 0x303030 );
|
|
const helper = new THREE.GridHelper( 1000, 40, 0x303030, 0x303030 );
|
|
- helper.material.colorNode = new Nodes.AttributeNode( 'color' );
|
|
|
|
|
|
+ helper.material.colorNode = attribute( 'color' );
|
|
helper.position.y = - 75;
|
|
helper.position.y = - 75;
|
|
scene.add( helper );
|
|
scene.add( helper );
|
|
|
|
|
|
@@ -113,14 +112,14 @@
|
|
path + 'pz' + format, path + 'nz' + format
|
|
path + 'pz' + format, path + 'nz' + format
|
|
];
|
|
];
|
|
|
|
|
|
- const cubeTexture = new THREE.CubeTextureLoader().load( urls );
|
|
|
|
|
|
+ const cTexture = new THREE.CubeTextureLoader().load( urls );
|
|
|
|
|
|
// Materials
|
|
// Materials
|
|
|
|
|
|
const instanceUniform = new InstanceUniformNode();
|
|
const instanceUniform = new InstanceUniformNode();
|
|
- const cubeTextureNode = new Nodes.CubeTextureNode( cubeTexture );
|
|
|
|
|
|
+ const cubeTextureNode = cubeTexture( cTexture );
|
|
|
|
|
|
- const material = new THREE.MeshStandardMaterial();
|
|
|
|
|
|
+ const material = new MeshStandardNodeMaterial();
|
|
material.colorNode = add( instanceUniform, cubeTextureNode );
|
|
material.colorNode = add( instanceUniform, cubeTextureNode );
|
|
material.emissiveNode = mul( instanceUniform, cubeTextureNode );
|
|
material.emissiveNode = mul( instanceUniform, cubeTextureNode );
|
|
|
|
|