Browse Source

Merge pull request #10352 from sunag/sea3d_1.8.1

Sea3d 1.8.1 - tjs2
Mr.doob 8 years ago
parent
commit
2eac7fb474

+ 3 - 1
examples/js/loaders/sea3d/SEA3D.js

@@ -2130,9 +2130,11 @@ SEA3D.Material = function ( name, data, sea3d ) {
 	if ( this.attrib & 128 )
 	if ( this.attrib & 128 )
 		this.animations = data.readAnimationList( sea3d );
 		this.animations = data.readAnimationList( sea3d );
 
 
-	this.depthMask = ( this.attrib & 256 ) == 0;
+	this.depthWrite = ( this.attrib & 256 ) == 0;
 	this.depthTest = ( this.attrib & 512 ) == 0;
 	this.depthTest = ( this.attrib & 512 ) == 0;
 
 
+	this.premultipliedAlpha = ( this.attrib & 1024 ) != 0;
+
 	var count = data.readUByte();
 	var count = data.readUByte();
 
 
 	for ( var i = 0; i < count; ++ i ) {
 	for ( var i = 0; i < count; ++ i ) {

+ 26 - 26
examples/js/loaders/sea3d/SEA3DLegacy.js

@@ -41,11 +41,11 @@ THREE.SEA3D.prototype.isLegacy = function ( sea ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipXVec3 = function ( v ) {
+THREE.SEA3D.prototype.flipVec3 = function ( v ) {
 
 
 	if ( ! v ) return;
 	if ( ! v ) return;
 
 
-	var i = 0; // z
+	var i = 2;
 
 
 	while ( i < v.length ) {
 	while ( i < v.length ) {
 
 
@@ -133,7 +133,7 @@ THREE.SEA3D.prototype.compressJoints = function ( sea ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipYZIndex = function ( v ) {
+THREE.SEA3D.prototype.flipIndexes = function ( v ) {
 
 
 	var i = 1; // y >-< z
 	var i = 1; // y >-< z
 
 
@@ -151,17 +151,17 @@ THREE.SEA3D.prototype.flipYZIndex = function ( v ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipMatrixBone = function () {
+THREE.SEA3D.prototype.flipBoneMatrix = function () {
 
 
 	var zero = new THREE.Vector3();
 	var zero = new THREE.Vector3();
 
 
 	return function ( mtx ) {
 	return function ( mtx ) {
 
 
 		var pos = THREE.SEA3D.VECBUF.setFromMatrixPosition( mtx );
 		var pos = THREE.SEA3D.VECBUF.setFromMatrixPosition( mtx );
-		pos.x = - pos.x;
+		pos.z = - pos.z;
 
 
 		mtx.setPosition( zero );
 		mtx.setPosition( zero );
-		mtx.multiplyMatrices( THREE.SEA3D.MTXBUF.makeRotationX( THREE.Math.degToRad( 180 ) ), mtx );
+		mtx.multiplyMatrices( THREE.SEA3D.MTXBUF.makeRotationZ( THREE.Math.degToRad( 180 ) ), mtx );
 		mtx.setPosition( pos );
 		mtx.setPosition( pos );
 
 
 		return mtx;
 		return mtx;
@@ -170,7 +170,7 @@ THREE.SEA3D.prototype.flipMatrixBone = function () {
 
 
 }();
 }();
 
 
-THREE.SEA3D.prototype.flipMatrixScale = function () {
+THREE.SEA3D.prototype.flipScaleMatrix = function () {
 
 
 	var pos = new THREE.Vector3();
 	var pos = new THREE.Vector3();
 	var qua = new THREE.Quaternion();
 	var qua = new THREE.Quaternion();
@@ -182,13 +182,13 @@ THREE.SEA3D.prototype.flipMatrixScale = function () {
 
 
 		local.decompose( pos, qua, slc );
 		local.decompose( pos, qua, slc );
 
 
-		slc.x = - slc.x;
+		slc.z = - slc.z;
 
 
 		local.compose( pos, qua, slc );
 		local.compose( pos, qua, slc );
 
 
 		if ( rotate ) {
 		if ( rotate ) {
 
 
-			local.multiplyMatrices( local, THREE.SEA3D.MTXBUF.makeRotationX( THREE.Math.degToRad( 180 ) ) );
+			local.multiplyMatrices( local, THREE.SEA3D.MTXBUF.makeRotationZ( THREE.Math.degToRad( 180 ) ) );
 
 
 		}
 		}
 
 
@@ -196,7 +196,7 @@ THREE.SEA3D.prototype.flipMatrixScale = function () {
 
 
 			parent = parent.clone();
 			parent = parent.clone();
 
 
-			this.flipMatrixScale( parent, parentRotate );
+			this.flipScaleMatrix( parent, parentRotate );
 
 
 			local.multiplyMatrices( parent.getInverse( parent ), local );
 			local.multiplyMatrices( parent.getInverse( parent ), local );
 
 
@@ -265,17 +265,17 @@ THREE.SEA3D.prototype.flipDefaultAnimation = function () {
 			if ( relative ) {
 			if ( relative ) {
 
 
 				buf1.identity();
 				buf1.identity();
-				parent = this.flipMatrixScale( buf2.copy( obj3d.matrixWorld ) );
+				parent = this.flipScaleMatrix( buf2.copy( obj3d.matrixWorld ) );
 
 
 			} else {
 			} else {
 
 
 				if ( obj3d.parent ) {
 				if ( obj3d.parent ) {
 
 
-					parent = this.flipMatrixScale( buf2.copy( obj3d.parent.matrixWorld ) );
+					parent = this.flipScaleMatrix( buf2.copy( obj3d.parent.matrixWorld ) );
 
 
 				}
 				}
 
 
-				this.flipMatrixScale( buf1.copy( obj3d.matrix ), false, parent );
+				this.flipScaleMatrix( buf1.copy( obj3d.matrix ), false, parent );
 
 
 			}
 			}
 
 
@@ -333,7 +333,7 @@ THREE.SEA3D.prototype.flipDefaultAnimation = function () {
 
 
 				buf1.compose( pos, qua, slc );
 				buf1.compose( pos, qua, slc );
 
 
-				this.flipMatrixScale( buf1, false, buf2 );
+				this.flipScaleMatrix( buf1, false, buf2 );
 
 
 				buf1.decompose( to_pos, to_qua, to_slc );
 				buf1.decompose( to_pos, to_qua, to_slc );
 
 
@@ -449,7 +449,7 @@ THREE.SEA3D.prototype.updateTransform = function () {
 			if ( sea.transform ) buf1.elements.set( sea.transform );
 			if ( sea.transform ) buf1.elements.set( sea.transform );
 			else buf1.makeTranslation( sea.position.x, sea.position.y, sea.position.z );
 			else buf1.makeTranslation( sea.position.x, sea.position.y, sea.position.z );
 
 
-			this.flipMatrixScale(
+			this.flipScaleMatrix(
 				buf1, false,
 				buf1, false,
 				obj3d.parent ? obj3d.parent.matrixWorld : identity,
 				obj3d.parent ? obj3d.parent.matrixWorld : identity,
 				obj3d.parent instanceof THREE.Bone
 				obj3d.parent instanceof THREE.Bone
@@ -502,7 +502,7 @@ THREE.SEA3D.prototype.readSkeleton = function () {
 
 
 			// convert to three.js order
 			// convert to three.js order
 
 
-			if ( isLegacy ) this.flipMatrixBone( mtx_local );
+			if ( isLegacy ) this.flipBoneMatrix( mtx_local );
 
 
 			if ( bone.parentIndex > - 1 ) {
 			if ( bone.parentIndex > - 1 ) {
 
 
@@ -513,7 +513,7 @@ THREE.SEA3D.prototype.readSkeleton = function () {
 
 
 				// convert parent to three.js order
 				// convert parent to three.js order
 
 
-				if ( isLegacy ) this.flipMatrixBone( mtx_parent );
+				if ( isLegacy ) this.flipBoneMatrix( mtx_parent );
 
 
 				// to local
 				// to local
 
 
@@ -603,11 +603,11 @@ THREE.SEA3D.prototype.readSkeletonAnimationLegacy = function () {
 
 
 						// convert to three.js matrix
 						// convert to three.js matrix
 
 
-						this.flipMatrixBone( mtx_global );
+						this.flipBoneMatrix( mtx_global );
 
 
 						// flip parent inverse
 						// flip parent inverse
 
 
-						this.flipMatrixBone( mtx_parent );
+						this.flipBoneMatrix( mtx_parent );
 
 
 						// to local
 						// to local
 
 
@@ -617,7 +617,7 @@ THREE.SEA3D.prototype.readSkeletonAnimationLegacy = function () {
 
 
 					} else {
 					} else {
 
 
-						this.flipMatrixBone( mtx_local );
+						this.flipBoneMatrix( mtx_local );
 
 
 					}
 					}
 
 
@@ -658,8 +658,8 @@ THREE.SEA3D.prototype.readVertexAnimation = function ( sea ) {
 
 
 			var frame = sea.frame[ i ];
 			var frame = sea.frame[ i ];
 
 
-			this.flipXVec3( frame.vertex );
-			this.flipXVec3( frame.normal );
+			this.flipVec3( frame.vertex );
+			this.flipVec3( frame.normal );
 
 
 		}
 		}
 
 
@@ -673,10 +673,10 @@ THREE.SEA3D.prototype.readGeometryBuffer = function ( sea ) {
 
 
 	if ( this.isLegacy( sea ) ) {
 	if ( this.isLegacy( sea ) ) {
 
 
-		this.flipXVec3( sea.vertex );
-		this.flipXVec3( sea.normal );
+		this.flipVec3( sea.vertex, true );
+		this.flipVec3( sea.normal, true );
 
 
-		this.flipYZIndex( sea.indexes );
+		this.flipIndexes( sea.indexes );
 
 
 		if ( sea.jointPerVertex > 4 ) this.compressJoints( sea );
 		if ( sea.jointPerVertex > 4 ) this.compressJoints( sea );
 		else if ( sea.jointPerVertex < 4 ) this.expandJoints( sea );
 		else if ( sea.jointPerVertex < 4 ) this.expandJoints( sea );
@@ -691,7 +691,7 @@ THREE.SEA3D.prototype.readLines = function ( sea ) {
 
 
 	if ( this.isLegacy( sea ) ) {
 	if ( this.isLegacy( sea ) ) {
 
 
-		this.flipXVec3( sea.vertex );
+		this.flipVec3( sea.vertex );
 
 
 	}
 	}
 
 

+ 45 - 2
examples/js/loaders/sea3d/SEA3DLoader.js

@@ -35,7 +35,6 @@ THREE.SEA3D = function ( config ) {
 		useEnvironment: true,
 		useEnvironment: true,
 		useVertexTexture: true,
 		useVertexTexture: true,
 		forceStatic: false,
 		forceStatic: false,
-		forcePremultipliedAlpha: false,
 		streaming: true,
 		streaming: true,
 		async: true,
 		async: true,
 		paths: {},
 		paths: {},
@@ -100,6 +99,16 @@ Object.defineProperties( THREE.SEA3D.prototype, {
 
 
 		}
 		}
 
 
+	},
+
+	elapsedTime: {
+
+		get: function () {
+
+			return this.file.timer.elapsedTime;
+
+		}
+
 	}
 	}
 
 
 } );
 } );
@@ -1147,6 +1156,19 @@ THREE.SEA3D.Object3D.prototype = Object.assign( Object.create( THREE.Object3D.pr
 
 
 		return this.animate != undefined;
 		return this.animate != undefined;
 
 
+	},
+
+	copy: function ( source ) {
+
+		THREE.Object3D.prototype.copy.call( this, source );
+
+		this.attribs = source.attribs;
+		this.scripts = source.scripts;
+
+		if ( source.animator ) this.animator = source.animator.clone( this );
+
+		return this;
+
 	}
 	}
 
 
 } );
 } );
@@ -2019,6 +2041,7 @@ THREE.SEA3D.prototype.readMesh = function ( sea ) {
 
 
 	}
 	}
 
 
+
 	mesh.name = sea.name;
 	mesh.name = sea.name;
 
 
 	mesh.castShadow = sea.castShadows;
 	mesh.castShadow = sea.castShadows;
@@ -2519,6 +2542,22 @@ THREE.SEA3D.prototype.materialTechnique =
 
 
 	};
 	};
 
 
+	// EMISSIVE
+	techniques[ SEA3D.Material.EMISSIVE ] =
+	function ( mat, tech ) {
+
+		mat.emissive.setHex( tech.color );
+
+	};
+
+	// EMISSIVE_MAP
+	techniques[ SEA3D.Material.EMISSIVE_MAP ] =
+	function ( mat, tech ) {
+
+		mat.emissiveMap = tech.texture.tag;
+
+	};
+
 	// ALPHA_MAP
 	// ALPHA_MAP
 	techniques[ SEA3D.Material.ALPHA_MAP ] =
 	techniques[ SEA3D.Material.ALPHA_MAP ] =
 	function ( mat, tech, sea ) {
 	function ( mat, tech, sea ) {
@@ -2594,7 +2633,11 @@ THREE.SEA3D.prototype.readMaterial = function ( sea ) {
 	var mat = this.createMaterial( sea );
 	var mat = this.createMaterial( sea );
 	mat.name = sea.name;
 	mat.name = sea.name;
 
 
-	mat.premultipliedAlpha = this.config.forcePremultipliedAlpha;
+	mat.depthWrite = sea.depthWrite;
+	mat.depthTest = sea.depthTest;
+
+	mat.premultipliedAlpha = sea.premultipliedAlpha;
+
 	mat.side = sea.bothSides ? THREE.DoubleSide : THREE.FrontSide;
 	mat.side = sea.bothSides ? THREE.DoubleSide : THREE.FrontSide;
 
 
 	this.setBlending( mat, sea.blendMode );
 	this.setBlending( mat, sea.blendMode );

+ 20 - 16
examples/js/loaders/sea3d/physics/SEA3DAmmo.js

@@ -11,12 +11,15 @@
 'use strict';
 'use strict';
 
 
 SEA3D.AMMO = {
 SEA3D.AMMO = {
+
 	world: null,
 	world: null,
+
 	rigidBodies: [],
 	rigidBodies: [],
 	rigidBodiesTarget: [],
 	rigidBodiesTarget: [],
-	rigidBodiesOffset: [],
 	rigidBodiesEnabled: [],
 	rigidBodiesEnabled: [],
+
 	constraints: [],
 	constraints: [],
+
 	vehicles: [],
 	vehicles: [],
 	vehiclesWheels: [],
 	vehiclesWheels: [],
 
 
@@ -89,26 +92,29 @@ SEA3D.AMMO = {
 
 
 	setEnabledRigidBody: function ( rb, enabled ) {
 	setEnabledRigidBody: function ( rb, enabled ) {
 
 
-		if ( this.getEnabledRigidBody( rb ) == enabled ) return;
+		var index = this.rigidBodies.indexOf( rb );
+
+		if ( this.rigidBodiesEnabled[ index ] == enabled ) return;
 
 
 		if ( enabled ) this.world.addRigidBody( rb );
 		if ( enabled ) this.world.addRigidBody( rb );
 		else this.world.removeRigidBody( rb );
 		else this.world.removeRigidBody( rb );
 
 
+		this.rigidBodiesEnabled[ index ] = true;
+
 		return this;
 		return this;
 
 
 	},
 	},
 	getEnabledRigidBody: function ( rb ) {
 	getEnabledRigidBody: function ( rb ) {
 
 
-		return this.rigidBodiesEnabled[ this.rigidBodies.indexOf( rb ) ] === true;
+		return this.rigidBodiesEnabled[ this.rigidBodies.indexOf( rb ) ];
 
 
 	},
 	},
-	addRigidBody: function ( rb, target, offset, enabled ) {
+	addRigidBody: function ( rb, target, enabled ) {
 
 
 		enabled = enabled !== undefined ? enabled : true;
 		enabled = enabled !== undefined ? enabled : true;
 
 
 		this.rigidBodies.push( rb );
 		this.rigidBodies.push( rb );
 		this.rigidBodiesTarget.push( target );
 		this.rigidBodiesTarget.push( target );
-		this.rigidBodiesOffset.push( offset );
 		this.rigidBodiesEnabled.push( false );
 		this.rigidBodiesEnabled.push( false );
 
 
 		this.setEnabledRigidBody( rb, enabled );
 		this.setEnabledRigidBody( rb, enabled );
@@ -124,7 +130,6 @@ SEA3D.AMMO = {
 
 
 		this.rigidBodies.splice( index, 1 );
 		this.rigidBodies.splice( index, 1 );
 		this.rigidBodiesTarget.splice( index, 1 );
 		this.rigidBodiesTarget.splice( index, 1 );
-		this.rigidBodiesOffset.splice( index, 1 );
 		this.rigidBodiesEnabled.splice( index, 1 );
 		this.rigidBodiesEnabled.splice( index, 1 );
 
 
 		if ( destroy ) Ammo.destroy( rb );
 		if ( destroy ) Ammo.destroy( rb );
@@ -332,12 +337,7 @@ SEA3D.AMMO = {
 			var pos = transform.getOrigin(),
 			var pos = transform.getOrigin(),
 				quat = transform.getRotation();
 				quat = transform.getRotation();
 
 
-			if ( offset == undefined ) {
-
-				obj3d.position.set( pos.x(), pos.y(), pos.z() );
-				obj3d.quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
-
-			} else {
+			if ( offset ) {
 
 
 				position.set( pos.x(), pos.y(), pos.z() );
 				position.set( pos.x(), pos.y(), pos.z() );
 				quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
 				quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
@@ -349,6 +349,11 @@ SEA3D.AMMO = {
 				obj3d.position.setFromMatrixPosition( matrix );
 				obj3d.position.setFromMatrixPosition( matrix );
 				obj3d.quaternion.setFromRotationMatrix( matrix );
 				obj3d.quaternion.setFromRotationMatrix( matrix );
 
 
+			} else {
+
+				obj3d.position.set( pos.x(), pos.y(), pos.z() );
+				obj3d.quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
+
 			}
 			}
 
 
 			return this;
 			return this;
@@ -377,7 +382,7 @@ SEA3D.AMMO = {
 
 
 				if ( wheelTarget ) {
 				if ( wheelTarget ) {
 
 
-					this.updateTargetTransform( wheelTarget, wheelsTransform );
+					this.updateTargetTransform( wheelTarget, wheelsTransform, wheelTarget.physics ? wheelTarget.physics.offset : null );
 
 
 				}
 				}
 
 
@@ -388,12 +393,11 @@ SEA3D.AMMO = {
 		for ( i = 0; i < this.rigidBodies.length; i ++ ) {
 		for ( i = 0; i < this.rigidBodies.length; i ++ ) {
 
 
 			var rb = this.rigidBodies[ i ],
 			var rb = this.rigidBodies[ i ],
-				target = this.rigidBodiesTarget[ i ],
-				offset = this.rigidBodiesOffset[ i ];
+				target = this.rigidBodiesTarget[ i ];
 
 
 			if ( target && rb.isActive() ) {
 			if ( target && rb.isActive() ) {
 
 
-				this.updateTargetTransform( target, rb.getWorldTransform(), offset );
+				this.updateTargetTransform( target, rb.getWorldTransform(), target.physics ? target.physics.offset : null );
 
 
 			}
 			}
 
 

+ 36 - 3
examples/js/loaders/sea3d/physics/SEA3DAmmoLoader.js

@@ -146,10 +146,15 @@ THREE.SEA3D.prototype.readCompound = function ( sea ) {
 THREE.SEA3D.prototype.readRigidBodyBase = function ( sea ) {
 THREE.SEA3D.prototype.readRigidBodyBase = function ( sea ) {
 
 
 	var shape = sea.shape.tag,
 	var shape = sea.shape.tag,
-		transform;
+		transform, target;
 
 
 	if ( sea.target ) {
 	if ( sea.target ) {
 
 
+		target = sea.target.tag;
+
+		target.physics = { enabled: true };
+		target.updateMatrix();
+
 		transform = SEA3D.AMMO.getTransformFromMatrix( sea.target.tag.matrix );
 		transform = SEA3D.AMMO.getTransformFromMatrix( sea.target.tag.matrix );
 
 
 	} else {
 	} else {
@@ -173,6 +178,23 @@ THREE.SEA3D.prototype.readRigidBodyBase = function ( sea ) {
 
 
 	var rb = new Ammo.btRigidBody( info );
 	var rb = new Ammo.btRigidBody( info );
 
 
+	if ( target ) {
+
+		target.physics.rigidBody = rb;
+
+		if ( sea.offset ) {
+
+			var offset = new THREE.Matrix4();
+			offset.elements.set( sea.offset );
+
+			target.physics.offset = offset;
+
+		}
+
+	}
+
+	Ammo.destroy( info );
+
 	this.domain.rigidBodies = this.rigidBodies = this.rigidBodies || [];
 	this.domain.rigidBodies = this.rigidBodies = this.rigidBodies || [];
 	this.rigidBodies.push( this.objects[ "rb/" + sea.name ] = sea.tag = rb );
 	this.rigidBodies.push( this.objects[ "rb/" + sea.name ] = sea.tag = rb );
 
 
@@ -188,7 +210,7 @@ THREE.SEA3D.prototype.readRigidBody = function ( sea ) {
 
 
 	var rb = this.readRigidBodyBase( sea );
 	var rb = this.readRigidBodyBase( sea );
 
 
-	SEA3D.AMMO.addRigidBody( rb, sea.target ? sea.target.tag : undefined, sea.offset ? new THREE.Matrix4().elements.set( sea.offset ) : undefined, this.config.enabledPhysics );
+	SEA3D.AMMO.addRigidBody( rb, sea.target ? sea.target.tag : undefined, this.config.enabledPhysics );
 
 
 };
 };
 
 
@@ -238,6 +260,17 @@ THREE.SEA3D.prototype.readCarController = function ( sea ) {
 
 
 		if ( target ) {
 		if ( target ) {
 
 
+			target.physics = { enabled: true, rigidBody: wheelInfo };
+
+			if ( wheel.offset ) {
+
+				var offset = new THREE.Matrix4();
+				offset.elements.set( wheel.offset );
+
+				target.physics.offset = offset;
+
+			}
+
 			if ( target.parent ) {
 			if ( target.parent ) {
 
 
 				target.parent.remove( target );
 				target.parent.remove( target );
@@ -260,7 +293,7 @@ THREE.SEA3D.prototype.readCarController = function ( sea ) {
 	}
 	}
 
 
 	SEA3D.AMMO.addVehicle( vehicle, wheels );
 	SEA3D.AMMO.addVehicle( vehicle, wheels );
-	SEA3D.AMMO.addRigidBody( body, sea.target ? sea.target.tag : undefined, sea.offset ? new THREE.Matrix4().elements.set( sea.offset ) : undefined, this.config.enabledPhysics );
+	SEA3D.AMMO.addRigidBody( body, sea.target ? sea.target.tag : undefined, this.config.enabledPhysics );
 
 
 	this.domain.vehicles = this.vehicles = this.vehicles || [];
 	this.domain.vehicles = this.vehicles = this.vehicles || [];
 	this.vehicles.push( this.objects[ "vhc/" + sea.name ] = sea.tag = vehicle );
 	this.vehicles.push( this.objects[ "vhc/" + sea.name ] = sea.tag = vehicle );

+ 19 - 3
examples/js/loaders/sea3d/physics/SEA3DRigidBody.js

@@ -168,6 +168,12 @@ SEA3D.Physics = function ( name, data, sea3d ) {
 	if ( this.attrib & 1 ) this.target = sea3d.getObject( data.readUInt() );
 	if ( this.attrib & 1 ) this.target = sea3d.getObject( data.readUInt() );
 	else this.transform = data.readMatrix();
 	else this.transform = data.readMatrix();
 
 
+	if ( this.attrib & 2 ) this.offset = data.readMatrix();
+
+	if ( this.attrib & 4 ) this.scripts = data.readScriptList( sea3d );
+
+	if ( this.attrib & 16 ) this.attributes = sea3d.getObject( data.readUInt() );
+
 };
 };
 
 
 SEA3D.Physics.prototype.readTag = function ( kind, data, size ) {
 SEA3D.Physics.prototype.readTag = function ( kind, data, size ) {
@@ -257,11 +263,21 @@ SEA3D.CarController.Wheel = function ( data, sea3d ) {
 	this.data = data;
 	this.data = data;
 	this.sea3d = sea3d;
 	this.sea3d = sea3d;
 
 
-	var attrib = data.readUShort();
+	this.attrib = data.readUShort();
+
+	this.isFront = ( this.attrib & 1 ) != 0;
+
+	if ( this.attrib & 2 ) {
 
 
-	this.isFront = ( attrib & 1 ) != 0,
+		this.target = sea3d.getObject( data.readUInt() );
 
 
-	this.target = sea3d.getObject( data.readUInt() );
+	}
+
+	if ( this.attrib & 4 ) {
+
+		this.offset = data.readMatrix();
+
+	}
 
 
 	this.pos = data.readVector3();
 	this.pos = data.readVector3();
 	this.dir = data.readVector3();
 	this.dir = data.readVector3();

BIN
examples/models/sea3d/car.sea


BIN
examples/models/sea3d/car.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.o3dgc.tjs.sea


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


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


BIN
examples/models/sea3d/sound.sea


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


+ 1 - 1
examples/webgl_loader_sea3d_hierarchy.html

@@ -107,7 +107,7 @@
 			};
 			};
 
 
 			// Open3DGC - Export by SEA3D Studio
 			// Open3DGC - Export by SEA3D Studio
-			loader.load( './models/sea3d/robot.o3dgc.tjs.sea' );
+			loader.load( './models/sea3d/robot.tjs.sea' );
 
 
 			//
 			//
 
 

+ 3 - 3
examples/webgl_loader_sea3d_physics.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - sea3d / keyframe</title>
+		<title>three.js webgl - sea3d / physics</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
@@ -115,7 +115,7 @@
 
 
 					var domain = this.loader.clone( { lights : false, runScripts : false, autoPlay: false, enabledPhysics : false } );
 					var domain = this.loader.clone( { lights : false, runScripts : false, autoPlay: false, enabledPhysics : false } );
 
 
-					offset += 180;
+					offset -= 180;
 
 
 					domain.container.position.x += offset;
 					domain.container.position.x += offset;
 					domain.applyContainerTransform();
 					domain.applyContainerTransform();
@@ -138,7 +138,7 @@
 				document.body.appendChild( container );
 				document.body.appendChild( container );
 
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
-				camera.position.set( -300, 200, 300 );
+				camera.position.set( 300, 200, -300 );
 
 
 				renderer = new THREE.WebGLRenderer();
 				renderer = new THREE.WebGLRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setPixelRatio( window.devicePixelRatio );

+ 1 - 1
examples/webgl_loader_sea3d_skinning.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - sea3d / skin</title>
+		<title>three.js webgl - sea3d / skinning</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>

+ 1 - 1
examples/webgl_loader_sea3d_sound.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - sea3d</title>
+		<title>three.js webgl - sea3d / sound</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>