fix: restore default flipY for uploaded textures, fix main model deletion visibility
Build and Deploy / build-and-push (push) Successful in 44s
Build and Deploy / build-and-push (push) Successful in 44s
This commit is contained in:
@@ -103,7 +103,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;
|
||||
if (mappingType === 'triplanar') activeMat.triplanarUniforms['t' + type.charAt(0).toUpperCase() + type.slice(1).replace('Map', '')].value = tex;
|
||||
@@ -235,11 +235,17 @@ export const ModelViewer = forwardRef<THREE.Group, ModelViewerProps>(({ object,
|
||||
useEffect(() => {
|
||||
if (object && sceneObjects) {
|
||||
const mainModel = sceneObjects.find(obj => obj.type === 'model');
|
||||
if (mainModel && mainModel.transformProps && groupRef.current) {
|
||||
const { position: p, rotation: r, scale: s } = mainModel.transformProps;
|
||||
groupRef.current.position.set(p[0], p[1], p[2]);
|
||||
groupRef.current.rotation.set(r[0], r[1], r[2]);
|
||||
groupRef.current.scale.set(s[0], s[1], s[2]);
|
||||
if (groupRef.current) {
|
||||
if (mainModel && mainModel.transformProps) {
|
||||
const { position: p, rotation: r, scale: s } = mainModel.transformProps;
|
||||
groupRef.current.position.set(p[0], p[1], p[2]);
|
||||
groupRef.current.rotation.set(r[0], r[1], r[2]);
|
||||
groupRef.current.scale.set(s[0], s[1], s[2]);
|
||||
groupRef.current.visible = true;
|
||||
} else if (!mainModel) {
|
||||
// If main model was deleted, hide the entire group
|
||||
groupRef.current.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [object, sceneObjects]);
|
||||
|
||||
Reference in New Issue
Block a user