修复纹理调节项不生效的问题
This commit is contained in:
7
.claude/settings.local.json
Normal file
7
.claude/settings.local.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"mcp__ide__getDiagnostics"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "material-editor",
|
||||
"private": true,
|
||||
"version": "1.0.34",
|
||||
"version": "1.0.35",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -214,7 +214,7 @@ watch(() => props.name, () => {
|
||||
});
|
||||
|
||||
watch(textureAdjustment, async (val) => {
|
||||
scene.UpdateTexture();
|
||||
scene.UpdateTexture(val);
|
||||
}, { deep: true });
|
||||
|
||||
// 监听纹理更新
|
||||
|
||||
@@ -85,15 +85,15 @@ const sceneSetup = () => {
|
||||
|
||||
|
||||
/** 这是自定义材质更新方法,WebCAD库中的TextureTableRecord.TextureUpdate方法在导出的时候被删除了,所以需要自己实现 */
|
||||
function UpdateTexture() {
|
||||
function UpdateTexture(adjustment?: Partial<TextureAdjustment>) {
|
||||
const record = _currTexture.value;
|
||||
const texture = record['texture'] as Texture;
|
||||
texture.wrapS = record.WrapS;
|
||||
texture.wrapT = record.WrapT;
|
||||
texture.wrapS = adjustment?.wrapS ?? record.WrapS;
|
||||
texture.wrapT = adjustment?.wrapT ?? record.WrapT;
|
||||
texture.anisotropy = 16;
|
||||
texture.rotation = record.rotation;
|
||||
texture.repeat.set(record.repeatX, record.repeatY);
|
||||
texture.offset.set(record.moveX, record.moveY);
|
||||
texture.rotation = adjustment?.rotation ?? record.rotation;
|
||||
texture.repeat.set(adjustment?.repeatX ?? record.repeatX, adjustment?.repeatY ?? record.repeatY);
|
||||
texture.offset.set(adjustment?.moveX ?? record.moveX, adjustment?.moveY ?? record.moveY);
|
||||
texture.needsUpdate = true;
|
||||
Update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user