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

Examples: Clean up. #28540

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
24 changes: 11 additions & 13 deletions examples/webxr_xr_dragging_custom_depth.html
Original file line number Diff line number Diff line change
@@ -92,9 +92,9 @@
for ( let i = 0; i < 50; i ++ ) {

const geometry = geometries[ Math.floor( Math.random() * geometries.length ) ];
const material = new THREE.ShaderMaterial({
const material = new THREE.ShaderMaterial( {

vertexShader: `
vertexShader: /* glsl */`
varying vec3 vNormal;
varying vec2 vUv;
void main() {
@@ -104,7 +104,7 @@
}
`,

fragmentShader: `
fragmentShader: /* glsl */`
uniform vec3 diffuseColor;
uniform float roughness;
uniform float metalness;
@@ -223,7 +223,7 @@

uniforms: {

diffuseColor: { value: new THREE.Color( Math.random() * 0xffffff) },
diffuseColor: { value: new THREE.Color( Math.random() * 0xffffff ) },
roughness: { value: 0.7 },
metalness: { value: 0.0 },
emissive: { value: 0.0 },
@@ -233,7 +233,7 @@

}

});
} );

const object = new THREE.Mesh( geometry, material );

@@ -418,30 +418,28 @@

function render() {

if (renderer.xr.hasDepthSensing() && ! isDepthSupplied) {
if ( renderer.xr.hasDepthSensing() && ! isDepthSupplied ) {

group.children.forEach(child => {
group.children.forEach( child => {

child.material.uniforms.depthColor.value = renderer.xr.getDepthTexture();
child.material.uniforms.depthWidth.value = 1680;
child.material.uniforms.depthHeight.value = 1760;
child.material.uniforms.NeedUpdate = true;

isDepthSupplied = true;

});
} );

} else if (! renderer.xr.hasDepthSensing() && isDepthSupplied) {
} else if ( ! renderer.xr.hasDepthSensing() && isDepthSupplied ) {

group.children.forEach(child => {
group.children.forEach( child => {

child.material.uniforms.depthWidth.value = 0;
child.material.uniforms.depthHeight.value = 0;
child.material.uniforms.NeedUpdate = true;

isDepthSupplied = false;

});
} );

}