Skip to content

Commit

Permalink
Merge pull request #19625 from Mugen87/dev50
Browse files Browse the repository at this point in the history
Examples: Clean up.
  • Loading branch information
mrdoob authored Jun 11, 2020
2 parents 7841862 + 9b286bb commit 71928fb
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 43 deletions.
40 changes: 20 additions & 20 deletions examples/jsm/nodes/effects/BlurNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,33 @@ function BlurNode( value, uv, radius, size ) {
BlurNode.Nodes = ( function () {

var blurX = new FunctionNode( [
"vec4 blurX( sampler2D texture, vec2 uv, float s ) {",
"vec4 blurX( sampler2D tex, vec2 uv, float s ) {",
" vec4 sum = vec4( 0.0 );",
" sum += texture2D( texture, vec2( uv.x - 4.0 * s, uv.y ) ) * 0.051;",
" sum += texture2D( texture, vec2( uv.x - 3.0 * s, uv.y ) ) * 0.0918;",
" sum += texture2D( texture, vec2( uv.x - 2.0 * s, uv.y ) ) * 0.12245;",
" sum += texture2D( texture, vec2( uv.x - 1.0 * s, uv.y ) ) * 0.1531;",
" sum += texture2D( texture, vec2( uv.x, uv.y ) ) * 0.1633;",
" sum += texture2D( texture, vec2( uv.x + 1.0 * s, uv.y ) ) * 0.1531;",
" sum += texture2D( texture, vec2( uv.x + 2.0 * s, uv.y ) ) * 0.12245;",
" sum += texture2D( texture, vec2( uv.x + 3.0 * s, uv.y ) ) * 0.0918;",
" sum += texture2D( texture, vec2( uv.x + 4.0 * s, uv.y ) ) * 0.051;",
" sum += texture2D( tex, vec2( uv.x - 4.0 * s, uv.y ) ) * 0.051;",
" sum += texture2D( tex, vec2( uv.x - 3.0 * s, uv.y ) ) * 0.0918;",
" sum += texture2D( tex, vec2( uv.x - 2.0 * s, uv.y ) ) * 0.12245;",
" sum += texture2D( tex, vec2( uv.x - 1.0 * s, uv.y ) ) * 0.1531;",
" sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;",
" sum += texture2D( tex, vec2( uv.x + 1.0 * s, uv.y ) ) * 0.1531;",
" sum += texture2D( tex, vec2( uv.x + 2.0 * s, uv.y ) ) * 0.12245;",
" sum += texture2D( tex, vec2( uv.x + 3.0 * s, uv.y ) ) * 0.0918;",
" sum += texture2D( tex, vec2( uv.x + 4.0 * s, uv.y ) ) * 0.051;",
" return sum * .667;",
"}"
].join( "\n" ) );

var blurY = new FunctionNode( [
"vec4 blurY( sampler2D texture, vec2 uv, float s ) {",
"vec4 blurY( sampler2D tex, vec2 uv, float s ) {",
" vec4 sum = vec4( 0.0 );",
" sum += texture2D( texture, vec2( uv.x, uv.y - 4.0 * s ) ) * 0.051;",
" sum += texture2D( texture, vec2( uv.x, uv.y - 3.0 * s ) ) * 0.0918;",
" sum += texture2D( texture, vec2( uv.x, uv.y - 2.0 * s ) ) * 0.12245;",
" sum += texture2D( texture, vec2( uv.x, uv.y - 1.0 * s ) ) * 0.1531;",
" sum += texture2D( texture, vec2( uv.x, uv.y ) ) * 0.1633;",
" sum += texture2D( texture, vec2( uv.x, uv.y + 1.0 * s ) ) * 0.1531;",
" sum += texture2D( texture, vec2( uv.x, uv.y + 2.0 * s ) ) * 0.12245;",
" sum += texture2D( texture, vec2( uv.x, uv.y + 3.0 * s ) ) * 0.0918;",
" sum += texture2D( texture, vec2( uv.x, uv.y + 4.0 * s ) ) * 0.051;",
" sum += texture2D( tex, vec2( uv.x, uv.y - 4.0 * s ) ) * 0.051;",
" sum += texture2D( tex, vec2( uv.x, uv.y - 3.0 * s ) ) * 0.0918;",
" sum += texture2D( tex, vec2( uv.x, uv.y - 2.0 * s ) ) * 0.12245;",
" sum += texture2D( tex, vec2( uv.x, uv.y - 1.0 * s ) ) * 0.1531;",
" sum += texture2D( tex, vec2( uv.x, uv.y ) ) * 0.1633;",
" sum += texture2D( tex, vec2( uv.x, uv.y + 1.0 * s ) ) * 0.1531;",
" sum += texture2D( tex, vec2( uv.x, uv.y + 2.0 * s ) ) * 0.12245;",
" sum += texture2D( tex, vec2( uv.x, uv.y + 3.0 * s ) ) * 0.0918;",
" sum += texture2D( tex, vec2( uv.x, uv.y + 4.0 * s ) ) * 0.051;",
" return sum * .667;",
"}"
].join( "\n" ) );
Expand Down
Binary file modified examples/screenshots/webgl_materials_envmaps_hdr_nodes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgl_materials_envmaps_pmrem_nodes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgl_shaders_tonemapping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_instancing.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );

if ( renderer.extensions.get( 'ANGLE_instanced_arrays' ) === null ) {
if ( renderer.capabilities.isWebGL2 === false && renderer.extensions.get( 'ANGLE_instanced_arrays' ) === null ) {

document.getElementById( 'notSupported' ).style.display = '';
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_instancing_interleaved.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );

if ( renderer.extensions.get( 'ANGLE_instanced_arrays' ) === null ) {
if ( renderer.capabilities.isWebGL2 === false && renderer.extensions.get( 'ANGLE_instanced_arrays' ) === null ) {

document.getElementById( 'notSupported' ).style.display = '';
return;
Expand Down
15 changes: 0 additions & 15 deletions examples/webgl_depth_texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
<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">
<style>
#error {
margin: auto;
margin-top: 40px;
display: block;
max-width: 400px;
padding: 20px;
background: #CE0808;
}
</style>

<script id="post-vert" type="x-shader/x-vertex">
varying vec2 vUv;
Expand Down Expand Up @@ -55,11 +45,6 @@
<a href="https://threejs.org" target="_blank" rel="noopener">threejs</a> webgl - depth texture<br/>
Stores render target depth in a texture attachment.<br/>
Created by <a href="http://twitter.com/mattdesl" target="_blank" rel="noopener">@mattdesl</a>.

<div id="error" style="display: none;">
Your browser does not support <strong>WEBGL_depth_texture</strong>.<br/><br/>
This demo will not work.
</div>
</div>

<script type="module">
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_lights_rectarealight.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
// Check for float-RT support
// TODO (abelnation): figure out fall-back for float textures

if ( ! renderer.extensions.get( 'OES_texture_float' ) ) {
if ( renderer.capabilities.isWebGL2 === false && ! renderer.extensions.get( 'OES_texture_float' ) ) {

alert( 'OES_texture_float not supported' );
throw 'missing webgl extension';

}

if ( ! renderer.extensions.get( 'OES_texture_float_linear' ) ) {
if ( renderer.capabilities.isWebGL2 === false && ! renderer.extensions.get( 'OES_texture_float_linear' ) ) {

alert( 'OES_texture_float_linear not supported' );
throw 'missing webgl extension';
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_materials_envmaps_hdr_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
envMap: 'HDR',
roughness: 0.0,
metalness: 0.0,
exposure: 1.0,
exposure: 2.0,
nodes: true,
animate: true,
debug: false
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_materials_envmaps_pmrem_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
var params = {
roughness: 0.0,
metalness: 0.0,
exposure: 1.0,
exposure: 2.0,
intensity: 1.0,
animate: true,
debug: false
Expand Down
5 changes: 3 additions & 2 deletions examples/webgl_shaders_tonemapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,12 @@
var regularRenderTarget = new THREE.WebGLRenderTarget( windowThirdX, height, parameters );
ldrEffectComposer = new EffectComposer( renderer, regularRenderTarget );

if ( renderer.extensions.get( 'OES_texture_half_float_linear' ) ) {
if ( renderer.capabilities.isWebGL2 === false && renderer.extensions.get( 'OES_texture_half_float_linear' ) ) {

parameters.type = THREE.FloatType;

}
}

var hdrRenderTarget = new THREE.WebGLRenderTarget( windowThirdX, height, parameters );
dynamicHdrEffectComposer = new EffectComposer( renderer, hdrRenderTarget );
dynamicHdrEffectComposer.setSize( window.innerWidth, window.innerHeight );
Expand Down

0 comments on commit 71928fb

Please sign in to comment.