Skip to content
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/transpiler/GLSLDecoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ class GLSLDecoder {

const switchDeterminantTokens = this.readTokensUntil( ')' );

// Parse expresison between parentheses. Index 1: char after '('. Index -1: char before ')'
// Parse expression between parentheses. Index 1: char after '('. Index -1: char before ')'
const discriminant = this.parseExpressionFromTokens( switchDeterminantTokens.slice( 1, - 1 ) );

// Validate curly braces
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_loader_obj.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
materials.preload();

const objLoader = new OBJLoader().setPath( 'models/obj/male02/' );
objLoader.setMaterials( materials ); // optional since OBJ asstes can be loaded without an accompanying MTL file
objLoader.setMaterials( materials ); // optional since OBJ assets can be loaded without an accompanying MTL file

const object = await objLoader.loadAsync( 'male02.obj' );

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_tonemapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
scene = new THREE.Scene();
scene.backgroundBlurriness = params.blurriness;

const light = new THREE.DirectionalLight( 0xfff3ee, 3 ); // simualte sun
const light = new THREE.DirectionalLight( 0xfff3ee, 3 ); // simulate sun
light.position.set( 1, 0.05, 0.7 );
scene.add( light );

Expand Down
32 changes: 16 additions & 16 deletions examples/webgpu_centroid_sampling.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
align-items: center;
}

#antialising-disabled {
#antialiasing-disabled {
border-right: 1px solid black;
}

Expand All @@ -36,11 +36,11 @@
</style>
<body>
<div id="demo">
<div id="antialising-disabled" class="renderer-wrapper">
<div>antialising disabled</div>
<div id="antialiasing-disabled" class="renderer-wrapper">
<div>antialiasing disabled</div>
</div>
<div id="antialising-enabled" class="renderer-wrapper">
<div>antialising enabled</div>
<div id="antialiasing-enabled" class="renderer-wrapper">
<div>antialiasing enabled</div>
</div>
</div>

Expand Down Expand Up @@ -140,7 +140,7 @@
);

return geometry;

};

const material = new THREE.MeshBasicNodeMaterial();
Expand Down Expand Up @@ -197,9 +197,9 @@
mesh.position.set( x * 2, y * 2, 0 );
faceMeshes.push( mesh );
scene.add( mesh );

}

}

// Create Standard Renderer
Expand All @@ -218,13 +218,13 @@
forceWebGL: forceWebGL
} );

document.body.querySelector( '#antialising-enabled' ).appendChild( rendererAntialiasingEnabled.domElement );
document.body.querySelector( '#antialiasing-enabled' ).appendChild( rendererAntialiasingEnabled.domElement );
rendererAntialiasingEnabled.setPixelRatio( window.devicePixelRatio );
rendererAntialiasingEnabled.setSize( window.innerWidth / 2, window.innerHeight );
rendererAntialiasingEnabled.setAnimationLoop( animateAliased );
document.body.querySelector( '#antialising-disabled' ).appendChild( rendererAntialiasingDisabled.domElement );
document.body.querySelector( '#antialising-disabled' ).appendChild( rendererAntialiasingDisabled.domElement );

document.body.querySelector( '#antialiasing-disabled' ).appendChild( rendererAntialiasingDisabled.domElement );
document.body.querySelector( '#antialiasing-disabled' ).appendChild( rendererAntialiasingDisabled.domElement );

onWindowResize();

Expand Down Expand Up @@ -256,7 +256,7 @@

}


} );

}
Expand All @@ -267,7 +267,7 @@
rendererAntialiasingDisabled.setSize( halfWidth, window.innerHeight );
rendererAntialiasingEnabled.setSize( halfWidth, window.innerHeight );
const aspect = ( halfWidth ) / window.innerHeight;

camera.aspect = aspect;
camera.updateProjectionMatrix();

Expand All @@ -276,13 +276,13 @@
function animateStandard() {

rendererAntialiasingDisabled.render( scene, camera );

}

function animateAliased() {

rendererAntialiasingEnabled.render( scene, camera );

}

</script>
Expand Down
26 changes: 13 additions & 13 deletions examples/webgpu_compute_water.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
// Get 2-D compute coordinate from one-dimensional instanceIndex. The calculation will
// still work even if you dispatch your compute shader 2-dimensionally, since within a compute
// context, instanceIndex is a 1-dimensional value derived from the workgroup dimensions.

// Cast to int to prevent unintended index overflow upon subtraction.
const x = int( index.mod( WIDTH ) );
const y = int( index.div( WIDTH ) );
Expand All @@ -168,7 +168,7 @@

const westIndex = y.mul( width ).add( leftX );
const eastIndex = y.mul( width ).add( rightX );

const southIndex = bottomY.mul( width ).add( x );
const northIndex = topY.mul( width ).add( x );

Expand Down Expand Up @@ -283,7 +283,7 @@
meshRay.matrixAutoUpdate = false;
meshRay.updateMatrix();
scene.add( meshRay );

// Initialize sphere mesh instance position and velocity.
// position<vec3> + velocity<vec2> + unused<vec3> = 8 floats per sphere.
// for structs arrays must be enclosed in multiple of 4
Expand Down Expand Up @@ -339,7 +339,7 @@
const targetY = waterHeight.add( yOffset );

const deltaY = targetY.sub( instancePosition.y );
instancePosition.y.addAssign( deltaY.mul( verticalResponseFactor ) ); // Atualiza Y gradualmente
instancePosition.y.addAssign( deltaY.mul( verticalResponseFactor ) ); // Gradually update position

// Get the normal of the water surface at the duck's position
const pushX = normalX.mul( waterPushFactor );
Expand Down Expand Up @@ -373,7 +373,7 @@
If( instancePosition.z.lessThan( - limit ), () => {

instancePosition.z = - limit;
velocity.y.mulAssign( bounceDamping ); // Inverte e amortece vz (velocity.y)
velocity.y.mulAssign( bounceDamping ); // Invert and damp vz (velocity.y)

} ).ElseIf( instancePosition.z.greaterThan( limit ), () => {

Expand Down Expand Up @@ -448,18 +448,18 @@
gui.add( effectController.viscosity, 'value', 0.9, 0.96, 0.001 ).name( 'viscosity' );
gui.add( effectController, 'speed', 1, 6, 1 );
gui.add( effectController, 'ducksEnabled' ).onChange( () => {

duckMesh.visible = effectController.ducksEnabled;

} );
gui.add( effectController, 'wireframe' ).onChange( () => {

waterMesh.material.wireframe = ! waterMesh.material.wireframe;
poolBorder.material.wireframe = ! poolBorder.material.wireframe;
duckModel.material.wireframe = ! duckModel.material.wireframe;
waterMesh.material.needsUpdate = true;
poolBorder.material.needsUpdate = true;

} );

}
Expand All @@ -484,7 +484,7 @@
mouseDown = true;
firstClick = true;
updateOriginMouseDown = true;

}

function onPointerUp() {
Expand Down Expand Up @@ -529,7 +529,7 @@
effectController.mousePos.value.set( point.x, point.z );

updateOriginMouseDown = false;

}

effectController.mouseSpeed.value.set(
Expand All @@ -554,7 +554,7 @@
}

firstClick = false;

} else {

updateOriginMouseDown = true;
Expand Down Expand Up @@ -582,7 +582,7 @@
}

frame = 0;

}

renderer.render( scene, camera );
Expand Down
8 changes: 4 additions & 4 deletions examples/webgpu_layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
camera.position.z = 10;

scene = new THREE.Scene();

const horizontalEffect = screenUV.x.mix( color( 0xf996ae ), color( 0xf6f0a3 ) );
const lightEffect = screenUV.distance( vec2( 0.5, 1.0 ) ).oneMinus().mul( color( 0xd9b6fd ) );

Expand Down Expand Up @@ -137,7 +137,7 @@
const v = new THREE.Vector3();

for ( let i = 0; i < count; i ++ ) {

positions.push(
THREE.MathUtils.randFloat( - 25, - 20 ),
THREE.MathUtils.randFloat( - 10, 50 ),
Expand Down Expand Up @@ -179,8 +179,8 @@
const localTime = instancedBufferAttribute( timeAttribute ).add( time.mul( 0.02 ) );
const modTime = mod( localTime, 1.0 );

const rotatedPositon = rotate( positionLocal, instanceRotation.mul( modTime.mul( 20 ) ) );
material.positionNode = rotatedPositon.add( instancePosition ).add( instanceDirection.mul( modTime.mul( 50 ) ) );
const rotatedPosition = rotate( positionLocal, instanceRotation.mul( modTime.mul( 20 ) ) );
material.positionNode = rotatedPosition.add( instancePosition ).add( instanceDirection.mul( modTime.mul( 50 ) ) );

return material;

Expand Down
10 changes: 5 additions & 5 deletions examples/webgpu_lights_pointlights.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import { abs, attribute, distance, float, max, modelWorldMatrixInverse, positionLocal, sin, time, uniform } from 'three/tsl';

let camera, scene, timer, renderer, controls;

let light1, light2;

init();
Expand Down Expand Up @@ -79,7 +79,7 @@
scene.add( light2 );

scene.add( new THREE.AmbientLight( 0xaaaaaa, 0.1 ) );

// renderer

renderer = new THREE.WebGPURenderer( { antialias: true } );
Expand Down Expand Up @@ -129,7 +129,7 @@
function createMaterial() {

const material = new THREE.MeshPhongNodeMaterial();

const seedAttribute = attribute( 'seed' );
const displaceNormalAttribute = attribute( 'displaceNormal' );

Expand All @@ -153,7 +153,7 @@
}

function createGeometry( geometry ) {

const positionAttribute = geometry.getAttribute( 'position' );

const v0 = new THREE.Vector3();
Expand All @@ -180,7 +180,7 @@
v3.copy( v0 ).add( v1 ).add( v2 ).divideScalar( 3 ); // compute center
v3.add( n.copy( plane.normal ).multiplyScalar( - 1 ) ); // displace center inwards

// generate tetraeder for each triangle
// generate tetrahedron for each triangle

vertices.push( v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z );
vertices.push( v3.x, v3.y, v3.z, v1.x, v1.y, v1.z, v0.x, v0.y, v0.z );
Expand Down
14 changes: 7 additions & 7 deletions examples/webgpu_reflection.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script type="module">

import * as THREE from 'three';

import { abs, color, div, float, Fn, instancedBufferAttribute, materialColor, min, normalWorldGeometry, pass, positionGeometry, positionLocal, reflector, screenUV, sin, sub, texture, time, uniform, uv, varyingProperty } from 'three/tsl';
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';

Expand Down Expand Up @@ -174,7 +174,7 @@
}

function startTweens() {

const lifeTween = new TWEEN.Tween( uniformLife )
.to( { value: 1 }, 5000 )
.easing( TWEEN.Easing.Bounce.Out );
Expand All @@ -187,7 +187,7 @@
.onComplete( function () {

secondaryTweens();

} );
effectTween.start();

Expand Down Expand Up @@ -321,13 +321,13 @@

// TSL

const vVisbility = varyingProperty( 'float' );
const vVisibility = varyingProperty( 'float' );

const instancePosition = instancedBufferAttribute( attributePosition );
const instanceNormal = instancedBufferAttribute( attributeNormal );
const instanceColor = instancedBufferAttribute( attributeColor );
const instanceData = instancedBufferAttribute( attributeData );

material.positionNode = Fn( () => {

const instanceSize = instanceData.x;
Expand All @@ -345,7 +345,7 @@
// life (controls the visibility and initial scale of the cubes)

const scale = uniformLife.greaterThan( instanceTime ).select( min( 1, div( uniformLife.sub( instanceTime ), 0 ) ) ).oneMinus();
vVisbility.assign( uniformLife.greaterThan( instanceTime ).select( 1, 0 ) );
vVisibility.assign( uniformLife.greaterThan( instanceTime ).select( 1, 0 ) );

// accumulate different vertex animations

Expand All @@ -363,7 +363,7 @@

material.colorNode = Fn( () => {

vVisbility.equal( 0 ).discard();
vVisibility.equal( 0 ).discard();

return materialColor.mul( instanceColor );

Expand Down
4 changes: 2 additions & 2 deletions examples/webgpu_reflection_blurred.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@
// reflection composite

const reflectionMask = reflectionBlurred.a.mul( reflectionDepth ).remapClamp( 0, roughnessRange );
const reflectionItensity = .1;
const reflectionIntensity = .1;
const reflectionMixFactor = reflectionMask.mul( roughness.mul( 2 ).min( 1 ) );
const reflectionFinal = mix( reflection.rgb, reflectionBlurred.rgb, reflectionMixFactor ).mul( reflectionItensity );
const reflectionFinal = mix( reflection.rgb, reflectionBlurred.rgb, reflectionMixFactor ).mul( reflectionIntensity );

// mix reflection with animated circle

Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_tonemapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
scene = new THREE.Scene();
scene.backgroundBlurriness = params.blurriness;

const light = new THREE.DirectionalLight( 0xfff3ee, 3 ); // simualte sun
const light = new THREE.DirectionalLight( 0xfff3ee, 3 ); // simulate sun
light.position.set( 1, 0.05, 0.7 );
scene.add( light );

Expand Down
Loading