فهرست منبع

Merge pull request #7096 from sunag/dev

sea3d revision 3 - optimized
Mr.doob 10 سال پیش
والد
کامیت
cd3a147df2

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 506 - 329
examples/js/loaders/sea3d/SEA3D.js


+ 11 - 12
examples/js/loaders/sea3d/SEA3DDeflate.js

@@ -318,7 +318,6 @@ var zip_GET_BYTE = function() {
     if(zip_inflate_data.length == zip_inflate_pos)
 	return -1;
 	return zip_inflate_data[zip_inflate_pos++];
-    //return zip_inflate_data.charCodeAt(zip_inflate_pos++) & 0xff;
 }
 
 var zip_NEEDBITS = function(n) {
@@ -730,11 +729,11 @@ var zip_inflate_internal = function(buff, off, size) {
     return n;
 }
 
-var zip_inflate = function(str) {
+var zip_inflate = function(data) {
     var i, j, pos = 0;
 
     zip_inflate_start();
-    zip_inflate_data = str;
+    zip_inflate_data = new Uint8Array(data);
     zip_inflate_pos = 0;
 	
     var buff = new Uint8Array(1024);
@@ -745,7 +744,7 @@ var zip_inflate = function(str) {
 			out[pos++] = buff[j];		    
 	
     zip_inflate_data = null; // G.C.
-    return new Uint8Array(out);
+    return new Uint8Array(out).buffer;
 }
 
 if (! ctx.RawDeflate) ctx.RawDeflate = {};
@@ -754,14 +753,14 @@ ctx.RawDeflate.inflate = zip_inflate;
 })(this);
 
 /**
- * 	SEA3D.js - SEA3D SDK ( Deflate )
- * 	Copyright (C) 2013 Sunag Entertainment 
- * 
- * 	http://code.google.com/p/sea3d/
+ * 	SEA3D DEFLATE
+ * 	@author Sunag / http://www.sunag.com.br/
  */
- 
-SEA3D.File.DeflateUncompress = function(data) {	
-	return RawDeflate.inflate(data);
+
+SEA3D.File.DeflateUncompress = function( data ) {
+
+	return RawDeflate.inflate( data );
+
 }
 
-SEA3D.File.setDecompressionEngine(1, "deflate", SEA3D.File.DeflateUncompress);
+SEA3D.File.setDecompressionEngine( 1, "deflate", SEA3D.File.DeflateUncompress );

+ 25 - 19
examples/js/loaders/sea3d/SEA3DLZMA.js

@@ -561,32 +561,38 @@ LZMA.decompressFile = function(inStream, outStream){
 };
 
 /**
- * 	SEA3D.js - SEA3D SDK ( LZMA )
- * 	Copyright (C) 2013 Sunag Entertainment 
- * 
- * 	http://code.google.com/p/sea3d/
+ * 	SEA3D LZMA
+ * 	@author Sunag / http://www.sunag.com.br/
  */
- 
-SEA3D.File.LZMAUncompress = function(data) {	
+
+SEA3D.File.LZMAUncompress = function( data ) {
+
+	data = new Uint8Array( data );
+
 	var inStream = {
-		data:data,
-		position:0,
-		readByte:function(){
-			return this.data[this.position++];
+		data: data,
+		position: 0,
+		readByte: function() {
+
+			return this.data[ this.position ++ ];
+
 		}
 	}
-	
+
 	var outStream = {
-		data:[],
-		position:0,
-		writeByte: function(value){
-			this.data[this.position++] = value;
+		data: [],
+		position: 0,
+		writeByte: function( value ) {
+
+			this.data[ this.position ++ ] = value;
+
 		}
 	}
-	
-	LZMA.decompressFile(inStream, outStream);
 
-	return new Uint8Array(outStream.data);
+	LZMA.decompressFile( inStream, outStream );
+
+	return new Uint8Array( outStream.data ).buffer;
+
 }
 
-SEA3D.File.setDecompressionEngine(2, "lzma", SEA3D.File.LZMAUncompress);
+SEA3D.File.setDecompressionEngine( 2, "lzma", SEA3D.File.LZMAUncompress );

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 13
examples/js/loaders/sea3d/SEA3DLZMA_LZIP.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 762 - 1087
examples/js/loaders/sea3d/SEA3DLoader.js


BIN
examples/models/sea3d/flag.sea


BIN
examples/models/sea3d/flag.tjs.sea


BIN
examples/models/sea3d/keyframe.tjs.sea


BIN
examples/models/sea3d/mascot.tjs.sea


BIN
examples/models/sea3d/morph.tjs.sea


BIN
examples/models/sea3d/robot.tjs.sea


BIN
examples/models/sea3d/skin.tjs.sea


BIN
examples/models/sea3d/sound.tjs.sea


+ 5 - 7
examples/webgl_loader_sea3d.html

@@ -71,26 +71,26 @@
 			loader = new THREE.SEA3D( {
 
 				autoPlay : true, // Auto play animations
-				container : scene, // Container to add models
-				parser : THREE.SEA3D.AUTO, // Auto choose THREE.BufferGeometry and THREE.Geometry
-				multiplier : 1 // Light multiplier
+				container : scene // Container to add models
 
 			} );
 
 			loader.onComplete = function( e ) {
 
-				// Get camera from 3ds Max
+				// Get camera from SEA3D Studio
 				// use loader.get... to get others objects
 
 				var cam = loader.getCamera( "Camera007" );
 				camera.position.copy( cam.position );
 				camera.rotation.copy( cam.rotation );
 
+				controls = new THREE.OrbitControls( camera );
+
 				animate();
 
 			};
 
-			loader.load( './models/sea3d/mascot.sea' );
+			loader.load( './models/sea3d/mascot.tjs.sea' );
 
 			//
 
@@ -104,8 +104,6 @@
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.set( 1000, - 300, 1000 );
 
-				controls = new THREE.OrbitControls( camera );
-
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 3 - 7
examples/webgl_loader_sea3d_hierarchy.html

@@ -71,9 +71,7 @@
 			loader = new THREE.SEA3D( {
 
 				autoPlay : false, // Auto play animations
-				container : scene, // Container to add models
-				parser : THREE.SEA3D.BUFFER, // THREE.BufferGeometry
-				multiplier : 1 // Light multiplier
+				container : scene // Container to add models
 
 			} );
 
@@ -88,7 +86,7 @@
 						loader.meshes[i].animation.play("root");
 				}
 
-				// Get the first camera from 3ds Max
+				// Get the first camera from SEA3D Studio
 				// use loader.get... to get others objects
 
 				var cam = loader.cameras[0];
@@ -96,14 +94,12 @@
 				camera.rotation.copy( cam.rotation );
 
 				controls = new THREE.OrbitControls( camera );
-				controls.enableZoom = false;
-				controls.enablePan = false;
 
 				animate();
 
 			};
 
-			loader.load( './models/sea3d/robot.sea' );
+			loader.load( './models/sea3d/robot.tjs.sea' );
 
 			//
 

+ 4 - 6
examples/webgl_loader_sea3d_keyframe.html

@@ -72,9 +72,7 @@
 			loader = new THREE.SEA3D( {
 
 				autoPlay : false, // Manual play animations
-				container : scene, // Container to add models
-				parser : THREE.SEA3D.BUFFER, // THREE.SEA3D.BUFFER to THREE.BufferGeometry
-				multiplier : 1 // Light multiplier
+				container : scene // Container to add models
 
 			} );
 
@@ -87,6 +85,8 @@
 				camera.position.copy( cam.position );
 				camera.rotation.copy( cam.rotation );
 
+				controls = new THREE.OrbitControls( camera );
+
 				// reset global animation time
 				SEA3D.AnimationHandler.setTime( 0 );
 
@@ -98,7 +98,7 @@
 
 			};
 
-			loader.load( './models/sea3d/keyframe.sea' );
+			loader.load( './models/sea3d/keyframe.tjs.sea' );
 
 			//
 			//	Animation Functions
@@ -148,8 +148,6 @@
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.set( 1000, - 300, 1000 );
 
-				controls = new THREE.OrbitControls( camera );
-
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 5 - 7
examples/webgl_loader_sea3d_morph.html

@@ -71,21 +71,21 @@
 			loader = new THREE.SEA3D( {
 
 				autoPlay : true, // Auto play animations
-				container : scene, // Container to add models
-				parser : THREE.SEA3D.DEFAULT, // Auto choose THREE.BufferGeometry and THREE.Geometry
-				multiplier : 1 // Light multiplier
+				container : scene // Container to add models
 
 			} );
 
 			loader.onComplete = function( e ) {
 
-				// Get the first camera from 3ds Max
+				// Get the first camera from SEA3D Studio
 				// use loader.get... to get others objects
 
 				var cam = loader.cameras[0];
 				camera.position.copy( cam.position );
 				camera.rotation.copy( cam.rotation );
 
+				controls = new THREE.OrbitControls( camera );
+
 				// get mesh
 				teapot = loader.getMesh("Teapot01");
 
@@ -97,7 +97,7 @@
 
 			};
 
-			loader.load( './models/sea3d/morph.sea' );
+			loader.load( './models/sea3d/morph.tjs.sea' );
 
 			//
 
@@ -111,8 +111,6 @@
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.set( 1000, - 300, 1000 );
 
-				controls = new THREE.OrbitControls( camera );
-
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 5 - 6
examples/webgl_loader_sea3d_skinning.html

@@ -74,20 +74,21 @@
 
 				autoPlay : true, // Auto play animations
 				container : scene, // Container to add models
-				parser : THREE.SEA3D.AUTO, // Auto choose THREE.BufferGeometry and THREE.Geometry
-				multiplier : 1 // Light multiplier
+				multiplier : .6 // Light multiplier
 
 			} );
 
 			loader.onComplete = function( e ) {
 
-				// Get the first camera from 3ds Max
+				// Get the first camera from SEA3D Studio
 				// use loader.get... to get others objects
 
 				var cam = loader.cameras[0];
 				camera.position.copy( cam.position );
 				camera.rotation.copy( cam.rotation );
 
+				controls = new THREE.OrbitControls( camera );
+
 				// get meshes
 				player = loader.getMesh("Player");
 
@@ -102,7 +103,7 @@
 
 			};
 
-			loader.load( './models/sea3d/skin.sea' );
+			loader.load( './models/sea3d/skin.tjs.sea' );
 
 			//
 
@@ -116,8 +117,6 @@
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.set( 1000, - 300, 1000 );
 
-				controls = new THREE.OrbitControls( camera );
-
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 2 - 4
examples/webgl_loader_sea3d_sound.html

@@ -128,9 +128,7 @@
 			loader = new THREE.SEA3D( {
 
 				autoPlay : true, // Auto play animations
-				container : scene, // Container to add models
-				parser : THREE.SEA3D.AUTO, // Auto choose THREE.BufferGeometry and THREE.Geometry
-				multiplier : 1 // Light multiplier
+				container : scene // Container to add models
 
 			} );
 
@@ -150,7 +148,7 @@
 
 			};
 
-			loader.load( './models/sea3d/sound.sea' );
+			loader.load( './models/sea3d/sound.tjs.sea' );
 
 			//
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است