diff --git a/web/js/materialx.js b/web/js/materialx.js index 28c5675e..4153ac51 100644 --- a/web/js/materialx.js +++ b/web/js/materialx.js @@ -1568,8 +1568,7 @@ async function loadDefaultScene() { } async function loadDefaultUSDFile() { - //const defaultFile = './assets/fancy-teapot-mtlx.usdz'; - const defaultFile = './assets/NormalsTextureBiasAndScale.usdz'; + const defaultFile = './assets/fancy-teapot-mtlx.usdz'; updateStatus(`Loading ${defaultFile}...`); try { const response = await fetch(defaultFile); @@ -1979,6 +1978,7 @@ async function convertMaterial(matData, index) { let material; if (useOpenPBRMaterial) { + console.log("use OpenPBRMaterial"); // Create OpenPBRMaterial directly (Loaded version waits for textures) material = await convertToOpenPBRMaterialLoaded(matData, loaderState.nativeLoader); material.envMap = threeState.envMap; @@ -2332,6 +2332,7 @@ async function convertToOpenPBRMaterialLoaded(matData, nativeLoader = null) { scale: extractOpenPBRValue(geometrySection.normal_map_scale || openPBR.normal_map_scale, 1.0) }; + return material; } diff --git a/web/js/src/tinyusdz/TinyUSDZLoaderUtils.js b/web/js/src/tinyusdz/TinyUSDZLoaderUtils.js index 499bd3cc..7c742562 100644 --- a/web/js/src/tinyusdz/TinyUSDZLoaderUtils.js +++ b/web/js/src/tinyusdz/TinyUSDZLoaderUtils.js @@ -771,7 +771,7 @@ class TinyUSDZLoaderUtils extends LoaderUtils { } try { - // Use the TinyUSDZMaterialX converter (Loaded version waits for textures) + // Use the TinyUSDZMaterialX converter (Loaded version waits for textures(if textureLoadingManager is null)) const material = await convertOpenPBRToMeshPhysicalMaterialLoaded(parsedMaterial, usdScene, { envMap: options.envMap || null, envMapIntensity: options.envMapIntensity || 1.0, diff --git a/web/js/usdlux.html b/web/js/usdlux.html index b7bc27b7..e0cc37f1 100644 --- a/web/js/usdlux.html +++ b/web/js/usdlux.html @@ -941,6 +941,23 @@

Light Properties

No light selected
+ +
+
+ + + + +
+
@@ -1208,7 +1225,8 @@ Controls:
Left-click + drag: Rotate
Right-click + drag: Pan
- Scroll: Zoom + Scroll: Zoom
+ Transform: W/E/R/T
@@ -1691,6 +1709,27 @@ } }); + // Transform mode UI handler + window.setLightTransformModeUI = function(mode) { + // Update button states + document.getElementById('light-mode-pos').classList.toggle('active', mode === 'translate'); + document.getElementById('light-mode-rot').classList.toggle('active', mode === 'rotate'); + document.getElementById('light-mode-scale').classList.toggle('active', mode === 'scale'); + document.getElementById('light-mode-target').classList.toggle('active', mode === 'target'); + // Call the actual mode setter + if (window.setLightTransformMode) { + window.setLightTransformMode(mode); + } + }; + + // Update transform mode UI from keyboard shortcuts + window.updateLightTransformModeUI = function(mode) { + document.getElementById('light-mode-pos').classList.toggle('active', mode === 'translate'); + document.getElementById('light-mode-rot').classList.toggle('active', mode === 'rotate'); + document.getElementById('light-mode-scale').classList.toggle('active', mode === 'scale'); + document.getElementById('light-mode-target').classList.toggle('active', mode === 'target'); + }; + // Callback to show/hide light properties panel and update values window.showLightProperties = function(lightData) { const panel = document.getElementById('light-properties'); @@ -1765,6 +1804,17 @@ } else { shapingSection.classList.remove('visible'); } + + // Show/hide Target button (only for SpotLights and DirectionalLights) + const targetBtn = document.getElementById('light-mode-target'); + const hasTarget = hasShaping || lightType === 'distant'; + targetBtn.style.display = hasTarget ? 'inline-block' : 'none'; + + // Reset transform mode UI to translate (default) + document.getElementById('light-mode-pos').classList.add('active'); + document.getElementById('light-mode-rot').classList.remove('active'); + document.getElementById('light-mode-scale').classList.remove('active'); + document.getElementById('light-mode-target').classList.remove('active'); }; // Hide light properties when no light selected