Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Remove .isInstancedMesh needs #28683

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/jsm/nodes/accessors/MorphNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class MorphNode extends Node {

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/nodes/geometry/RangeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RangeNode extends Node {

getNodeType( builder ) {

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

}

Expand All @@ -42,7 +42,7 @@ class RangeNode extends Node {

let output = null;

if ( object.isInstancedMesh === true ) {
if ( object.count > 1 ) {

const minValue = this.minNode.value;
const maxValue = this.maxNode.value;
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Backend {

const { object, geometry } = renderObject;

return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.isInstancedMesh ? object.count : 1 );
return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 );

}

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/RenderObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default class RenderObject {

}

if ( object.isInstancedMesh ) {
if ( object.count > 1 ) {

cacheKey += object.count + ',';

Expand Down
1 change: 0 additions & 1 deletion examples/webgpu_compute_particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
particleMaterial.transparent = true;

const particles = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), particleMaterial );
particles.isInstancedMesh = true;
particles.count = particleCount;
particles.frustumCulled = false;
scene.add( particles );
Expand Down
2 changes: 0 additions & 2 deletions examples/webgpu_compute_particles_rain.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
rainMaterial.transparent = true;

const rainParticles = new THREE.Mesh( new THREE.PlaneGeometry( .1, 2 ), rainMaterial );
rainParticles.isInstancedMesh = true;
rainParticles.count = instanceCount;
scene.add( rainParticles );

Expand Down Expand Up @@ -273,7 +272,6 @@
const rippleGeometry = BufferGeometryUtils.mergeGeometries( [ surfaceRippleGeometry, xRippleGeometry, zRippleGeometry ] );

const rippleParticles = new THREE.Mesh( rippleGeometry, rippleMaterial );
rippleParticles.isInstancedMesh = true;
rippleParticles.count = instanceCount;
scene.add( rippleParticles );

Expand Down
1 change: 0 additions & 1 deletion examples/webgpu_compute_particles_snow.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
staticMaterial.positionNode = positionLocal.mul( scaleBuffer.toAttribute() ).add( posBuffer.toAttribute() );

const rainParticles = new THREE.Mesh( geometry, staticMaterial );
rainParticles.isInstancedMesh = true;
rainParticles.count = maxParticleCount;
rainParticles.castShadow = true;
rainParticles.layers.disableAll();
Expand Down
1 change: 0 additions & 1 deletion examples/webgpu_compute_points.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
pointsMaterial.positionNode = particleNode;

const mesh = new THREE.Points( pointsGeometry, pointsMaterial );
mesh.isInstancedMesh = true;
mesh.count = particleNum;
scene.add( mesh );

Expand Down
2 changes: 0 additions & 2 deletions examples/webgpu_particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

const smokeInstancedSprite = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), smokeNodeMaterial );
smokeInstancedSprite.scale.setScalar( 400 );
smokeInstancedSprite.isInstancedMesh = true;
smokeInstancedSprite.count = 2000;
scene.add( smokeInstancedSprite );

Expand All @@ -113,7 +112,6 @@

const fireInstancedSprite = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), fireNodeMaterial );
fireInstancedSprite.scale.setScalar( 400 );
fireInstancedSprite.isInstancedMesh = true;
fireInstancedSprite.count = 100;
fireInstancedSprite.position.y = - 100;
fireInstancedSprite.renderOrder = 1;
Expand Down