Forráskód Böngészése

Examples: Clean up.

Mugen87 5 éve
szülő
commit
e9e8a272af

+ 1 - 0
examples/js/misc/Ocean.js

@@ -184,6 +184,7 @@ THREE.Ocean = function ( renderer, camera, scene, options ) {
 	this.materialOcean.uniforms.u_skyColor = { value: this.skyColor };
 	this.materialOcean.uniforms.u_sunDirection = { value: new THREE.Vector3( this.sunDirectionX, this.sunDirectionY, this.sunDirectionZ ) };
 	this.materialOcean.uniforms.u_exposure = { value: this.exposure };
+	this.materialOcean.uniforms.u_size = { value: this.size };
 
 	// Disable blending to prevent default premultiplied alpha values
 	this.materialOceanHorizontal.blending = 0;

+ 1 - 0
examples/jsm/loaders/GLTFLoader.js

@@ -628,6 +628,7 @@ var GLTFLoader = ( function () {
 	 * Transmission Materials Extension
 	 *
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
+	 * Draft: https://github.com/KhronosGroup/glTF/pull/1698
 	 */
 	function GLTFMaterialsTransmissionExtension( parser ) {
 

+ 1 - 0
examples/jsm/misc/Ocean.js

@@ -204,6 +204,7 @@ var Ocean = function ( renderer, camera, scene, options ) {
 	this.materialOcean.uniforms.u_skyColor = { value: this.skyColor };
 	this.materialOcean.uniforms.u_sunDirection = { value: new Vector3( this.sunDirectionX, this.sunDirectionY, this.sunDirectionZ ) };
 	this.materialOcean.uniforms.u_exposure = { value: this.exposure };
+	this.materialOcean.uniforms.u_size = { value: this.size };
 
 	// Disable blending to prevent default premultiplied alpha values
 	this.materialOceanHorizontal.blending = 0;

BIN
examples/screenshots/webgl_raymarching_reflect.jpg


BIN
examples/screenshots/webgl_shaders_ocean2.jpg


BIN
examples/screenshots/webgl_trails.jpg


+ 7 - 3
examples/webgl_raymarching_reflect.html

@@ -247,7 +247,7 @@
 
 			var dolly, camera, scene, renderer;
 			var geometry, material, mesh;
-			var stats;
+			var stats, clock;
 
 			var canvas = document.querySelector( '#canvas' );
 
@@ -278,6 +278,8 @@
 				dolly = new THREE.Group();
 				scene.add( dolly );
 
+				clock = new THREE.Clock();
+
 				camera = new THREE.PerspectiveCamera( 60, canvas.width / canvas.height, 1, 2000 );
 				camera.position.z = 4;
 				dolly.add( camera );
@@ -330,11 +332,13 @@
 
 			}
 
-			function render( time ) {
+			function render() {
 
 				stats.begin();
 
-				dolly.position.z = - time / 1000;
+				var elapsedTime = clock.getElapsedTime();
+
+				dolly.position.z = - elapsedTime;
 
 				renderer.render( scene, camera );
 

+ 9 - 9
examples/webgl_trails.html

@@ -15,7 +15,7 @@
 
 			var container, stats;
 
-			var camera, scene, renderer;
+			var camera, scene, renderer, clock;
 
 			init();
 			animate();
@@ -28,6 +28,8 @@
 				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 10 );
 				camera.position.set( 0, 0, 1 );
 
+				clock = new THREE.Clock();
+
 				scene = new THREE.Scene();
 
 				var colorArray = [ new THREE.Color( 0xff0080 ), new THREE.Color( 0xffffff ), new THREE.Color( 0x8000ff ) ];
@@ -66,10 +68,6 @@
 
 				window.addEventListener( 'resize', onWindowResize, false );
 
-				//
-
-				if ( typeof TESTING !== 'undefined'  ) { for ( var i = 0; i < 1000; i ++ ) { render( 1000 - i ); } };
-
 			}
 
 			function onWindowResize() {
@@ -83,18 +81,20 @@
 
 			//
 
-			function animate( now ) {
+			function animate() {
 
 				requestAnimationFrame( animate );
 
-				render( now );
+				render();
 				stats.update();
 
 			}
 
-			function render( now ) {
+			function render() {
+
+				var elapsedTime = clock.getElapsedTime();
 
-				scene.rotation.y = now / 2000;
+				scene.rotation.y = elapsedTime * 0.5;
 
 				renderer.render( scene, camera );