Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pure annotations house cleaning: Webpack #24336

Merged
merged 1 commit into from
Jul 18, 2022
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
2 changes: 1 addition & 1 deletion src/animation/AnimationMixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AnimationClip } from './AnimationClip.js';
import { NormalAnimationBlendMode } from '../constants.js';


const _controlInterpolantsResultBuffer = /*@__PURE__*/ new Float32Array( 1 );
const _controlInterpolantsResultBuffer = new Float32Array( 1 );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pure annotation isn't needed.



class AnimationMixer extends EventDispatcher {
Expand Down
24 changes: 8 additions & 16 deletions src/extras/DataUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ import { clamp } from '../math/MathUtils.js';

// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf

const {
floatView: _floatView,
uint32View: _uint32View,
baseTable: _baseTable,
shiftTable: _shiftTable,
mantissaTable: _mantissaTable,
exponentTable: _exponentTable,
offsetTable: _offsetTable
} = /*@__PURE__*/ _generateTables();
const _tables = /*@__PURE__*/ _generateTables();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object destructuring assignment with a pure annotation doesn't work in webpack/terser.


function _generateTables() {

Expand Down Expand Up @@ -142,7 +134,7 @@ function _generateTables() {
shiftTable: shiftTable,
mantissaTable: mantissaTable,
exponentTable: exponentTable,
offsetTable: offsetTable,
offsetTable: offsetTable
};

}
Expand All @@ -155,10 +147,10 @@ function toHalfFloat( val ) {

val = clamp( val, - 65504, 65504 );

_floatView[ 0 ] = val;
const f = _uint32View[ 0 ];
_tables.floatView[ 0 ] = val;
const f = _tables.uint32View[ 0 ];
const e = ( f >> 23 ) & 0x1ff;
return _baseTable[ e ] + ( ( f & 0x007fffff ) >> _shiftTable[ e ] );
return _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );

}

Expand All @@ -167,12 +159,12 @@ function toHalfFloat( val ) {
function fromHalfFloat( val ) {

const m = val >> 10;
_uint32View[ 0 ] = _mantissaTable[ _offsetTable[ m ] + ( val & 0x3ff ) ] + _exponentTable[ m ];
return _floatView[ 0 ];
_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];
return _tables.floatView[ 0 ];

}

export {
toHalfFloat,
fromHalfFloat,
fromHalfFloat
};
1 change: 1 addition & 0 deletions src/geometries/CylinderGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CylinderGeometry extends BufferGeometry {
constructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {

super();

this.type = 'CylinderGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/EdgesGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class EdgesGeometry extends BufferGeometry {
constructor( geometry = null, thresholdAngle = 1 ) {

super();

this.type = 'EdgesGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/PlaneGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class PlaneGeometry extends BufferGeometry {
constructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {

super();

this.type = 'PlaneGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/ShapeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ShapeGeometry extends BufferGeometry {
constructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {

super();

this.type = 'ShapeGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/SphereGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class SphereGeometry extends BufferGeometry {
constructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {

super();

this.type = 'SphereGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/TorusGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class TorusGeometry extends BufferGeometry {
constructor( radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2 ) {

super();

this.type = 'TorusGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/TorusKnotGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class TorusKnotGeometry extends BufferGeometry {
constructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {

super();

this.type = 'TorusKnotGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/TubeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TubeGeometry extends BufferGeometry {
constructor( path = new Curves[ 'QuadraticBezierCurve3' ]( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {

super();

this.type = 'TubeGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/geometries/WireframeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class WireframeGeometry extends BufferGeometry {
constructor( geometry = null ) {

super();

this.type = 'WireframeGeometry';

this.parameters = {
Expand Down
1 change: 1 addition & 0 deletions src/helpers/DirectionalLightHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DirectionalLightHelper extends Object3D {
constructor( light, size, color ) {

super();

this.light = light;
this.light.updateMatrixWorld();

Expand Down
1 change: 1 addition & 0 deletions src/helpers/HemisphereLightHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class HemisphereLightHelper extends Object3D {
constructor( light, size, color ) {

super();

this.light = light;
this.light.updateMatrixWorld();

Expand Down
1 change: 1 addition & 0 deletions src/helpers/SpotLightHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SpotLightHelper extends Object3D {
constructor( light, color ) {

super();

this.light = light;
this.light.updateMatrixWorld();

Expand Down
2 changes: 1 addition & 1 deletion src/loaders/LoadingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ class LoadingManager {

}

const DefaultLoadingManager = new LoadingManager();
const DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();

export { DefaultLoadingManager, LoadingManager };