Skip to content

Commit 0783e2b

Browse files
committed
Updated examples builds.
1 parent b7af3d1 commit 0783e2b

File tree

17 files changed

+419
-789
lines changed

17 files changed

+419
-789
lines changed

examples/js/animation/CCDIKSolver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
*/
186186
createHelper() {
187187

188-
return new CCDIKHelper( this.mesh, this.mesh.geometry.userData.MMD.iks );
188+
return new CCDIKHelper( this.mesh, this.iks );
189189

190190
}
191191

examples/js/controls/OrbitControls.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,19 +549,55 @@
549549
switch ( event.code ) {
550550

551551
case scope.keys.UP:
552-
pan( 0, scope.keyPanSpeed );
552+
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
553+
554+
rotateUp( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
555+
556+
} else {
557+
558+
pan( 0, scope.keyPanSpeed );
559+
560+
}
561+
553562
needsUpdate = true;
554563
break;
555564
case scope.keys.BOTTOM:
556-
pan( 0, - scope.keyPanSpeed );
565+
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
566+
567+
rotateUp( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
568+
569+
} else {
570+
571+
pan( 0, - scope.keyPanSpeed );
572+
573+
}
574+
557575
needsUpdate = true;
558576
break;
559577
case scope.keys.LEFT:
560-
pan( scope.keyPanSpeed, 0 );
578+
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
579+
580+
rotateLeft( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
581+
582+
} else {
583+
584+
pan( scope.keyPanSpeed, 0 );
585+
586+
}
587+
561588
needsUpdate = true;
562589
break;
563590
case scope.keys.RIGHT:
564-
pan( - scope.keyPanSpeed, 0 );
591+
if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
592+
593+
rotateLeft( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
594+
595+
} else {
596+
597+
pan( - scope.keyPanSpeed, 0 );
598+
599+
}
600+
565601
needsUpdate = true;
566602
break;
567603

examples/js/exporters/GLTFExporter.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414

1515
return new GLTFMaterialsUnlitExtension( writer );
1616

17-
} );
18-
this.register( function ( writer ) {
19-
20-
return new GLTFMaterialsPBRSpecularGlossiness( writer );
21-
2217
} );
2318
this.register( function ( writer ) {
2419

@@ -2011,59 +2006,6 @@
20112006

20122007
}
20132008

2014-
/**
2015-
* Specular-Glossiness Extension
2016-
*
2017-
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
2018-
*/
2019-
class GLTFMaterialsPBRSpecularGlossiness {
2020-
2021-
constructor( writer ) {
2022-
2023-
this.writer = writer;
2024-
this.name = 'KHR_materials_pbrSpecularGlossiness';
2025-
2026-
}
2027-
writeMaterial( material, materialDef ) {
2028-
2029-
if ( ! material.isGLTFSpecularGlossinessMaterial ) return;
2030-
const writer = this.writer;
2031-
const extensionsUsed = writer.extensionsUsed;
2032-
const extensionDef = {};
2033-
if ( materialDef.pbrMetallicRoughness.baseColorFactor ) {
2034-
2035-
extensionDef.diffuseFactor = materialDef.pbrMetallicRoughness.baseColorFactor;
2036-
2037-
}
2038-
2039-
const specularFactor = [ 1, 1, 1 ];
2040-
material.specular.toArray( specularFactor, 0 );
2041-
extensionDef.specularFactor = specularFactor;
2042-
extensionDef.glossinessFactor = material.glossiness;
2043-
if ( materialDef.pbrMetallicRoughness.baseColorTexture ) {
2044-
2045-
extensionDef.diffuseTexture = materialDef.pbrMetallicRoughness.baseColorTexture;
2046-
2047-
}
2048-
2049-
if ( material.specularMap ) {
2050-
2051-
const specularMapDef = {
2052-
index: writer.processTexture( material.specularMap )
2053-
};
2054-
writer.applyTextureTransform( specularMapDef, material.specularMap );
2055-
extensionDef.specularGlossinessTexture = specularMapDef;
2056-
2057-
}
2058-
2059-
materialDef.extensions = materialDef.extensions || {};
2060-
materialDef.extensions[ this.name ] = extensionDef;
2061-
extensionsUsed[ this.name ] = true;
2062-
2063-
}
2064-
2065-
}
2066-
20672009
/**
20682010
* Clearcoat Materials Extension
20692011
*

examples/js/exporters/USDZExporter.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
type: 'plane'
99
},
1010
planeAnchoring: {
11-
alignment: 'vertical'
11+
alignment: 'horizontal'
1212
}
1313
}
1414
} ) {
@@ -574,9 +574,9 @@ ${samplers.join( '\n' )}
574574
matrix4d xformOp:transform = ${transform}
575575
uniform token[] xformOpOrder = ["xformOp:transform"]
576576
577-
float2 clippingRange = (${camera.near}, ${camera.far})
578-
float horizontalAperture = ${( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10}
579-
float verticalAperture = ${( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10}
577+
float2 clippingRange = (${camera.near.toPrecision( PRECISION )}, ${camera.far.toPrecision( PRECISION )})
578+
float horizontalAperture = ${( ( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10 ).toPrecision( PRECISION )}
579+
float verticalAperture = ${( ( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10 ).toPrecision( PRECISION )}
580580
token projection = "orthographic"
581581
}
582582
@@ -589,12 +589,12 @@ ${samplers.join( '\n' )}
589589
matrix4d xformOp:transform = ${transform}
590590
uniform token[] xformOpOrder = ["xformOp:transform"]
591591
592-
float2 clippingRange = (${camera.near}, ${camera.far})
593-
float focalLength = ${camera.getFocalLength()}
594-
float focusDistance = ${camera.focus}
595-
float horizontalAperture = ${camera.getFilmWidth()}
592+
float2 clippingRange = (${camera.near.toPrecision( PRECISION )}, ${camera.far.toPrecision( PRECISION )})
593+
float focalLength = ${camera.getFocalLength().toPrecision( PRECISION )}
594+
float focusDistance = ${camera.focus.toPrecision( PRECISION )}
595+
float horizontalAperture = ${camera.getFilmWidth().toPrecision( PRECISION )}
596596
token projection = "perspective"
597-
float verticalAperture = ${camera.getFilmHeight()}
597+
float verticalAperture = ${camera.getFilmHeight().toPrecision( PRECISION )}
598598
}
599599
600600
`;

examples/js/lines/LineSegments2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333

3434
function raycastWorldUnits( lineSegments, intersects ) {
3535

36+
const matrixWorld = lineSegments.matrixWorld;
3637
for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) {
3738

3839
_line.start.fromBufferAttribute( _instanceStart, i );
3940
_line.end.fromBufferAttribute( _instanceEnd, i );
41+
_line.applyMatrix4( matrixWorld );
4042
const pointOnLine = new THREE.Vector3();
4143
const point = new THREE.Vector3();
4244
_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );

examples/js/loaders/ColladaLoader.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,33 @@
33583358

33593359
}
33603360

3361+
// Collada allows to use phong and lambert materials with lines. Replacing these cases with THREE.LineBasicMaterial.
3362+
3363+
if ( type === 'lines' || type === 'linestrips' ) {
3364+
3365+
for ( let i = 0, l = materials.length; i < l; i ++ ) {
3366+
3367+
const material = materials[ i ];
3368+
if ( material.isMeshPhongMaterial === true || material.isMeshLambertMaterial === true ) {
3369+
3370+
const lineMaterial = new THREE.LineBasicMaterial();
3371+
3372+
// copy compatible properties
3373+
3374+
lineMaterial.color.copy( material.color );
3375+
lineMaterial.opacity = material.opacity;
3376+
lineMaterial.transparent = material.transparent;
3377+
3378+
// replace material
3379+
3380+
materials[ i ] = lineMaterial;
3381+
3382+
}
3383+
3384+
}
3385+
3386+
}
3387+
33613388
// regard skinning
33623389

33633390
const skinning = geometry.data.attributes.skinIndex !== undefined;

examples/js/loaders/FBXLoader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,7 @@
17061706
faceLength ++;
17071707
if ( endOfFace ) {
17081708

1709+
if ( faceLength > 4 ) console.warn( 'THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export.' );
17091710
scope.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
17101711
polygonIndex ++;
17111712
faceLength = 0;

0 commit comments

Comments
 (0)