Browse Source

Merge pull request #18808 from Mugen87/dev43

Examples: Remove webgl_lightshafts and respective glTF asset.
Mr.doob 5 years ago
parent
commit
781429a75e

+ 0 - 1
examples/files.js

@@ -300,7 +300,6 @@ var files = {
 		"webgl_gpgpu_protoplanet",
 		"webgl_instancing_modified",
 		"webgl_lightningstrike",
-		"webgl_lightshafts",
 		"webgl_materials_modified",
 		"webgl_raymarching_reflect",
 		"webgl_shadowmap_csm",

+ 0 - 5
examples/models/gltf/Tree/README.md

@@ -1,5 +0,0 @@
-# Low Poly Foliage Test
-
-Model by [Splodeman](https://sketchfab.com/3d-models/low-poly-foliage-test-c1ce9830c6af4b5289ee9ecb3c30512f).
-
-The model is license under Creative Commons Attribution.

BIN
examples/models/gltf/Tree/tree.glb


BIN
examples/textures/lightShaft.png


+ 0 - 224
examples/webgl_lightshafts.html

@@ -1,224 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - Light Shafts</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">
-	</head>
-
-	<body>
-		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - Light Shafts<br/>
-			Model by <a href="https://skfb.ly/6ICER" target="_blank" rel="noopener">Splodeman</a><br />
-		</div>
-
-		<script type="x-shader/x-vertex" id="vertexShader">
-
-		#include <common>
-
-		uniform float speed;
-		uniform float time;
-		uniform float timeOffset;
-		varying vec2 vUv;
-		varying float vAlpha;
-
-		void main() {
-
-			vec3 pos = position;
-
-			float l = ( time * speed * 0.01 ) + timeOffset;
-			float f = fract( l ); // linear time factor [0,1)
-			float a = f * f; // quadratic time factor [0,1)
-
-			// slightly animate the vertices of light shaft if necessary
-
-			// pos.x += cos( l * 20.0 ) * sin( l * 10.0 );
-
-			vAlpha = saturate( 0.7 + min( 1.0, a * 10.0 ) * ( sin( a * 40.0 ) * 0.25 ) );
-
-		  vUv = uv;
-
-			gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 );
-
-		}
-
-		</script>
-
-		<script type="x-shader/x-fragment" id="fragmentShader">
-
-		uniform float attenuation;
-		uniform vec3 color;
-		uniform sampler2D colorTexture;
-
-		varying vec2 vUv;
-		varying float vAlpha;
-
-		void main() {
-
-			vec4 textureColor = texture2D( colorTexture, vUv );
-			gl_FragColor = vec4( textureColor.rgb * color.rgb, textureColor.a * vAlpha );
-			gl_FragColor.a *= pow( gl_FragCoord.z, attenuation );
-
-		}
-
-		</script>
-
-		<script type="module">
-
-			import * as THREE from '../build/three.module.js';
-
-			import { OrbitControls } from './jsm/controls/OrbitControls.js';
-			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
-
-			var container, controls, clock;
-			var camera, scene, renderer, uniforms;
-
-			init();
-			animate();
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 100 );
-				camera.position.set( 3.2, 3, 3.7 );
-
-				clock = new THREE.Clock();
-
-				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0xcf8b74 );
-
-				var	light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
-				light.position.set( 0, 20, 0 );
-				scene.add( light );
-
-				light = new THREE.DirectionalLight( 0xffffff );
-				light.position.set( 0, 20, 10 );
-				scene.add( light );
-
-			 	// light shafts definition
-
-				var textureLoader = new THREE.TextureLoader();
-				var texture = textureLoader.load( 'textures/lightShaft.png' );
-
-				uniforms = {
-					// controls how fast the ray attenuates when the camera comes closer
-					attenuation: {
-						value: 10
-					},
-					// controls the speed of the animation
-					speed: {
-						value: 2
-					},
-					// the color of the ray
-					color: {
-						value: new THREE.Color( 0xdadc9f )
-					},
-					// the visual representation of the ray highly depends on the used texture
-					colorTexture: {
-						value: texture
-					},
-					// global time value for animation
-					time: {
-						value: 0
-					},
-					// individual time offset so rays are animated differently if necessary
-					timeOffset: {
-						value: 0
-					}
-				};
-
-				var lightShaftMaterial = new THREE.ShaderMaterial( {
-					uniforms: uniforms,
-					vertexShader: document.getElementById( 'vertexShader' ).textContent,
-					fragmentShader: document.getElementById( 'fragmentShader' ).textContent,
-					blending: THREE.AdditiveBlending,
-					depthWrite: false,
-					transparent: true,
-					side: THREE.DoubleSide
-				} );
-
-				var lightShaftGeometry = new THREE.PlaneBufferGeometry( 0.5, 5 );
-
-				// model
-
-				var loader = new GLTFLoader().setPath( 'models/gltf/Tree/' );
-				loader.load( 'tree.glb', function ( gltf ) {
-
-					gltf.scene.traverse( function ( child ) {
-
-						if ( child.isMesh )	{
-
-							child.material.transparent = false;
-							child.material.alphaTest = 0.5;
-							child.material.depthWrite = true;
-
-						}
-
-					} );
-
-					scene.add( gltf.scene );
-
-					// when the model is loaded, add light shafts
-
-					for ( var i = 0; i < 5; i ++ ) {
-
-						var lightShaft = new THREE.Mesh( lightShaftGeometry, lightShaftMaterial );
-						lightShaft.position.x = - 1 + 1.5 * Math.sign( ( i % 2 ) );
-						lightShaft.position.y = 2;
-						lightShaft.position.z = - 1.5 + ( i * 0.5 );
-						lightShaft.rotation.y = Math.PI * 0.2;
-						lightShaft.rotation.z = Math.PI * - ( 0.15 + 0.1 * Math.random() );
-						scene.add( lightShaft );
-
-					}
-
-				} );
-
-				//
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.outputEncoding = THREE.sRGBEncoding;
-				container.appendChild( renderer.domElement );
-
-				controls = new OrbitControls( camera, renderer.domElement );
-				controls.target.set( 0.5, 1.5, 0 );
-				controls.minDistance = 2;
-				controls.maxDistance = 20;
-				controls.update();
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function onWindowResize() {
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				const delta = clock.getDelta();
-
-				uniforms.time.value += delta;
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>