Compare commits
3
Commits
c11e6b52cc
...
b73315791c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b73315791c | ||
|
|
a5126d618a | ||
|
|
9807b9622b |
@@ -58,7 +58,7 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
|
||||
activeMat.triplanarUniforms.uTriplanarScale.value = uvScale;
|
||||
activeMat.triplanarUniforms.uBlendSharpness.value = 5.0; // Default or from props
|
||||
} else {
|
||||
} else if (mappingType !== 'uv') {
|
||||
activeMat = MaterialFactory.getInstance().getStandardUVMaterial(
|
||||
baseParams,
|
||||
mesh.uuid
|
||||
@@ -71,6 +71,9 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
|
||||
activeMat.uvUniforms.uMappingMode.value = modeIndex;
|
||||
activeMat.updateUVTransform(uvOffset, [uvTiling[0] * uvScale, uvTiling[1] * uvScale], uvRotation * (Math.PI / 180));
|
||||
} else {
|
||||
// Use the native material to preserve exact GLTF UV behavior
|
||||
activeMat = origMat;
|
||||
}
|
||||
|
||||
// Apply basic props
|
||||
@@ -103,6 +106,7 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
tex.name = url;
|
||||
if (type === 'map') tex.colorSpace = THREE.SRGBColorSpace;
|
||||
tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
|
||||
tex.flipY = false;
|
||||
|
||||
textureCache.current.set(url, tex);
|
||||
activeMat[type] = tex;
|
||||
@@ -116,6 +120,14 @@ const MeshMaterialManager = ({ mesh, sceneObj, textureCache }: MeshMaterialManag
|
||||
if (mappingType === 'triplanar') activeMat.triplanarUniforms['t' + type.charAt(0).toUpperCase() + type.slice(1).replace('Map', '')].value = null;
|
||||
activeMat.needsUpdate = true;
|
||||
}
|
||||
|
||||
// Native UV mapping transforms
|
||||
if (mappingType === 'uv' && activeMat[type]) {
|
||||
activeMat[type].repeat.set(uvTiling[0] * uvScale, uvTiling[1] * uvScale);
|
||||
activeMat[type].offset.set(uvOffset[0], uvOffset[1]);
|
||||
activeMat[type].rotation = uvRotation * (Math.PI / 180);
|
||||
activeMat[type].needsUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
mesh.visible = sceneObj.visible;
|
||||
|
||||
@@ -5232,11 +5232,12 @@ export default function Editor() {
|
||||
}
|
||||
});
|
||||
|
||||
// Save model data for scene persistence
|
||||
const modelBlob = await fetch(modelUrl).then(r => r.blob());
|
||||
const blobUrl = URL.createObjectURL(modelBlob);
|
||||
setBlobURLs(prev => [...prev, blobUrl]);
|
||||
setModelData({ name: "Generated_Model.glb", data: blobUrl, extension: 'glb' });
|
||||
setImportStatus("Uploading to cloud storage... 0%");
|
||||
const cloudUrl = await uploadAssetToStorage(modelBlob, 'assets', `models/${user?.id || 'guest'}_${Date.now()}_Generated_Model.glb`, (prog) => {
|
||||
setImportStatus(`Uploading to cloud storage... ${prog}%`);
|
||||
});
|
||||
setModelData({ name: "Generated_Model.glb", data: cloudUrl, extension: 'glb' });
|
||||
|
||||
const boundingBox = new THREE.Box3().setFromObject(object);
|
||||
const center = new THREE.Vector3();
|
||||
@@ -5290,7 +5291,6 @@ export default function Editor() {
|
||||
}
|
||||
|
||||
setLoadedModel(object);
|
||||
setBlobURLs(prev => [...prev, modelUrl]);
|
||||
setSceneObjects(prev => [
|
||||
...prev.filter(obj => obj.type !== 'cube'),
|
||||
...newSceneObjects
|
||||
|
||||
Reference in New Issue
Block a user