Skip to content

Commit

Permalink
Object3D: Serialize/deserialize .forward and .up
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Aug 13, 2018
1 parent f93742c commit cef80a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,9 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;

if ( this.forward.equals( Object3D.DefaultForward ) === false ) object.forward = this.forward.toArray();
if ( this.up.equals( Object3D.DefaultUp ) === false ) object.up = this.up.toArray();

object.layers = this.layers.mask;
object.matrix = this.matrix.toArray();

Expand Down Expand Up @@ -797,6 +800,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),

this.name = source.name;

this.forward.copy( source.forward );
this.up.copy( source.up );

this.position.copy( source.position );
Expand Down
3 changes: 3 additions & 0 deletions src/loaders/ObjectLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ Object.assign( ObjectLoader.prototype, {

}

if ( data.forward !== undefined ) object.forward.fromArray( data.forward );
if ( data.up !== undefined ) object.up.fromArray( data.up );

if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;

Expand Down

0 comments on commit cef80a2

Please sign in to comment.