|
@@ -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 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|