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. #19625

Merged
merged 1 commit into from
Jun 11, 2020
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
40 changes: 20 additions & 20 deletions examples/jsm/nodes/effects/BlurNode.js
Original file line number Diff line number Diff line change
@@ -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" ) );
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
@@ -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 ) {
Copy link
Collaborator Author

@Mugen87 Mugen87 Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think it's better for compatibility to add renderer.capabilities.isWebGL2 === false instead of completely removing the extension checks like in 152a185.

@mrdoob Would you still like to remove these sections?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you're right. Better to keep them, I was being too lazy yesterday 😅


document.getElementById( 'notSupported' ).style.display = '';
return;
2 changes: 1 addition & 1 deletion examples/webgl_buffergeometry_instancing_interleaved.html
Original file line number Diff line number Diff line change
@@ -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;
15 changes: 0 additions & 15 deletions examples/webgl_depth_texture.html
Original file line number Diff line number Diff line change
@@ -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;
@@ -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">
4 changes: 2 additions & 2 deletions examples/webgl_lights_rectarealight.html
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion examples/webgl_materials_envmaps_hdr_nodes.html
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
envMap: 'HDR',
roughness: 0.0,
metalness: 0.0,
exposure: 1.0,
exposure: 2.0,
nodes: true,
animate: true,
debug: false
2 changes: 1 addition & 1 deletion examples/webgl_materials_envmaps_pmrem_nodes.html
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions examples/webgl_shaders_tonemapping.html
Original file line number Diff line number Diff line change
@@ -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 );