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
177 changes: 71 additions & 106 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11677,6 +11677,16 @@ class Matrix4 {
*/
extractBasis( xAxis, yAxis, zAxis ) {

if ( this.determinant() === 0 ) {

xAxis.set( 1, 0, 0 );
yAxis.set( 0, 1, 0 );
zAxis.set( 0, 0, 1 );

return this;

}

xAxis.setFromMatrixColumn( this, 0 );
yAxis.setFromMatrixColumn( this, 1 );
zAxis.setFromMatrixColumn( this, 2 );
Expand Down Expand Up @@ -11717,6 +11727,12 @@ class Matrix4 {
*/
extractRotation( m ) {

if ( m.determinant() === 0 ) {

return this.identity();

}

const te = this.elements;
const me = m.elements;

Expand Down Expand Up @@ -12469,6 +12485,19 @@ class Matrix4 {

const te = this.elements;

position.x = te[ 12 ];
position.y = te[ 13 ];
position.z = te[ 14 ];

if ( this.determinant() === 0 ) {

scale.set( 1, 1, 1 );
quaternion.identity();

return this;

}

let sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
const sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
const sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
Expand All @@ -12477,10 +12506,6 @@ class Matrix4 {
const det = this.determinant();
if ( det < 0 ) sx = - sx;

position.x = te[ 12 ];
position.y = te[ 13 ];
position.z = te[ 14 ];

// scale the rotation part
_m1$4.copy( this );

Expand Down Expand Up @@ -64934,43 +64959,24 @@ function getTexelEncodingFunction( functionName, colorSpace ) {

}

function getToneMappingFunction( functionName, toneMapping ) {

let toneMappingName;

switch ( toneMapping ) {

case LinearToneMapping:
toneMappingName = 'Linear';
break;

case ReinhardToneMapping:
toneMappingName = 'Reinhard';
break;

case CineonToneMapping:
toneMappingName = 'Cineon';
break;

case ACESFilmicToneMapping:
toneMappingName = 'ACESFilmic';
break;
const toneMappingFunctions = {
[ LinearToneMapping ]: 'Linear',
[ ReinhardToneMapping ]: 'Reinhard',
[ CineonToneMapping ]: 'Cineon',
[ ACESFilmicToneMapping ]: 'ACESFilmic',
[ AgXToneMapping ]: 'AgX',
[ NeutralToneMapping ]: 'Neutral',
[ CustomToneMapping ]: 'Custom'
};

case AgXToneMapping:
toneMappingName = 'AgX';
break;
function getToneMappingFunction( functionName, toneMapping ) {

case NeutralToneMapping:
toneMappingName = 'Neutral';
break;
const toneMappingName = toneMappingFunctions[ toneMapping ];

case CustomToneMapping:
toneMappingName = 'Custom';
break;
if ( toneMappingName === undefined ) {

default:
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
toneMappingName = 'Linear';
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
return 'vec3 ' + functionName + '( vec3 color ) { return LinearToneMapping( color ); }';

}

Expand Down Expand Up @@ -65198,95 +65204,54 @@ function generatePrecision( parameters ) {

}

function generateShadowMapTypeDefine( parameters ) {

let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';

if ( parameters.shadowMapType === PCFShadowMap ) {

shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';

} else if ( parameters.shadowMapType === VSMShadowMap ) {

shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';
const shadowMapTypeDefines = {
[ PCFShadowMap ]: 'SHADOWMAP_TYPE_PCF',
[ VSMShadowMap ]: 'SHADOWMAP_TYPE_VSM'
};

}
function generateShadowMapTypeDefine( parameters ) {

return shadowMapTypeDefine;
return shadowMapTypeDefines[ parameters.shadowMapType ] || 'SHADOWMAP_TYPE_BASIC';

}

function generateEnvMapTypeDefine( parameters ) {

let envMapTypeDefine = 'ENVMAP_TYPE_CUBE';

if ( parameters.envMap ) {

switch ( parameters.envMapMode ) {

case CubeReflectionMapping:
case CubeRefractionMapping:
envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
break;
const envMapTypeDefines = {
[ CubeReflectionMapping ]: 'ENVMAP_TYPE_CUBE',
[ CubeRefractionMapping ]: 'ENVMAP_TYPE_CUBE',
[ CubeUVReflectionMapping ]: 'ENVMAP_TYPE_CUBE_UV'
};

case CubeUVReflectionMapping:
envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';
break;
function generateEnvMapTypeDefine( parameters ) {

}
if ( parameters.envMap === false ) return 'ENVMAP_TYPE_CUBE';

}

return envMapTypeDefine;
return envMapTypeDefines[ parameters.envMapMode ] || 'ENVMAP_TYPE_CUBE';

}

function generateEnvMapModeDefine( parameters ) {

let envMapModeDefine = 'ENVMAP_MODE_REFLECTION';

if ( parameters.envMap ) {

switch ( parameters.envMapMode ) {

case CubeRefractionMapping:
const envMapModeDefines = {
[ CubeRefractionMapping ]: 'ENVMAP_MODE_REFRACTION'
};

envMapModeDefine = 'ENVMAP_MODE_REFRACTION';
break;
function generateEnvMapModeDefine( parameters ) {

}
if ( parameters.envMap === false ) return 'ENVMAP_MODE_REFLECTION';

}

return envMapModeDefine;
return envMapModeDefines[ parameters.envMapMode ] || 'ENVMAP_MODE_REFLECTION';

}

function generateEnvMapBlendingDefine( parameters ) {

let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';

if ( parameters.envMap ) {

switch ( parameters.combine ) {

case MultiplyOperation:
envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';
break;

case MixOperation:
envMapBlendingDefine = 'ENVMAP_BLENDING_MIX';
break;

case AddOperation:
envMapBlendingDefine = 'ENVMAP_BLENDING_ADD';
break;
const envMapBlendingDefines = {
[ MultiplyOperation ]: 'ENVMAP_BLENDING_MULTIPLY',
[ MixOperation ]: 'ENVMAP_BLENDING_MIX',
[ AddOperation ]: 'ENVMAP_BLENDING_ADD'
};

}
function generateEnvMapBlendingDefine( parameters ) {

}
if ( parameters.envMap === false ) return 'ENVMAP_BLENDING_NONE';

return envMapBlendingDefine;
return envMapBlendingDefines[ parameters.combine ] || 'ENVMAP_BLENDING_NONE';

}

Expand Down
33 changes: 29 additions & 4 deletions build/three.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -11675,6 +11675,16 @@ class Matrix4 {
*/
extractBasis( xAxis, yAxis, zAxis ) {

if ( this.determinant() === 0 ) {

xAxis.set( 1, 0, 0 );
yAxis.set( 0, 1, 0 );
zAxis.set( 0, 0, 1 );

return this;

}

xAxis.setFromMatrixColumn( this, 0 );
yAxis.setFromMatrixColumn( this, 1 );
zAxis.setFromMatrixColumn( this, 2 );
Expand Down Expand Up @@ -11715,6 +11725,12 @@ class Matrix4 {
*/
extractRotation( m ) {

if ( m.determinant() === 0 ) {

return this.identity();

}

const te = this.elements;
const me = m.elements;

Expand Down Expand Up @@ -12467,6 +12483,19 @@ class Matrix4 {

const te = this.elements;

position.x = te[ 12 ];
position.y = te[ 13 ];
position.z = te[ 14 ];

if ( this.determinant() === 0 ) {

scale.set( 1, 1, 1 );
quaternion.identity();

return this;

}

let sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
const sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
const sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
Expand All @@ -12475,10 +12504,6 @@ class Matrix4 {
const det = this.determinant();
if ( det < 0 ) sx = - sx;

position.x = te[ 12 ];
position.y = te[ 13 ];
position.z = te[ 14 ];

// scale the rotation part
_m1$2.copy( this );

Expand Down
2 changes: 1 addition & 1 deletion build/three.core.min.js

Large diffs are not rendered by default.

Loading
Loading