@@ -8,37 +8,37 @@ import {
88} from 'three' ;
99
1010/**
11- * Visualizes an {@link LightProbeVolume } by rendering a sphere at each
11+ * Visualizes an {@link LightProbeGrid } by rendering a sphere at each
1212 * probe position, shaded with the probe's L1 spherical harmonics.
1313 *
1414 * Uses a single `InstancedMesh` draw call for all probes.
1515 *
1616 * ```js
17- * const helper = new LightProbeVolumeHelper( probeGrid );
17+ * const helper = new LightProbeGridHelper( probes );
1818 * scene.add( helper );
1919 * ```
2020 *
2121 * @augments InstancedMesh
22- * @three_import import { LightProbeVolumeHelper } from 'three/addons/helpers/LightProbeVolumeHelper .js';
22+ * @three_import import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper .js';
2323 */
24- class LightProbeVolumeHelper extends InstancedMesh {
24+ class LightProbeGridHelper extends InstancedMesh {
2525
2626 /**
2727 * Constructs a new irradiance probe grid helper.
2828 *
29- * @param {LightProbeVolume } probeGrid - The probe grid to visualize.
29+ * @param {LightProbeGrid } probes - The probe grid to visualize.
3030 * @param {number } [sphereSize=0.12] - The radius of each probe sphere.
3131 */
32- constructor ( probeGrid , sphereSize = 0.12 ) {
32+ constructor ( probes , sphereSize = 0.12 ) {
3333
3434 const geometry = new SphereGeometry ( sphereSize , 16 , 16 ) ;
3535
3636 const material = new ShaderMaterial ( {
3737
3838 uniforms : {
3939
40- probeGridSH : { value : null } ,
41- probeGridResolution : { value : new Vector3 ( ) } ,
40+ probesSH : { value : null } ,
41+ probesResolution : { value : new Vector3 ( ) } ,
4242
4343 } ,
4444
@@ -63,27 +63,27 @@ class LightProbeVolumeHelper extends InstancedMesh {
6363
6464 precision highp sampler3D;
6565
66- uniform sampler3D probeGridSH ;
67- uniform vec3 probeGridResolution ;
66+ uniform sampler3D probesSH ;
67+ uniform vec3 probesResolution ;
6868
6969 varying vec3 vWorldNormal;
7070 varying vec3 vUVW;
7171
7272 void main() {
7373
74- // Atlas UV mapping — must match light_probe_volume_pars_fragment .glsl.js
75- float nz = probeGridResolution .z;
74+ // Atlas UV mapping — must match lightprobes_pars_fragment .glsl.js
75+ float nz = probesResolution .z;
7676 float paddedSlices = nz + 2.0;
7777 float atlasDepth = 7.0 * paddedSlices;
7878 float uvZBase = vUVW.z * nz + 1.0;
7979
80- vec4 s0 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase ) / atlasDepth ) );
81- vec4 s1 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
82- vec4 s2 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
83- vec4 s3 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
84- vec4 s4 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
85- vec4 s5 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
86- vec4 s6 = texture( probeGridSH , vec3( vUVW.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
80+ vec4 s0 = texture( probesSH , vec3( vUVW.xy, ( uvZBase ) / atlasDepth ) );
81+ vec4 s1 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
82+ vec4 s2 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
83+ vec4 s3 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
84+ vec4 s4 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
85+ vec4 s5 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
86+ vec4 s6 = texture( probesSH , vec3( vUVW.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
8787
8888 // Unpack 9 vec3 SH L2 coefficients
8989
@@ -127,32 +127,32 @@ class LightProbeVolumeHelper extends InstancedMesh {
127127
128128 } ) ;
129129
130- const res = probeGrid . resolution ;
130+ const res = probes . resolution ;
131131 const count = res . x * res . y * res . z ;
132132
133133 super ( geometry , material , count ) ;
134134
135135 /**
136136 * The probe grid to visualize.
137137 *
138- * @type {LightProbeVolume }
138+ * @type {LightProbeGrid }
139139 */
140- this . probeGrid = probeGrid ;
140+ this . probes = probes ;
141141
142- this . type = 'LightProbeVolumeHelper ' ;
142+ this . type = 'LightProbeGridHelper ' ;
143143
144144 this . update ( ) ;
145145
146146 }
147147
148148 /**
149149 * Rebuilds instance matrices and UVW attributes from the current probe grid.
150- * Call this after changing `probeGrid ` or after re-baking.
150+ * Call this after changing `probes ` or after re-baking.
151151 */
152152 update ( ) {
153153
154- const probeGrid = this . probeGrid ;
155- const res = probeGrid . resolution ;
154+ const probes = this . probes ;
155+ const res = probes . resolution ;
156156 const count = res . x * res . y * res . z ;
157157
158158 // Resize instance matrix buffer if needed
@@ -177,12 +177,12 @@ class LightProbeVolumeHelper extends InstancedMesh {
177177
178178 for ( let ix = 0 ; ix < res . x ; ix ++ ) {
179179
180- // Remap to texel centers (must match light_probe_volume_pars_fragment .glsl.js)
180+ // Remap to texel centers (must match lightprobes_pars_fragment .glsl.js)
181181 uvwArray [ i * 3 ] = ( ix + 0.5 ) / res . x ;
182182 uvwArray [ i * 3 + 1 ] = ( iy + 0.5 ) / res . y ;
183183 uvwArray [ i * 3 + 2 ] = ( iz + 0.5 ) / res . z ;
184184
185- probeGrid . getProbePosition ( ix , iy , iz , probePos ) ;
185+ probes . getProbePosition ( ix , iy , iz , probePos ) ;
186186 matrix . makeTranslation ( probePos . x , probePos . y , probePos . z ) ;
187187 this . setMatrixAt ( i , matrix ) ;
188188
@@ -200,8 +200,8 @@ class LightProbeVolumeHelper extends InstancedMesh {
200200
201201 // Update texture uniforms
202202
203- this . material . uniforms . probeGridSH . value = probeGrid . texture ;
204- this . material . uniforms . probeGridResolution . value . copy ( probeGrid . resolution ) ;
203+ this . material . uniforms . probesSH . value = probes . texture ;
204+ this . material . uniforms . probesResolution . value . copy ( probes . resolution ) ;
205205
206206 }
207207
@@ -218,4 +218,4 @@ class LightProbeVolumeHelper extends InstancedMesh {
218218
219219}
220220
221- export { LightProbeVolumeHelper } ;
221+ export { LightProbeGridHelper } ;
0 commit comments