Skip to content

Commit 30a4123

Browse files
authored
WebGPURenderer: Remove .isInstancedMesh needs (#28683)
1 parent d208680 commit 30a4123

File tree

9 files changed

+5
-12
lines changed

9 files changed

+5
-12
lines changed

examples/jsm/nodes/accessors/MorphNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class MorphNode extends Node {
190190

191191
const influence = float( 0 ).toVar();
192192

193-
if ( this.mesh.isInstancedMesh === true && ( this.mesh.morphTexture !== null && this.mesh.morphTexture !== undefined ) ) {
193+
if ( this.mesh.count > 1 && ( this.mesh.morphTexture !== null && this.mesh.morphTexture !== undefined ) ) {
194194

195195
influence.assign( textureLoad( this.mesh.morphTexture, ivec2( int( i ).add( 1 ), int( instanceIndex ) ) ).r );
196196

examples/jsm/nodes/geometry/RangeNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RangeNode extends Node {
3232

3333
getNodeType( builder ) {
3434

35-
return builder.object.isInstancedMesh === true ? builder.getTypeFromLength( this.getVectorLength( builder ) ) : 'float';
35+
return builder.object.count > 1 ? builder.getTypeFromLength( this.getVectorLength( builder ) ) : 'float';
3636

3737
}
3838

@@ -42,7 +42,7 @@ class RangeNode extends Node {
4242

4343
let output = null;
4444

45-
if ( object.isInstancedMesh === true ) {
45+
if ( object.count > 1 ) {
4646

4747
const minValue = this.minNode.value;
4848
const maxValue = this.maxNode.value;

examples/jsm/renderers/common/Backend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Backend {
100100

101101
const { object, geometry } = renderObject;
102102

103-
return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.isInstancedMesh ? object.count : 1 );
103+
return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 );
104104

105105
}
106106

examples/jsm/renderers/common/RenderObject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export default class RenderObject {
234234

235235
}
236236

237-
if ( object.isInstancedMesh ) {
237+
if ( object.count > 1 ) {
238238

239239
cacheKey += object.count + ',';
240240

examples/webgpu_compute_particles.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
particleMaterial.transparent = true;
161161

162162
const particles = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), particleMaterial );
163-
particles.isInstancedMesh = true;
164163
particles.count = particleCount;
165164
particles.frustumCulled = false;
166165
scene.add( particles );

examples/webgpu_compute_particles_rain.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@
235235
rainMaterial.transparent = true;
236236

237237
const rainParticles = new THREE.Mesh( new THREE.PlaneGeometry( .1, 2 ), rainMaterial );
238-
rainParticles.isInstancedMesh = true;
239238
rainParticles.count = instanceCount;
240239
scene.add( rainParticles );
241240

@@ -275,7 +274,6 @@
275274
const rippleGeometry = BufferGeometryUtils.mergeGeometries( [ surfaceRippleGeometry, xRippleGeometry, zRippleGeometry ] );
276275

277276
const rippleParticles = new THREE.Mesh( rippleGeometry, rippleMaterial );
278-
rippleParticles.isInstancedMesh = true;
279277
rippleParticles.count = instanceCount;
280278
scene.add( rippleParticles );
281279

examples/webgpu_compute_particles_snow.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@
198198
staticMaterial.positionNode = positionLocal.mul( scaleBuffer.toAttribute() ).add( posBuffer.toAttribute() );
199199

200200
const rainParticles = new THREE.Mesh( geometry, staticMaterial );
201-
rainParticles.isInstancedMesh = true;
202201
rainParticles.count = maxParticleCount;
203202
rainParticles.castShadow = true;
204203
rainParticles.layers.disableAll();

examples/webgpu_compute_points.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
pointsMaterial.positionNode = particleNode;
134134

135135
const mesh = new THREE.Points( pointsGeometry, pointsMaterial );
136-
mesh.isInstancedMesh = true;
137136
mesh.count = particleNum;
138137
scene.add( mesh );
139138

examples/webgpu_particles.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696

9797
const smokeInstancedSprite = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), smokeNodeMaterial );
9898
smokeInstancedSprite.scale.setScalar( 400 );
99-
smokeInstancedSprite.isInstancedMesh = true;
10099
smokeInstancedSprite.count = 2000;
101100
scene.add( smokeInstancedSprite );
102101

@@ -113,7 +112,6 @@
113112

114113
const fireInstancedSprite = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), fireNodeMaterial );
115114
fireInstancedSprite.scale.setScalar( 400 );
116-
fireInstancedSprite.isInstancedMesh = true;
117115
fireInstancedSprite.count = 100;
118116
fireInstancedSprite.position.y = - 100;
119117
fireInstancedSprite.renderOrder = 1;

0 commit comments

Comments
 (0)