star_mod_renderer
Advanced tools
Comparing version 1.0.80 to 1.0.81
@@ -0,0 +0,0 @@ import * as THREE from 'star_mod_custom_three'; |
@@ -272,3 +272,3 @@ import * as THREE from 'star_mod_custom_three'; | ||
fbx: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1699612998_M_CSZ_head_01.FBX', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719234260_M_CSZ_head_01.FBX', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1700729308_男性头部模型.FBX' | ||
@@ -289,7 +289,7 @@ }, | ||
male: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1701932914_男性默认站立.FBX', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719319758_Male_FashionShow_Stand.FBX', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1701933185_男性默认站立.FBX' | ||
}, | ||
female: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1701932961_女性默认站立.FBX', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719320570_Female_FashionShow_Stand.FBX', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1701933200_女性默认站立.FBX' | ||
@@ -392,11 +392,11 @@ }, | ||
dTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686908999_M_body_01_D.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719240845_M_body_01_D.png', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1700807104_男性身体贴图_D.png' | ||
}, | ||
nTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686909039_M_body_01_N.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719240862_M_body_01_N.png', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1700807113_男性身体贴图_N.png' | ||
}, | ||
srmTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686909553_M_body_01_g.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719240874_M_body_01_g.png', | ||
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1700807124_男性身体贴图_G.png' | ||
@@ -545,11 +545,11 @@ }, | ||
dTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457456_M_face_D.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719235257_M_face_01_D.png', | ||
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1701682297_1688457456_M_face_D.png' | ||
}, | ||
nTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457484_M_face_N.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719240169_M_face_01_N.png', | ||
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1701682315_1688457484_M_face_N.png' | ||
}, | ||
srmTGA: { | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457499_M_face_SRMA.png', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1719240189_M_face_01_g.png', | ||
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1701682337_1688457499_M_face_SRMA.png' | ||
@@ -573,3 +573,3 @@ }, | ||
sheen: 0.2, | ||
sheenColor: 0xfff2ca, | ||
sheenColor: 0xffffff, | ||
} | ||
@@ -576,0 +576,0 @@ }, |
import { FBXLoader } from "./FBXLoader"; | ||
import { TGALoader } from "./TGALoader"; | ||
import { | ||
calculateVerticesAndFace, | ||
getModelSize | ||
} from "../calculate"; | ||
import { calculateVerticesAndFace, getModelSize } from "../calculate"; | ||
import { getSceneCoordinateByModel } from "../parser"; | ||
@@ -14,5 +11,14 @@ // import { loadFile } from '../filesHelper'; | ||
// isFashionBody | ||
} from '../../default' | ||
export async function detectFile(key, file, detectRule) { | ||
} from "../../default"; | ||
import store from "@/store"; | ||
let limitWidth, limitHeight; | ||
export async function detectFile(key, file, detectRule, type) { | ||
const mapResolution = store.state.goodManage.mapResolution; | ||
limitWidth = 1024; | ||
limitHeight = 1024; | ||
if (mapResolution && type === 1) { | ||
const data = mapResolution.split("*"); | ||
limitWidth = data[0]; | ||
limitHeight = data[1]; | ||
} | ||
if (detectRule && detectRule.isDetectFashion) { | ||
@@ -26,3 +32,2 @@ return await detectFBXFashionFile(file, detectRule); | ||
if (key === "staticMesh") { | ||
@@ -98,3 +103,3 @@ return await detectStaticMeshFile(file, detectRule); | ||
message: "最大面数限制:", | ||
message2: maxFace | ||
message2: maxFace, | ||
}; | ||
@@ -107,12 +112,5 @@ } | ||
message: "最大顶点数限制:", | ||
message2: maxVertices | ||
message2: maxVertices, | ||
}; | ||
} | ||
if (maxSize && maxSize.x > 0 && (size.x > maxSize.x || size.y > maxSize.y || size.z > maxSize.z)) { | ||
return { | ||
value: false, | ||
message: "最大尺寸限制", | ||
message2: `${maxSize.x}*${maxSize.y}*${maxSize.z}` | ||
}; | ||
} | ||
@@ -122,4 +120,14 @@ // 坐标系验证: 兼容两种模式: 1. +z up -y front +x coord 2. +y up +z front +x coord | ||
if ( | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 1 && coordinate.front.sign === -1 && coordinate.up.value === 2 && coordinate.up.sign === 1) || | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 2 && coordinate.front.sign === 1 && coordinate.up.value === 1 && coordinate.up.sign === 1) | ||
(coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 1 && | ||
coordinate.front.sign === -1 && | ||
coordinate.up.value === 2 && | ||
coordinate.up.sign === 1) || | ||
(coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 2 && | ||
coordinate.front.sign === 1 && | ||
coordinate.up.value === 1 && | ||
coordinate.up.sign === 1) | ||
) { | ||
@@ -131,6 +139,49 @@ flagCoord = true; | ||
value: false, | ||
message: "模型坐标系不正确, 请重新导出, 注意使用 +Y +Z 作为 up 轴, 并确保 front 轴为 +Z、-Z、-Y、+Y", | ||
message: | ||
"模型坐标系不正确, 请重新导出, 注意使用 +Y +Z 作为 up 轴, 并确保 front 轴为 +Z、-Z、-Y、+Y", | ||
}; | ||
} | ||
if ( | ||
coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 1 && | ||
coordinate.front.sign === -1 && | ||
coordinate.up.value === 2 && | ||
coordinate.up.sign === 1 | ||
) { | ||
if ( | ||
maxSize && | ||
maxSize.x > 0 && | ||
(size.x > maxSize.x || size.y > maxSize.y || size.z > maxSize.z) | ||
) { | ||
return { | ||
value: false, | ||
message: "最大尺寸限制", | ||
message2: `${maxSize.x}*${maxSize.y}*${maxSize.z}`, | ||
}; | ||
} | ||
} | ||
if ( | ||
coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 2 && | ||
coordinate.front.sign === 1 && | ||
coordinate.up.value === 1 && | ||
coordinate.up.sign === 1 | ||
) { | ||
if ( | ||
maxSize && | ||
maxSize.x > 0 && | ||
(size.x > maxSize.x || size.y > maxSize.z || size.z > maxSize.y) | ||
) { | ||
return { | ||
value: false, | ||
message: "最大尺寸限制", | ||
message2: `${maxSize.x}*${maxSize.y}*${maxSize.z}`, | ||
}; | ||
} | ||
} | ||
// 碰撞前缀验证 | ||
@@ -214,4 +265,14 @@ if (Array.isArray(model.children) && model.children.length > 1) { | ||
if ( | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 1 && coordinate.front.sign === -1 && coordinate.up.value === 2 && coordinate.up.sign === 1) || | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 2 && coordinate.front.sign === 1 && coordinate.up.value === 1 && coordinate.up.sign === 1) | ||
(coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 1 && | ||
coordinate.front.sign === -1 && | ||
coordinate.up.value === 2 && | ||
coordinate.up.sign === 1) || | ||
(coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 2 && | ||
coordinate.front.sign === 1 && | ||
coordinate.up.value === 1 && | ||
coordinate.up.sign === 1) | ||
) { | ||
@@ -223,3 +284,4 @@ flagCoord = true; | ||
value: false, | ||
message: "模型坐标系不正确, 请重新导出, 注意使用 +Y +Z 作为 up 轴, 并确保 front 轴为 +Z、-Z、-Y、+Y", | ||
message: | ||
"模型坐标系不正确, 请重新导出, 注意使用 +Y +Z 作为 up 轴, 并确保 front 轴为 +Z、-Z、-Y、+Y", | ||
}; | ||
@@ -271,3 +333,7 @@ } | ||
const res = file.name.split("."); | ||
if (res[res.length - 1].toLowerCase() !== "tga" && res[res.length - 1].toLowerCase() !== "png" && res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "tga" && | ||
res[res.length - 1].toLowerCase() !== "png" && | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
return { | ||
@@ -280,31 +346,34 @@ value: false, | ||
if (res[res.length - 1].toLowerCase() === "tga") { | ||
// 加载文件 | ||
const loader = new TGALoader(); | ||
// 加载文件 | ||
const loader = new TGALoader(); | ||
// TODO: 移植 tga parse,明晰错误信息 | ||
try { | ||
const tga = loader.parse(await file.arrayBuffer()); | ||
const width = tga.width; | ||
const height = tga.height; | ||
// TODO: 移植 tga parse,明晰错误信息 | ||
try { | ||
const tga = loader.parse(await file.arrayBuffer()); | ||
const width = tga.width; | ||
const height = tga.height; | ||
if (width > 1024 || height > 1024) { | ||
return { | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
}; | ||
} | ||
if (width > limitWidth || height > limitWidth) { | ||
return { | ||
value: true, | ||
data: tga, | ||
}; | ||
} catch { | ||
return { | ||
value: false, | ||
message: "纹理文件解析错误,请检查TGA文件", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}; | ||
} | ||
return { | ||
value: true, | ||
data: tga, | ||
}; | ||
} catch { | ||
return { | ||
value: false, | ||
message: "纹理文件解析错误,请检查TGA文件", | ||
}; | ||
} | ||
} | ||
if (res[res.length - 1].toLowerCase() !== "png" || res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "png" || | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
const image = new Image(); | ||
@@ -314,6 +383,6 @@ image.src = URL.createObjectURL(file); | ||
image.onload = () => { | ||
if (image.width > 1024 || image.height > 1024) { | ||
if (image.width > limitWidth || image.height > limitHeight) { | ||
resolve({ | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}); | ||
@@ -324,3 +393,3 @@ } else { | ||
data: image, | ||
type: 'png' | ||
type: "png", | ||
}); | ||
@@ -336,3 +405,7 @@ } | ||
const res = file.name.split("."); | ||
if (res[res.length - 1].toLowerCase() !== "tga" && res[res.length - 1].toLowerCase() !== "png" && res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "tga" && | ||
res[res.length - 1].toLowerCase() !== "png" && | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
return { | ||
@@ -353,6 +426,6 @@ value: false, | ||
if (width > 1024 || height > 1024) { | ||
if (width > limitWidth || height > limitHeight) { | ||
return { | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}; | ||
@@ -370,6 +443,9 @@ } | ||
}; | ||
} | ||
} | ||
} | ||
if (res[res.length - 1].toLowerCase() !== "png" || res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "png" || | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
const image = new Image(); | ||
@@ -379,6 +455,6 @@ image.src = URL.createObjectURL(file); | ||
image.onload = () => { | ||
if (image.width > 1024 || image.height > 1024) { | ||
if (image.width > limitWidth || image.height > limitHeight) { | ||
resolve({ | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}); | ||
@@ -389,3 +465,3 @@ } else { | ||
data: image, | ||
type: 'png' | ||
type: "png", | ||
}); | ||
@@ -401,3 +477,7 @@ } | ||
const res = file.name.split("."); | ||
if (res[res.length - 1].toLowerCase() !== "tga" && res[res.length - 1].toLowerCase() !== "png" && res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "tga" && | ||
res[res.length - 1].toLowerCase() !== "png" && | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
return { | ||
@@ -408,3 +488,3 @@ value: false, | ||
} | ||
if (res[res.length - 1].toLowerCase() === "tga") { | ||
@@ -419,6 +499,6 @@ // 加载文件 | ||
if (width > 1024 || height > 1024) { | ||
if (width > limitWidth || height > limitHeight) { | ||
return { | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}; | ||
@@ -439,3 +519,6 @@ } | ||
if (res[res.length - 1].toLowerCase() !== "png" || res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "png" || | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
const image = new Image(); | ||
@@ -445,6 +528,6 @@ image.src = URL.createObjectURL(file); | ||
image.onload = () => { | ||
if (image.width > 1024 || image.height > 1024) { | ||
if (image.width > limitWidth || image.height > limitHeight) { | ||
resolve({ | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}); | ||
@@ -455,3 +538,3 @@ } else { | ||
data: image, | ||
type: 'png' | ||
type: "png", | ||
}); | ||
@@ -467,3 +550,7 @@ } | ||
const res = file.name.split("."); | ||
if (res[res.length - 1].toLowerCase() !== "tga" && res[res.length - 1].toLowerCase() !== "png" && res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "tga" && | ||
res[res.length - 1].toLowerCase() !== "png" && | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
return { | ||
@@ -476,3 +563,3 @@ value: false, | ||
if (res[res.length - 1].toLowerCase() === "tga") { | ||
// 加载文件 | ||
// 加载文件 | ||
const loader = new TGALoader(); | ||
@@ -485,6 +572,6 @@ // TODO: 移植 tga parse,明晰错误信息 | ||
if (width > 1024 || height > 1024) { | ||
if (width > limitWidth || height > limitHeight) { | ||
return { | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}; | ||
@@ -505,3 +592,6 @@ } | ||
if (res[res.length - 1].toLowerCase() !== "png" || res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "png" || | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
const image = new Image(); | ||
@@ -511,6 +601,6 @@ image.src = URL.createObjectURL(file); | ||
image.onload = () => { | ||
if (image.width > 1024 || image.height > 1024) { | ||
if (image.width > limitWidth || image.height > limitHeight) { | ||
resolve({ | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}); | ||
@@ -521,3 +611,3 @@ } else { | ||
data: image, | ||
type: 'png' | ||
type: "png", | ||
}); | ||
@@ -533,3 +623,7 @@ } | ||
const res = file.name.split("."); | ||
if (res[res.length - 1].toLowerCase() !== "tga" && res[res.length - 1].toLowerCase() !== "png" && res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "tga" && | ||
res[res.length - 1].toLowerCase() !== "png" && | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
return { | ||
@@ -556,3 +650,3 @@ value: false, | ||
const height = tga.height; | ||
if (width !== 128 || height !== 128) { | ||
@@ -564,3 +658,3 @@ return { | ||
} | ||
return { | ||
@@ -578,3 +672,6 @@ value: true, | ||
if (res[res.length - 1].toLowerCase() !== "png" || res[res.length - 1].toLowerCase() !== "jpg") { | ||
if ( | ||
res[res.length - 1].toLowerCase() !== "png" || | ||
res[res.length - 1].toLowerCase() !== "jpg" | ||
) { | ||
const image = new Image(); | ||
@@ -593,3 +690,3 @@ image.src = URL.createObjectURL(file); | ||
data: image, | ||
type: 'png' | ||
type: "png", | ||
}); | ||
@@ -629,6 +726,6 @@ } | ||
if (width > 1024 || height > 1024) { | ||
if (width > limitWidth || height > limitHeight) { | ||
return { | ||
value: false, | ||
message: "纹理文件的宽与高应小于等于 1024 pix", | ||
message: `纹理文件的宽与高应小于等于 ${limitWidth}*${limitWidth} pix`, | ||
}; | ||
@@ -669,3 +766,8 @@ } | ||
if ( | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 1 && coordinate.front.sign === -1 && coordinate.up.value === 2 && coordinate.up.sign === 1) | ||
coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 1 && | ||
coordinate.front.sign === -1 && | ||
coordinate.up.value === 2 && | ||
coordinate.up.sign === 1 | ||
) { | ||
@@ -681,6 +783,10 @@ flagCoord = true; | ||
let uniqueSkeleton = null; | ||
model.traverse(child => { | ||
if (child.name === "pelvis" && (child.children[0].name === 'spine_01' || child.children[0].name === 'thigh_l' || child.children[0].name === 'thigh_r')) { | ||
model.traverse((child) => { | ||
if ( | ||
child.name === "pelvis" && | ||
(child.children[0].name === "spine_01" || | ||
child.children[0].name === "thigh_l" || | ||
child.children[0].name === "thigh_r") | ||
) { | ||
uniqueSkeleton = child; | ||
@@ -694,6 +800,9 @@ } | ||
message: "骨骼信息缺失", | ||
} | ||
}; | ||
} | ||
if (uniqueSkeleton.position.y > 0 && isFashionFemale(detectRule.goodSecondaryClassification)) { | ||
if ( | ||
uniqueSkeleton.position.y > 0 && | ||
isFashionFemale(detectRule.goodSecondaryClassification) | ||
) { | ||
return { | ||
@@ -705,4 +814,6 @@ value: false, | ||
if (uniqueSkeleton.position.y < 0 && isFashionMale(detectRule.goodSecondaryClassification)) { | ||
if ( | ||
uniqueSkeleton.position.y < 0 && | ||
isFashionMale(detectRule.goodSecondaryClassification) | ||
) { | ||
return { | ||
@@ -727,3 +838,2 @@ value: false, | ||
// 动画 fbx 文件校验 | ||
@@ -749,7 +859,12 @@ async function detectFBXAnimationFile(file) { | ||
if ( | ||
(coordinate.coord.value === 0 && coordinate.coord.sign === 1 && coordinate.front.value === 1 && coordinate.front.sign === -1 && coordinate.up.value === 2 && coordinate.up.sign === 1) | ||
coordinate.coord.value === 0 && | ||
coordinate.coord.sign === 1 && | ||
coordinate.front.value === 1 && | ||
coordinate.front.sign === -1 && | ||
coordinate.up.value === 2 && | ||
coordinate.up.sign === 1 | ||
) { | ||
flagCoord = true; | ||
} | ||
if (!flagCoord) { | ||
@@ -765,14 +880,18 @@ return { | ||
let uniqueSkeleton = null; | ||
model.traverse(child => { | ||
if (child.name === 'root') { | ||
model.traverse((child) => { | ||
if (child.name === "root") { | ||
bonesA = child; | ||
} | ||
if (child.name === 'ROOT') { | ||
if (child.name === "ROOT") { | ||
bonesB = child; | ||
} | ||
if (child.name === "pelvis" && (child.children[0].name === 'spine_01' || child.children[0].name === 'thigh_l' || child.children[0].name === 'thigh_r')) { | ||
if ( | ||
child.name === "pelvis" && | ||
(child.children[0].name === "spine_01" || | ||
child.children[0].name === "thigh_l" || | ||
child.children[0].name === "thigh_r") | ||
) { | ||
uniqueSkeleton = child; | ||
@@ -786,3 +905,3 @@ } | ||
message: "骨骼信息缺失或骨骼导出错误", | ||
} | ||
}; | ||
} | ||
@@ -794,3 +913,3 @@ | ||
message: "动画信息缺失", | ||
} | ||
}; | ||
} | ||
@@ -797,0 +916,0 @@ |
@@ -384,2 +384,3 @@ import * as THREE from 'star_mod_custom_three'; | ||
const material = Array.isArray(child.material) ? child.material[channel] : child.material; | ||
const currMaterialEnvMap = material.envMap; | ||
if (type === GLASS_MATERIAL_KEY || type === FEMALE_BODY_MATERIAL_KEY || type === MALE_BODY_MATERIAL_KEY) { | ||
@@ -390,2 +391,3 @@ material.dispose(); | ||
child.material[channel] = res; | ||
child.material[channel].envMap = currMaterialEnvMap; | ||
child.material[channel].needsUpdate = true; | ||
@@ -397,2 +399,3 @@ resolve(); | ||
child.material = res; | ||
child.material.envMap = currMaterialEnvMap; | ||
child.material.needsUpdate = true; | ||
@@ -408,2 +411,3 @@ resolve(); | ||
child.material[channel] = this.createStandardMaterial(); | ||
child.material[channel].envMap = currMaterialEnvMap; | ||
child.material[channel].needsUpdate = true; | ||
@@ -413,2 +417,3 @@ resolve(); | ||
child.material = this.createStandardMaterial(); | ||
child.material.envMap = currMaterialEnvMap; | ||
child.material.needsUpdate = true; | ||
@@ -415,0 +420,0 @@ resolve(); |
{ | ||
"name": "star_mod_renderer", | ||
"version": "1.0.80", | ||
"version": "1.0.81", | ||
"description": "star mod project render auxiliary", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -114,2 +114,3 @@ /** | ||
isNeedScreenshot: false, | ||
showViewHelper: true, | ||
}; | ||
@@ -187,3 +188,5 @@ | ||
// 初始化坐标轴标识 | ||
this.initViewHelper(); | ||
if (this.options.showViewHelper) { | ||
this.initViewHelper(); | ||
} | ||
// 初始化模型转换控制器 | ||
@@ -612,5 +615,9 @@ this.initTransformControls(); | ||
changeGirdVisible() { | ||
changeGirdVisible(flag) { | ||
this.grids.forEach((item) => { | ||
item.visible = !item.visible; | ||
if (typeof flag === "boolean") { | ||
item.visible = flag; | ||
} else { | ||
item.visible = !item.visible; | ||
} | ||
}); | ||
@@ -666,3 +673,3 @@ this.update(); | ||
this.camera.zoom = 1; | ||
if (this.mode.isEdit) { | ||
if (this.mode.isEdit && this.options.showViewHelper) { | ||
this.viewHelper = new ViewHelper(this.camera, this.dom); | ||
@@ -784,2 +791,17 @@ this.viewHelper.controls = this.cameraControls; | ||
// 初始相机位置修正 | ||
initCameraFocusModel(target) { | ||
if (!target) return; | ||
if (target.isGrid || target === this.camera || target === this.scene || target === this.ambientLight || this.directionalLights.includes(target)) { | ||
return; | ||
} | ||
this.cameraControls.focus(target); | ||
this.camera.position.z = -this.camera.position.z; | ||
this.camera.lookAt(this.cameraControls.center); | ||
this.selectModel(target); | ||
this.update(); | ||
} | ||
shootModel(target) { | ||
@@ -786,0 +808,0 @@ this.cameraControls.shoot(target); |
@@ -1139,3 +1139,3 @@ /** | ||
if (this.mainModels.length) { | ||
this.focusModel(this.mainModels[0].getModel()); | ||
this.initCameraFocusModel(this.mainModels[0].getModel()); | ||
if (this.options.platform === 'pc' && this.options.isShowModelInfo) { | ||
@@ -1145,3 +1145,3 @@ this.initModelInfo(this.mainModels[0]); | ||
} else { | ||
this.focusModel(this.extraModels[this.extraModels.length - 1].getModel()); | ||
this.initCameraFocusModel(this.extraModels[this.extraModels.length - 1].getModel()); | ||
} | ||
@@ -1239,3 +1239,3 @@ | ||
const img = new Image(); | ||
let imgData = dom.toDataURL("image/jpeg"); | ||
let imgData = dom.toDataURL("image/png"); | ||
img.src = imgData; | ||
@@ -1242,0 +1242,0 @@ |
408622
11081