11import NodeMaterial , { addNodeMaterial } from './NodeMaterial.js' ;
22import { temp } from '../core/VarNode.js' ;
33import { varying } from '../core/VaryingNode.js' ;
4- import { property } from '../core/PropertyNode.js' ;
4+ import { property , varyingProperty } from '../core/PropertyNode.js' ;
55import { attribute } from '../core/AttributeNode.js' ;
66import { cameraProjectionMatrix } from '../accessors/CameraNode.js' ;
77import { materialColor , materialLineScale , materialLineDashSize , materialLineGapSize , materialLineDashOffset , materialLineWidth } from '../accessors/MaterialNode.js' ;
@@ -60,7 +60,7 @@ class Line2NodeMaterial extends NodeMaterial {
6060
6161 const a = cameraProjectionMatrix . element ( 2 ) . element ( 2 ) ; // 3nd entry in 3th column
6262 const b = cameraProjectionMatrix . element ( 3 ) . element ( 2 ) ; // 3nd entry in 4th column
63- const nearEstimate = b . mul ( - 0.5 ) . div ( a ) ;
63+ const nearEstimate = b . mul ( - 0.5 ) . div ( a ) ;
6464
6565 const alpha = nearEstimate . sub ( start . z ) . div ( end . z . sub ( start . z ) ) ;
6666
@@ -70,7 +70,7 @@ class Line2NodeMaterial extends NodeMaterial {
7070
7171 this . vertexNode = tslFn ( ( ) => {
7272
73- varying ( vec2 ( ) , 'vUv' ) . assign ( uv ( ) ) ; // @TODO : Analyze other way to do this
73+ varyingProperty ( ' vec2' , 'vUv' ) . assign ( uv ( ) ) ;
7474
7575 const instanceStart = attribute ( 'instanceStart' ) ;
7676 const instanceEnd = attribute ( 'instanceEnd' ) ;
@@ -85,8 +85,8 @@ class Line2NodeMaterial extends NodeMaterial {
8585
8686 if ( useWorldUnits ) {
8787
88- varying ( vec3 ( ) , 'worldStart' ) . assign ( start . xyz ) ;
89- varying ( vec3 ( ) , 'worldEnd' ) . assign ( end . xyz ) ;
88+ varyingProperty ( ' vec3' , 'worldStart' ) . assign ( start . xyz ) ;
89+ varyingProperty ( ' vec3' , 'worldEnd' ) . assign ( end . xyz ) ;
9090
9191 }
9292
@@ -97,7 +97,7 @@ class Line2NodeMaterial extends NodeMaterial {
9797 // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
9898 // perhaps there is a more elegant solution -- WestLangley
9999
100- const perspective = cameraProjectionMatrix . element ( 2 ) . element ( 3 ) . equal ( - 1.0 ) ; // 4th entry in the 3rd column
100+ const perspective = cameraProjectionMatrix . element ( 2 ) . element ( 3 ) . equal ( - 1.0 ) ; // 4th entry in the 3rd column
101101
102102 If ( perspective , ( ) => {
103103
@@ -173,7 +173,7 @@ class Line2NodeMaterial extends NodeMaterial {
173173
174174 // set the world position
175175
176- const worldPos = varying ( vec4 ( ) , 'worldPos' ) ;
176+ const worldPos = varyingProperty ( ' vec4' , 'worldPos' ) ;
177177
178178 worldPos . assign ( positionGeometry . y . lessThan ( 0.5 ) . cond ( start , end ) ) ;
179179 worldPos . assign ( worldPos . add ( vec4 ( offset , 0 ) ) ) ;
@@ -257,7 +257,7 @@ class Line2NodeMaterial extends NodeMaterial {
257257
258258 this . colorNode = tslFn ( ( ) => {
259259
260- const vUv = varying ( vec2 ( ) , 'vUv' ) ;
260+ const vUv = varyingProperty ( ' vec2' , 'vUv' ) ;
261261
262262 if ( useDash ) {
263263
@@ -288,11 +288,11 @@ class Line2NodeMaterial extends NodeMaterial {
288288
289289 if ( useWorldUnits ) {
290290
291- const worldStart = varying ( vec3 ( ) , 'worldStart' ) ;
292- const worldEnd = varying ( vec3 ( ) , 'worldEnd' ) ;
291+ const worldStart = varyingProperty ( ' vec3' , 'worldStart' ) ;
292+ const worldEnd = varyingProperty ( ' vec3' , 'worldEnd' ) ;
293293
294294 // Find the closest points on the view ray and the line segment
295- const rayEnd = varying ( vec4 ( ) , 'worldPos' ) . xyz . normalize ( ) . mul ( 1e5 ) ;
295+ const rayEnd = varyingProperty ( ' vec4' , 'worldPos' ) . xyz . normalize ( ) . mul ( 1e5 ) ;
296296 const lineDir = worldEnd . sub ( worldStart ) ;
297297 const params = closestLineToLine ( { p1 : worldStart , p2 : worldEnd , p3 : vec3 ( 0.0 , 0.0 , 0.0 ) , p4 : rayEnd } ) ;
298298
0 commit comments