Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/objects/Group.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { Object3D } from '../core/Object3D.js';

function Group() {
class Group extends Object3D {

Object3D.call( this );
constructor() {

this.type = 'Group';
super();
this.type = 'Group';
Object.defineProperty( this, 'isGroup', { value: true } );

}

Group.prototype = Object.assign( Object.create( Object3D.prototype ), {

constructor: Group,
}

isGroup: true

} );
}


export { Group };
69 changes: 34 additions & 35 deletions src/objects/LOD.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
import { Vector3 } from '../math/Vector3.js';
import { Object3D } from '../core/Object3D.js';

const _v1 = new Vector3();
const _v2 = new Vector3();
const _v1 = /*@__PURE__*/ new Vector3();
const _v2 = /*@__PURE__*/ new Vector3();

function LOD() {
class LOD extends Object3D {

Object3D.call( this );
constructor() {

this._currentLevel = 0;
super();

this.type = 'LOD';
this._currentLevel = 0;

Object.defineProperties( this, {
levels: {
enumerable: true,
value: []
}
} );

this.autoUpdate = true;

}
this.type = 'LOD';

LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
Object.defineProperties( this, {
levels: {
enumerable: true,
value: []
},
isLOD: {
value: true,
}
} );

constructor: LOD,
this.autoUpdate = true;

isLOD: true,
}

copy: function ( source ) {
copy( source ) {

Object3D.prototype.copy.call( this, source, false );
super.copy( source, false );

const levels = source.levels;

Expand All @@ -47,9 +46,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

return this;

},
}

addLevel: function ( object, distance = 0 ) {
addLevel( object, distance = 0 ) {

distance = Math.abs( distance );

Expand All @@ -73,15 +72,15 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

return this;

},
}

getCurrentLevel: function () {
getCurrentLevel() {

return this._currentLevel;

},
}

getObjectForDistance: function ( distance ) {
getObjectForDistance( distance ) {

const levels = this.levels;

Expand All @@ -105,9 +104,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

return null;

},
}

raycast: function ( raycaster, intersects ) {
raycast( raycaster, intersects ) {

const levels = this.levels;

Expand All @@ -121,9 +120,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

}

},
}

update: function ( camera ) {
update( camera ) {

const levels = this.levels;

Expand Down Expand Up @@ -163,11 +162,11 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

}

},
}

toJSON: function ( meta ) {
toJSON( meta ) {

const data = Object3D.prototype.toJSON.call( this, meta );
const data = super.toJSON( meta );

if ( this.autoUpdate === false ) data.object.autoUpdate = false;

Expand All @@ -190,7 +189,7 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {

}

} );
}


export { LOD };
16 changes: 7 additions & 9 deletions src/objects/LineLoop.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { Line } from './Line.js';

function LineLoop( geometry, material ) {
class LineLoop extends Line {

Line.call( this, geometry, material );
constructor( geometry, material ) {

this.type = 'LineLoop';
super( geometry, material );
this.type = 'LineLoop';
Object.defineProperty( this, 'isLineLoop', { value: true } );

}

LineLoop.prototype = Object.assign( Object.create( Line.prototype ), {
}

constructor: LineLoop,

isLineLoop: true,

} );
}


export { LineLoop };
63 changes: 31 additions & 32 deletions src/objects/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ import { Bone } from './Bone.js';
import { Matrix4 } from '../math/Matrix4.js';
import { MathUtils } from '../math/MathUtils.js';

const _offsetMatrix = new Matrix4();
const _identityMatrix = new Matrix4();
const _offsetMatrix = /*@__PURE__*/ new Matrix4();
const _identityMatrix = /*@__PURE__*/ new Matrix4();

function Skeleton( bones = [], boneInverses = [] ) {
class Skeleton {

this.uuid = MathUtils.generateUUID();
constructor( bones = [], boneInverses = [] ) {

this.bones = bones.slice( 0 );
this.boneInverses = boneInverses;
this.boneMatrices = null;
this.uuid = MathUtils.generateUUID();

this.boneTexture = null;
this.boneTextureSize = 0;
this.bones = bones.slice( 0 );
this.boneInverses = boneInverses;
this.boneMatrices = null;

this.frame = - 1;
this.boneTexture = null;
this.boneTextureSize = 0;

this.init();
this.frame = - 1;

}
this.init();

Object.assign( Skeleton.prototype, {
}

init: function () {
init() {

const bones = this.bones;
const boneInverses = this.boneInverses;
Expand Down Expand Up @@ -57,9 +57,9 @@ Object.assign( Skeleton.prototype, {

}

},
}

calculateInverses: function () {
calculateInverses() {

this.boneInverses.length = 0;

Expand All @@ -77,9 +77,9 @@ Object.assign( Skeleton.prototype, {

}

},
}

pose: function () {
pose() {

// recover the bind-time world matrices

Expand Down Expand Up @@ -120,9 +120,9 @@ Object.assign( Skeleton.prototype, {

}

},
}

update: function () {
update() {

const bones = this.bones;
const boneInverses = this.boneInverses;
Expand All @@ -148,15 +148,15 @@ Object.assign( Skeleton.prototype, {

}

},
}

clone: function () {
clone() {

return new Skeleton( this.bones, this.boneInverses );

},
}

getBoneByName: function ( name ) {
getBoneByName( name ) {

for ( let i = 0, il = this.bones.length; i < il; i ++ ) {

Expand All @@ -172,9 +172,9 @@ Object.assign( Skeleton.prototype, {

return undefined;

},
}

dispose: function ( ) {
dispose( ) {

if ( this.boneTexture !== null ) {

Expand All @@ -184,9 +184,9 @@ Object.assign( Skeleton.prototype, {

}

},
}

fromJSON: function ( json, bones ) {
fromJSON( json, bones ) {

this.uuid = json.uuid;

Expand All @@ -211,9 +211,9 @@ Object.assign( Skeleton.prototype, {

return this;

},
}

toJSON: function () {
toJSON() {

const data = {
metadata: {
Expand Down Expand Up @@ -244,7 +244,6 @@ Object.assign( Skeleton.prototype, {

}

} );

}

export { Skeleton };
Loading