@needle-tools/three 0.145.1 → 0.145.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +36024 -36024
- package/build/three.js +36028 -36028
- package/build/three.min.js +7 -7
- package/build/three.module.js +828 -828
- package/examples/jsm/exporters/USDZExporter.js +30 -11
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandMeshModel.js +5 -3
- package/package.json +1 -1
- package/src/renderers/webgl/WebGLCubeUVMaps.js +1 -1
|
@@ -783,9 +783,14 @@ function buildMesh( geometry ) {
|
|
|
783
783
|
interpolation = "vertex"
|
|
784
784
|
)
|
|
785
785
|
point3f[] points = [${buildVector3Array( attributes.position, count )}]
|
|
786
|
-
|
|
786
|
+
${attributes.uv ?
|
|
787
|
+
`float2[] primvars:st = [${buildVector2Array( attributes.uv, count )}] (
|
|
787
788
|
interpolation = "vertex"
|
|
788
|
-
)
|
|
789
|
+
)` : '' }
|
|
790
|
+
${attributes.uv2 ?
|
|
791
|
+
`float2[] primvars:st2 = [${buildVector2Array( attributes.uv2, count )}] (
|
|
792
|
+
interpolation = "vertex"
|
|
793
|
+
)` : '' }
|
|
789
794
|
uniform token subdivisionScheme = "none"
|
|
790
795
|
}
|
|
791
796
|
`;
|
|
@@ -934,26 +939,31 @@ function buildMaterial( material, textures ) {
|
|
|
934
939
|
}
|
|
935
940
|
|
|
936
941
|
textures[ id ] = texture;
|
|
942
|
+
const uvReader = mapType == 'occlusion' ? 'uvReader_st2' : 'uvReader_st';
|
|
943
|
+
|
|
944
|
+
const needsTextureTransform = ( repeat.x != 1 || repeat.y != 1 || offset.x != 0 || offset.y != 0 );
|
|
945
|
+
const textureTransformInput = `</Materials/Material_${material.id}/${uvReader}.outputs:result>`;
|
|
946
|
+
const textureTransformOutput = `</Materials/Material_${material.id}/Transform2d_${mapType}.outputs:result>`;
|
|
937
947
|
|
|
938
948
|
return `
|
|
939
|
-
def Shader "Transform2d_${mapType}" (
|
|
949
|
+
${needsTextureTransform ? `def Shader "Transform2d_${mapType}" (
|
|
940
950
|
sdrMetadata = {
|
|
941
951
|
string role = "math"
|
|
942
952
|
}
|
|
943
953
|
)
|
|
944
954
|
{
|
|
945
955
|
uniform token info:id = "UsdTransform2d"
|
|
946
|
-
float2 inputs:in.connect =
|
|
956
|
+
float2 inputs:in.connect = ${textureTransformInput}
|
|
947
957
|
float2 inputs:scale = ${buildVector2( repeat )}
|
|
948
958
|
float2 inputs:translation = ${buildVector2( offset )}
|
|
949
959
|
float2 outputs:result
|
|
950
960
|
}
|
|
951
|
-
|
|
952
|
-
|
|
961
|
+
` : '' }
|
|
962
|
+
def Shader "Texture_${texture.id}_${mapType}"
|
|
953
963
|
{
|
|
954
964
|
uniform token info:id = "UsdUVTexture"
|
|
955
965
|
asset inputs:file = @textures/Texture_${id}.${isRGBA ? 'png' : 'jpg'}@
|
|
956
|
-
float2 inputs:st.connect =
|
|
966
|
+
float2 inputs:st.connect = ${needsTextureTransform ? textureTransformOutput : textureTransformInput}
|
|
957
967
|
float4 inputs:scale = (${color ? color.r + ', ' + color.g + ', ' + color.b : '1, 1, 1'}, ${opacity ? opacity : '1'})
|
|
958
968
|
token inputs:wrapS = "${wrapS}"
|
|
959
969
|
token inputs:wrapT = "${wrapT}"
|
|
@@ -966,6 +976,8 @@ function buildMaterial( material, textures ) {
|
|
|
966
976
|
|
|
967
977
|
}
|
|
968
978
|
|
|
979
|
+
const effectiveOpacity = (material.transparent || material.alphaTest) ? material.opacity : 1;
|
|
980
|
+
|
|
969
981
|
if ( material.side === DoubleSide ) {
|
|
970
982
|
|
|
971
983
|
console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
|
|
@@ -987,7 +999,7 @@ function buildMaterial( material, textures ) {
|
|
|
987
999
|
|
|
988
1000
|
}
|
|
989
1001
|
|
|
990
|
-
samplers.push( buildTexture( material.map, 'diffuse', material.color,
|
|
1002
|
+
samplers.push( buildTexture( material.map, 'diffuse', material.color, effectiveOpacity ) );
|
|
991
1003
|
|
|
992
1004
|
} else {
|
|
993
1005
|
|
|
@@ -1056,7 +1068,7 @@ function buildMaterial( material, textures ) {
|
|
|
1056
1068
|
|
|
1057
1069
|
} else {
|
|
1058
1070
|
|
|
1059
|
-
inputs.push( `${pad}float inputs:opacity = ${
|
|
1071
|
+
inputs.push( `${pad}float inputs:opacity = ${effectiveOpacity}` );
|
|
1060
1072
|
|
|
1061
1073
|
}
|
|
1062
1074
|
|
|
@@ -1080,12 +1092,19 @@ ${inputs.join( '\n' )}
|
|
|
1080
1092
|
}
|
|
1081
1093
|
|
|
1082
1094
|
token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>
|
|
1083
|
-
token inputs:frame:stPrimvarName = "st"
|
|
1084
1095
|
|
|
1085
1096
|
def Shader "uvReader_st"
|
|
1086
1097
|
{
|
|
1087
1098
|
uniform token info:id = "UsdPrimvarReader_float2"
|
|
1088
|
-
token inputs:varname
|
|
1099
|
+
token inputs:varname = "st"
|
|
1100
|
+
float2 inputs:fallback = (0.0, 0.0)
|
|
1101
|
+
float2 outputs:result
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
def Shader "uvReader_st2"
|
|
1105
|
+
{
|
|
1106
|
+
uniform token info:id = "UsdPrimvarReader_float2"
|
|
1107
|
+
token inputs:varname = "st2"
|
|
1089
1108
|
float2 inputs:fallback = (0.0, 0.0)
|
|
1090
1109
|
float2 outputs:result
|
|
1091
1110
|
}
|
|
@@ -6,13 +6,14 @@ const POINTING_JOINT = 'index-finger-tip';
|
|
|
6
6
|
|
|
7
7
|
class OculusHandModel extends Object3D {
|
|
8
8
|
|
|
9
|
-
constructor( controller ) {
|
|
9
|
+
constructor( controller, loader ) {
|
|
10
10
|
|
|
11
11
|
super();
|
|
12
12
|
|
|
13
13
|
this.controller = controller;
|
|
14
14
|
this.motionController = null;
|
|
15
15
|
this.envMap = null;
|
|
16
|
+
this.loader = loader;
|
|
16
17
|
|
|
17
18
|
this.mesh = null;
|
|
18
19
|
|
|
@@ -24,7 +25,7 @@ class OculusHandModel extends Object3D {
|
|
|
24
25
|
|
|
25
26
|
this.xrInputSource = xrInputSource;
|
|
26
27
|
|
|
27
|
-
this.motionController = new XRHandMeshModel( this, controller, this.path, xrInputSource.handedness );
|
|
28
|
+
this.motionController = new XRHandMeshModel( this, controller, this.path, xrInputSource.handedness, this.loader );
|
|
28
29
|
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -4,15 +4,17 @@ const DEFAULT_HAND_PROFILE_PATH = 'https://cdn.jsdelivr.net/npm/@webxr-input-pro
|
|
|
4
4
|
|
|
5
5
|
class XRHandMeshModel {
|
|
6
6
|
|
|
7
|
-
constructor( handModel, controller, path, handedness ) {
|
|
7
|
+
constructor( handModel, controller, path, handedness, loader ) {
|
|
8
8
|
|
|
9
9
|
this.controller = controller;
|
|
10
10
|
this.handModel = handModel;
|
|
11
11
|
|
|
12
12
|
this.bones = [];
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if (!loader) {
|
|
15
|
+
loader = new GLTFLoader();
|
|
16
|
+
loader.setPath( DEFAULT_HAND_PROFILE_PATH );
|
|
17
|
+
}
|
|
16
18
|
loader.load( `${handedness}.glb`, gltf => {
|
|
17
19
|
|
|
18
20
|
const object = gltf.scene.children[ 0 ];
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ function WebGLCubeUVMaps( renderer ) {
|
|
|
45
45
|
|
|
46
46
|
if ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
pmremGenerator = new PMREMGenerator( renderer );
|
|
49
49
|
|
|
50
50
|
const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
|
|
51
51
|
cubeUVmaps.set( texture, renderTarget );
|