star_mod_renderer
Advanced tools
Comparing version 1.0.34 to 1.0.36
@@ -41,2 +41,21 @@ import * as THREE from 'star_mod_custom_three'; | ||
export const envMapMenu = { | ||
sky: { | ||
name: 'sky', | ||
domesticPath: { | ||
nx: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621848-dark-s_nx.jpg', | ||
ny: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621866-dark-s_ny.jpg', | ||
nz: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621875-dark-s_nz.jpg', | ||
px: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621887-dark-s_px.jpg', | ||
py: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621896-dark-s_py.jpg', | ||
pz: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621905-dark-s_pz.jpg' | ||
}, | ||
abroadPath: { | ||
nx: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621959-dark-s_nx.jpg', | ||
ny: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621966-dark-s_ny.jpg', | ||
nz: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621976-dark-s_nz.jpg', | ||
px: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621984-dark-s_px.jpg', | ||
py: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621992-dark-s_py.jpg', | ||
pz: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modPicture/386576592849078636/1671621999-dark-s_pz.jpg' | ||
} | ||
}, | ||
dreamland: { | ||
@@ -47,7 +66,7 @@ name: 'dreamland', | ||
}, | ||
sky: { | ||
name: 'sky', | ||
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829171_20230615-164800.jpg', | ||
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829171_20230615-164800.jpg' | ||
}, | ||
// sky: { | ||
// name: 'sky', | ||
// domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829171_20230615-164800.jpg', | ||
// abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829171_20230615-164800.jpg' | ||
// }, | ||
dusk: { | ||
@@ -61,18 +80,38 @@ name: 'dusk', | ||
export function getEnvMapByName(name, env) { | ||
// return new Promise((resolve) => { | ||
// if (!envMapMenu[name]) { | ||
// name = 'dreamland'; | ||
// } | ||
// const { abroadPath, domesticPath } = envMapMenu[name]; | ||
// const path = env === 'abroad' ? abroadPath : domesticPath; | ||
// const textureLoader = new THREE.TextureLoader(); | ||
// textureLoader.load(path, | ||
// (texture) => { | ||
// resolve({ | ||
// name: envMapMenu[name].name, | ||
// data: texture, | ||
// }); | ||
// }) | ||
// }); | ||
return new Promise((resolve) => { | ||
if (!envMapMenu[name]) { | ||
name = 'dreamland'; | ||
} | ||
const { abroadPath, domesticPath } = envMapMenu[name]; | ||
const path = env === 'abroad' ? abroadPath : domesticPath; | ||
const textureLoader = new THREE.TextureLoader(); | ||
textureLoader.load(path, | ||
(texture) => { | ||
resolve({ | ||
name: envMapMenu[name].name, | ||
data: texture, | ||
}); | ||
}) | ||
const urls = [ | ||
path.px, | ||
path.nx, | ||
path.py, | ||
path.ny, | ||
path.pz, | ||
path.nz, | ||
]; | ||
const textureCube = new THREE.CubeTextureLoader().load(urls); | ||
textureCube.format = THREE.RGBAFormat; | ||
resolve({ | ||
name: envMapMenu[name].name, | ||
data: textureCube, | ||
}); | ||
}); | ||
} | ||
@@ -89,2 +128,3 @@ | ||
export const MALE_BODY_MATERIAL_KEY = 5; | ||
export const FEMALE_BODY_KEY = 404; | ||
@@ -97,3 +137,22 @@ export const MALE_BODY_KEY = 402; | ||
export const isFashion = (key) => { | ||
return key === FEMALE_BODY_KEY || key === FEMALE_HAIR_KEY || key === MALE_HAIR_KEY || key === MALE_BODY_KEY; | ||
}; | ||
export const isFashionHair = (key) => { | ||
return key === FEMALE_HAIR_KEY || key === MALE_HAIR_KEY; | ||
} | ||
export const isFashionBody = (key) => { | ||
return key === FEMALE_BODY_KEY || key === MALE_BODY_KEY; | ||
} | ||
export const isFashionFemale = (key) => { | ||
return key === FEMALE_BODY_KEY || key === FEMALE_HAIR_KEY; | ||
} | ||
export const isFashionMale = (key) => { | ||
return key === MALE_HAIR_KEY || key === MALE_BODY_KEY; | ||
} | ||
export const defaultPreviewData = { | ||
@@ -100,0 +159,0 @@ cameraPosition: { x: 0, y: 0, z: 0 }, |
@@ -40,3 +40,3 @@ import { FBXLoader } from "./FBXLoader"; | ||
export async function loadFile({ url, type }) { | ||
export async function loadFile({ url, type, fileOriginName }) { | ||
if (type === "fbx") { | ||
@@ -47,3 +47,17 @@ const res = await loadFBXFile(url); | ||
if (type === "tga") { | ||
// 本地文件传递初始文件名 | ||
if (fileOriginName) { | ||
if (type === "tga" && fileOriginName.endsWith('.tga')) { | ||
const res = await loadTGAFile(url); | ||
return res; | ||
} | ||
if (type === 'tga' && (fileOriginName.endsWith('.png') || fileOriginName.endsWith('.jpg')) ) { | ||
const res = await loadPNGFile(url); | ||
return res; | ||
} | ||
} | ||
// TODO: 此处增加判断,如果该文件并非 tga 文件,则判断 Url 后缀是否为 png 或 jpg,如果是,则调用 loadPNGFile | ||
if (type === "tga" && url.endsWith('.tga')) { | ||
const res = await loadTGAFile(url); | ||
@@ -53,6 +67,11 @@ return res; | ||
if (type === 'png') { | ||
if(type === 'tga' && (url.endsWith('.png') || url.endsWith('.jpg')) ) { | ||
const res = await loadPNGFile(url); | ||
return res; | ||
} | ||
if (type === 'png' || type === 'jpg') { | ||
const res = await loadPNGFile(url); | ||
return res; | ||
} | ||
} | ||
@@ -59,0 +78,0 @@ |
{ | ||
"name": "star_mod_renderer", | ||
"version": "1.0.34", | ||
"version": "1.0.36", | ||
"description": "star mod project render auxiliary ", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "zhaobo.liu", | ||
"license": "ISC" | ||
} |
@@ -167,7 +167,10 @@ import * as THREE from 'star_mod_custom_three'; | ||
setSceneEnvironment(environment) { | ||
console.log('environment is :', environment); | ||
if (environment) { | ||
const crt = new THREE.WebGLCubeRenderTarget(environment.image.height); | ||
crt.fromEquirectangularTexture(this.renderer, environment); | ||
this.scene.background = crt.texture; | ||
this.scene.environment = crt.texture; | ||
// const crt = new THREE.WebGLCubeRenderTarget(environment.image.height); | ||
// crt.fromEquirectangularTexture(this.renderer, environment); | ||
// this.scene.background = crt.texture; | ||
// this.scene.environment = crt.texture; | ||
this.scene.background = environment; | ||
this.scene.environment = environment; | ||
} else { | ||
@@ -174,0 +177,0 @@ this.scene.background = new THREE.Color(SCENE_BACKGROUND_COLOR); |
@@ -151,2 +151,21 @@ import * as THREE from 'star_mod_custom_three'; | ||
stopPlayAnimation() { | ||
this.animationAction.stop(); | ||
} | ||
setAnimationList(list) { | ||
const bones = this.combinationModelGroup.children[1].children[0].clone(true); | ||
if (this.combinationModelGroup.children[0].children[0].type === 'Bone') { | ||
this.combinationModelGroup.children[0].add(bones); | ||
} | ||
this.animations = list; | ||
} | ||
playAnimation(index) { | ||
const flock = new THREE.AnimationObjectGroup(this.combinationModelGroup.children[0], this.maleHeadModel, this.combinationModelGroup.children[1]); | ||
this.mixer = new THREE.AnimationMixer(flock); | ||
this.animationAction = this.mixer.clipAction(this.animations[index]); | ||
this.animationAction.play(); | ||
} | ||
// TODO: 补充动画播放 | ||
@@ -168,3 +187,3 @@ async playDefaultAnimation(key) { | ||
this.animationAction = this.mixer.clipAction(modelRender.getModel().animations[0]); | ||
// modelRender.getModel() | ||
this.animationAction.play(); | ||
@@ -171,0 +190,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
291802
8109
1