未验证 提交 4edc1a05 编写于 作者: M Michael Herzog 提交者: GitHub

Examples: Clean up. (#21704)

上级 e9f910c8
......@@ -23,13 +23,13 @@ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
}` );
export const pow2 = new FunctionNode( `float pow2( const in float x ) { return x*x; }` );
export const pow3 = new FunctionNode( `float pow3( const in float x ) { return x*x*x; }` );
export const pow4 = new FunctionNode( `float pow4( const in float x ) { float x2 = x*x; return x2*x2; }` );
export const pow2 = new FunctionNode( 'float pow2( const in float x ) { return x*x; }' );
export const pow3 = new FunctionNode( 'float pow3( const in float x ) { return x*x*x; }' );
export const pow4 = new FunctionNode( 'float pow4( const in float x ) { float x2 = x*x; return x2*x2; }' );
export const average = new FunctionNode( `float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }` );
export const average = new FunctionNode( 'float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }' );
export const max3 = new FunctionNode( `float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }` );
export const max3 = new FunctionNode( 'float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }' );
// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.
// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
......@@ -44,4 +44,4 @@ highp float rand( const in vec2 uv ) {
}` ).setIncludes( [ PI ] );
export const precisionSafeLength = new FunctionNode( `float precisionSafeLength( vec3 v ) { return length( v ); }` );
export const precisionSafeLength = new FunctionNode( 'float precisionSafeLength( vec3 v ) { return length( v ); }' );
......@@ -38,8 +38,8 @@ class LightContextNode extends ContextNode {
}
const resetTotalLight = `Irradiance = vec3( 0.0 ); ReflectedLightDirectDiffuse = vec3( 0.0 ); ReflectedLightDirectSpecular = vec3( 0.0 );`;
const resultTotalLight = `ReflectedLightDirectDiffuse + ReflectedLightDirectSpecular`;
const resetTotalLight = 'Irradiance = vec3( 0.0 ); ReflectedLightDirectDiffuse = vec3( 0.0 ); ReflectedLightDirectSpecular = vec3( 0.0 );';
const resultTotalLight = 'ReflectedLightDirectDiffuse + ReflectedLightDirectSpecular';
// include keywords
......
......@@ -44,7 +44,7 @@ class LightNode extends Node {
}
update( frame ) {
update( /* frame */ ) {
this.color.value.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.lightCutoffDistance.value = this.light.distance;
......
......@@ -21,7 +21,7 @@ class LightsNode extends Node {
}
return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
}
......
......@@ -8,7 +8,7 @@
</head>
<body>
<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU Instance Uniform<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU - Instance Uniform<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
</div>
<script type="importmap">
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgpu - selective lights</title>
<title>three.js - WebGPU - Selective Lights</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
......@@ -9,7 +9,8 @@
<body>
<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - selective lights WebGPU demo.<br />
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU - Selective Lights<br />
(Chrome Canary with flag: --enable-unsafe-webgpu)<br />
<b style="color:red">Left: Red lights</b> - <b>Center: All lights</b> - <b style="color:blue">Right: blue light</b>
</div>
......@@ -102,7 +103,7 @@
leftObject.material.shininess = centerObject.material.shininess = rightObject.material.shininess = 70;
leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * - 0.5;
leftObject.position.y = centerObject.position.y = rightObject.position.y = - 10;
leftObject.position.y = centerObject.position.y = rightObject.position.y = - 10;
//renderer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册