@@ -13,6 +13,7 @@
|
|
13
13
|
import { ActionBuilder, ActionModel, AuralMode, BehaviorModel, IBehaviorElement, MotionType, PlayAction, Space, TriggerBuilder } from "./BehavioursBuilder.js";
|
14
14
|
import { AudioSource } from "../../../../AudioSource.js";
|
15
15
|
import { NEEDLE_progressive } from "../../../../../engine/extensions/NEEDLE_progressive.js";
|
16
|
+
import { isDevEnvironment } from "../../../../../engine/debug/index.js";
|
16
17
|
|
17
18
|
export class ChangeTransformOnClick extends Behaviour implements IPointerClickHandler, UsdzBehaviour {
|
18
19
|
|
@@ -601,6 +602,10 @@
|
|
601
602
|
if (this.target && this.animator) {
|
602
603
|
|
603
604
|
const state = this.animator?.runtimeAnimatorController?.findState(this.stateName);
|
605
|
+
if (!state?.motion?.clip) {
|
606
|
+
if (isDevEnvironment()) console.warn("No clip found for state " + this.stateName);
|
607
|
+
return;
|
608
|
+
}
|
604
609
|
this.stateAnimationModel = model;
|
605
610
|
this.stateAnimation = ext.registerAnimation(this.target, state?.motion.clip);
|
606
611
|
|
@@ -272,7 +272,7 @@
|
|
272
272
|
return `#usda 1.0
|
273
273
|
(
|
274
274
|
customLayerData = {
|
275
|
-
string creator = "
|
275
|
+
string creator = "Needle Engine USDZExporter"
|
276
276
|
}
|
277
277
|
defaultPrim = "${makeNameSafe( this.name )}"
|
278
278
|
metersPerUnit = 1
|
@@ -1135,10 +1135,18 @@
|
|
1135
1135
|
function buildTexture( texture, mapType, color: Color | undefined = undefined, opacity: number | undefined = undefined ) {
|
1136
1136
|
|
1137
1137
|
const id = texture.id + ( color ? '_' + color.getHexString() : '' ) + ( opacity ? '_' + opacity : '' );
|
1138
|
+
|
1139
|
+
textures[ id ] = texture;
|
1140
|
+
|
1141
|
+
const uv = texture.channel > 0 ? 'st' + texture.channel : 'st';
|
1142
|
+
|
1138
1143
|
const isRGBA = texture.format === 1023;
|
1139
1144
|
|
1140
|
-
const
|
1141
|
-
|
1145
|
+
const WRAPPINGS = {
|
1146
|
+
1000: 'repeat', // RepeatWrapping
|
1147
|
+
1001: 'clamp', // ClampToEdgeWrapping
|
1148
|
+
1002: 'mirror' // MirroredRepeatWrapping
|
1149
|
+
};
|
1142
1150
|
|
1143
1151
|
const repeat = texture.repeat.clone();
|
1144
1152
|
const offset = texture.offset.clone();
|
@@ -1173,14 +1181,10 @@
|
|
1173
1181
|
|
1174
1182
|
}
|
1175
1183
|
|
1176
|
-
textures[ id ] = texture;
|
1177
|
-
const uvReader = mapType == 'occlusion' ? 'uvReader_st2' : 'uvReader_st';
|
1178
|
-
|
1179
1184
|
const needsTextureTransform = ( repeat.x != 1 || repeat.y != 1 || offset.x != 0 || offset.y != 0 || rotation != 0 );
|
1180
|
-
const textureTransformInput = `</Materials/Material_${material.id}/${
|
1181
|
-
const
|
1185
|
+
const textureTransformInput = `</Materials/Material_${material.id}/${'uvReader_' + uv}.outputs:result>`; const textureTransformOutput = `</Materials/Material_${material.id}/Transform2d_${mapType}.outputs:result>`;
|
1186
|
+
const needsTextureScale = mapType !== 'normal' && (color && (color.r !== 1 || color.g !== 1 || color.b !== 1 || opacity !== 1)) || false;
|
1182
1187
|
|
1183
|
-
const needsTextureScale = mapType !== 'normal' && (color && (color.r !== 1 || color.g !== 1 || color.b !== 1 || opacity !== 1)) || false;
|
1184
1188
|
const needsNormalScaleAndBias = mapType === 'normal';
|
1185
1189
|
const normalScale = material instanceof MeshStandardMaterial ? (material.normalScale ? material.normalScale.x * 2 : 2) : 2;
|
1186
1190
|
const normalScaleValueString = normalScale.toFixed( PRECISION );
|
@@ -1214,8 +1218,8 @@
|
|
1214
1218
|
float4 inputs:scale = (${normalScaleValueString}, ${normalScaleValueString}, ${normalScaleValueString}, 1)
|
1215
1219
|
float4 inputs:bias = (${normalBiasString}, ${normalBiasString}, ${normalBiasString}, 0)
|
1216
1220
|
` : `` }
|
1217
|
-
|
1218
|
-
|
1221
|
+
token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
|
1222
|
+
token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
|
1219
1223
|
float outputs:r
|
1220
1224
|
float outputs:g
|
1221
1225
|
float outputs:b
|