Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

star_mod_renderer

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

star_mod_renderer - npm Package Compare versions

Comparing version 1.0.30 to 1.0.32

0

assets/signals.min.js

@@ -0,0 +0,0 @@ /* eslint-disable no-unused-vars */

254

default.js

@@ -43,14 +43,14 @@ import * as THREE from 'star_mod_custom_three';

name: 'dreamland',
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829260_20230615-164749.jpg',
abroadPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829260_20230615-164749.jpg'
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829260_20230615-164749.jpg',
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829260_20230615-164749.jpg'
},
sky: {
name: 'sky',
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829171_20230615-164800.jpg',
abroadPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829171_20230615-164800.jpg'
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: {
name: 'dusk',
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829290_20230615-164803.jpg',
abroadPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686829290_20230615-164803.jpg'
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829290_20230615-164803.jpg',
abroadPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686829290_20230615-164803.jpg'
}

@@ -62,3 +62,3 @@ }

if (!envMapMenu[name]) {
name = 'sky';
name = 'dreamland';
}

@@ -88,2 +88,8 @@ const { abroadPath, domesticPath } = envMapMenu[name];

export const MALE_BODY_MATERIAL_KEY = 5;
export const FEMALE_BODY_KEY = 404;
export const MALE_BODY_KEY = 402;
export const FEMALE_HAIR_KEY = 403;
export const MALE_HAIR_KEY = 401;
export const FEMALE_HEAD_MATERIAL_KEY = 1403;
export const MALE_HEAD_MATERIAL_KEY = 1401;

@@ -108,15 +114,15 @@

fbx: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1677122095-mesh.fbx',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1677122095-mesh.fbx',
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1677122257-mesh.fbx'
},
dTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1677122199-d.TGA',
domesticPath: 'https://mod-img.westar.qq.com/mod/modResource/407365627150336453/1629528108167753728/70001165/1677344850_DiffuseTexture.TGA',
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1677122300-d.TGA'
},
nTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1677122210-n.TGA',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1677122210-n.TGA',
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1677122364-n.TGA'
},
ormeTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1677122226-orme.TGA',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1677122226-orme.TGA',
abroadPath: 'https://xqhw-1255691311.cos.ap-singapore.myqcloud.com/mod/modOfficial/1677122376-orme.TGA'

@@ -130,26 +136,14 @@ }

name: '男头',
key: 1401,
fbx: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1684145245_M_CSZ_head_01.FBX'
}
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1684145245_M_CSZ_head_01.FBX'
},
},
403: {
name: '女头',
key: 1403,
fbx: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1684145150_F_CSZ_01_Head.FBX'
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1684145150_F_CSZ_01_Head.FBX'
},
},
7: {
name: '女身',
fbx: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686902121_F_CSZ_01_Body.FBX',
abroadPath: ''
},
},
5: {
name: '男身',
fbx: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686908967_M_CSZ_body_01.FBX',
abroadPath: ''
},
}
}

@@ -161,3 +155,3 @@

dancing: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1684224202_Male_Celebrate.FBX',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1684224202_Male_Celebrate.FBX',
},

@@ -168,3 +162,3 @@ },

dancing: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1684224183_Female_BellyDancing.FBX',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1684224183_Female_BellyDancing.FBX',
},

@@ -203,11 +197,11 @@ },

dTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686901817_F_bdy_01_D.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686901817_F_bdy_01_D.png',
abroadPath: ''
},
nTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686901841_F_bdy_01_N.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686901841_F_bdy_01_N.png',
abroadPath: ''
},
srmTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686901855_F_bdy_01_g.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686901855_F_bdy_01_g.png',
abroadPath: ''

@@ -236,11 +230,11 @@ },

dTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686908999_M_body_01_D.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686908999_M_body_01_D.png',
abroadPath: ''
},
nTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686909039_M_body_01_N.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686909039_M_body_01_N.png',
abroadPath: ''
},
srmTGA: {
domesticPath: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modOfficial/1686909553_M_body_01_g.png',
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1686909553_M_body_01_g.png',
abroadPath: ''

@@ -265,3 +259,189 @@ },

}
}
},
femaleHead: {
key: FEMALE_HEAD_MATERIAL_KEY,
materialChannelList: [
// 眉毛
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688377290_test4.png',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
// 皮肤
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688376766_F_face_01_D.png',
abroadPath: ''
},
nTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688376790_F_face_01_N.png',
abroadPath: ''
},
srmTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688376803_F_face_01_g.png',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
// 眼睛
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688375565_Base_Eye_tex.png',
abroadPath: ''
},
nTGA: {
domesticPath: '',
abroadPath: ''
},
srmTGA: {
domesticPath: '',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
],
},
maleHead: {
key: MALE_HEAD_MATERIAL_KEY,
materialChannelList: [
// 眉毛
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688455247_test5.png',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
// 皮肤
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457456_M_face_D.png',
abroadPath: ''
},
nTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457484_M_face_N.png',
abroadPath: ''
},
srmTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688457499_M_face_SRMA.png',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
// 眼睛
{
dTGA: {
domesticPath: 'https://mod-img.westar.qq.com/mod/modOfficial/1688375565_Base_Eye_tex.png',
abroadPath: ''
},
nTGA: {
domesticPath: '',
abroadPath: ''
},
srmTGA: {
domesticPath: '',
abroadPath: ''
},
materialParams: {
color: 0xffffff,
metalness: 0,
roughness: 1,
map: null,
normalMap: null,
aoMap: null,
roughnessMap: null,
metalnessMap: null,
emissiveIntensityMap: null,
emissiveMap: null,
emissive: 1,
clearcoat: 0.1,
clearcoatRoughness: 0.5,
reflectivity: 0.1,
sheen: 0.2,
}
},
],
},
};

@@ -0,0 +0,0 @@ // 面数与顶点数计算

@@ -0,0 +0,0 @@ import { Cache } from './Cache.js';

@@ -0,0 +0,0 @@ // 对比两个文件内容,同返回 true 异为 false

export * from './model';

@@ -12,2 +12,4 @@ import * as THREE from 'star_mod_custom_three';

MALE_BODY_MATERIAL_KEY,
FEMALE_HEAD_MATERIAL_KEY,
MALE_HEAD_MATERIAL_KEY
} from '../../default';

@@ -49,2 +51,6 @@ import {

child.isCustomizeRenderObject = true;
if (child.geometry.attributes && child.geometry.attributes.uv && child.geometry.attributes.uv) {
var uvs = child.geometry.attributes.uv.array;
child.geometry.setAttribute('uv2', new THREE.BufferAttribute(uvs, 2));
}

@@ -131,3 +137,2 @@ child.material = this.assembleStandardModelMaterial(child.material);

const material = new THREE.MeshStandardMaterial({
aoMapIntensity: 0,
transparent: false,

@@ -162,2 +167,7 @@ color: 0xffffff,

}
// 创建头部材质
if (type === FEMALE_HEAD_MATERIAL_KEY || type === MALE_HEAD_MATERIAL_KEY) {
return await this.createHead(type);
}
}

@@ -174,3 +184,2 @@

async createSkin(type) {
// TODO: 新增 zip file helper, 下载并解压 zip 文件, loader tga 后设置纹理内容
if (type === FEMALE_BODY_MATERIAL_KEY) {

@@ -224,3 +233,2 @@ const material = new THREE.MeshPhysicalMaterial(specificMaterial.femaleBody.materialParams);

material.needsUpdate = true;
material.needsUpdate = true;

@@ -231,2 +239,100 @@ return material;

async createHead(type) {
if (type === MALE_HEAD_MATERIAL_KEY) {
const files = await Promise.all([
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[1].dTGA.abroadPath : specificMaterial.maleHead.materialChannelList[1].dTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[1].abroadPath : specificMaterial.maleHead.materialChannelList[1].nTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[1].srmTGA.abroadPath : specificMaterial.maleHead.materialChannelList[1].srmTGA.domesticPath,
type: 'png'
}),
// 眼睛
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[2].dTGA.abroadPath : specificMaterial.maleHead.materialChannelList[2].dTGA.domesticPath,
type: 'png'
}),
// 眉毛
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[0].dTGA.abroadPath : specificMaterial.maleHead.materialChannelList[0].dTGA.domesticPath,
type: 'png'
})
]);
const face = this.model.children[1];
const material = face.material;
// 眉毛与睫毛
material[0] = new THREE.MeshPhysicalMaterial(specificMaterial.maleHead.materialChannelList[0].materialParams);
material[0].map = files[4];
material[0].transparent = true;
material[0].needsUpdate = true;
// 皮肤
material[1] = new THREE.MeshPhysicalMaterial(specificMaterial.maleHead.materialChannelList[1].materialParams);
material[1].map = files[0];
material[1].normalMap = files[1];
material[1].clearcoatRoughnessMap = files[2]; // g
material[1].needsUpdate = true;
// 眼睛
material[2] = new THREE.MeshPhysicalMaterial(specificMaterial.maleHead.materialChannelList[2].materialParams);
material[2].map = files[3];
material[2].needsUpdate = true;
}
if (type === FEMALE_HEAD_MATERIAL_KEY) {
const files = await Promise.all([
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[2].dTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[2].dTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[2].abroadPath : specificMaterial.femaleHead.materialChannelList[2].nTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[2].srmTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[2].srmTGA.domesticPath,
type: 'png'
}),
// 眼睛
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[0].dTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[0].dTGA.domesticPath,
type: 'png'
}),
// 眉毛
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[1].dTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[1].dTGA.domesticPath,
type: 'png'
})
]);
const face = this.model.children[1];
const material = face.material;
// 眼睛
material[0] = new THREE.MeshPhysicalMaterial(specificMaterial.femaleHead.materialChannelList[0].materialParams);
material[0].map = files[3];
material[0].needsUpdate = true;
// 眉毛与睫毛
material[1] = new THREE.MeshPhysicalMaterial(specificMaterial.femaleHead.materialChannelList[1].materialParams);
material[1].map = files[4];
material[1].transparent = true;
material[1].needsUpdate = true;
// 皮肤
material[2] = new THREE.MeshPhysicalMaterial(specificMaterial.femaleHead.materialChannelList[2].materialParams);
material[2].map = files[0];
material[2].normalMap = files[1];
material[2].clearcoatRoughnessMap = files[2]; // g
material[2].needsUpdate = true;
}
}
updateModelMaterialType(channel, type) {

@@ -270,2 +376,3 @@ this.model.traverse(async child => {

if (texture.normalTexture) {
material.normalScale = new THREE.Vector2(1, -1);
material.normalMap = texture.normalTexture;

@@ -272,0 +379,0 @@ }

@@ -0,0 +0,0 @@ export function isMesh(key) {

2

package.json
{
"name": "star_mod_renderer",
"version": "1.0.30",
"version": "1.0.32",
"description": "star mod project render auxiliary ",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -149,2 +149,3 @@ import * as THREE from 'star_mod_custom_three';

updateSelectModelParam: new Signal(),
renderError: new Signal(),
};

@@ -570,2 +571,3 @@ }

});
this.renderer.dispose();
this.camera = null;

@@ -572,0 +574,0 @@ this.scene = null;

import * as THREE from 'star_mod_custom_three';
import TgaLoader from "tga-js";
import { RenderBase } from './render.base';
import { getEnvMapByName, defaultModel, defaultModelAnimation } from "./default";
import {
getEnvMapByName,
defaultModel,
defaultModelAnimation,
FEMALE_HAIR_KEY,
MALE_HAIR_KEY,
FEMALE_HEAD_MATERIAL_KEY,
MALE_HEAD_MATERIAL_KEY,
} from "./default";
import { ModelProcessor } from './helper/modelHelper/index';

@@ -38,3 +46,3 @@ import {

}
getEnvMapByName("sky", processEnv).then(env => {
getEnvMapByName('sky', processEnv).then(env => {
this.setSceneEnvironment(env.data);

@@ -56,2 +64,9 @@ });

const max = Math.max(size.x, size.y, size.z);
const min = Math.min(size.x, size.y, size.z);
if (max > 400) {
this.signals.renderError.dispatch();
}
if (min < 10) {
this.signals.renderError.dispatch();
}
this.directionalLights[0].position.set(

@@ -92,13 +107,49 @@ max * 2,

async setAuxiliaryModel(key) {
if (defaultModel[key]) {
const url = defaultModel[key].fbx.domesticPath;
const model = await loadFile({
url,
type: 'fbx'
});
const modelRender = new ModelProcessor(model);
this.combinationModelGroup.add(modelRender.getModel());
if (key === MALE_HAIR_KEY) {
this.maleHeadModel = await this.createMaleHeadModel();
}
// 女头
if (key === FEMALE_HAIR_KEY) {
this.femaleHeadModel = await this.createFemaleHeadModel();
}
}
async createMaleHeadModel() {
const meshUrl = defaultModel[MALE_HAIR_KEY].fbx.domesticPath;
const mesh = await loadFile({
url: meshUrl,
type: 'fbx'
});
const modelRender = new ModelProcessor(mesh);
modelRender.createSpecificMaterial(MALE_HEAD_MATERIAL_KEY);
this.maleHeadModel = modelRender.getModel();
this.maleHeadModel.visible = true;
this.addModel(this.maleHeadModel);
return this.maleHeadModel;
}
changeMaleHeadModelVisible() {
this.maleHeadModel.visible = !this.maleHeadModel.visible;
}
async createFemaleHeadModel() {
const meshUrl = defaultModel[FEMALE_HAIR_KEY].fbx.domesticPath;
const mesh = await loadFile({
url: meshUrl,
type: 'fbx'
});
const modelRender = new ModelProcessor(mesh);
modelRender.createSpecificMaterial(FEMALE_HEAD_MATERIAL_KEY);
this.femaleHeadModel = modelRender.getModel();
this.femaleHeadModel.visible = true;
this.addModel(this.femaleHeadModel);
return this.femaleHeadModel;
}
changeFemaleHeadModelVisible() {
this.femaleHeadModel.visible = !this.femaleHeadModel.visible;
}
// TODO: 补充动画播放
async playDefaultAnimation(key) {

@@ -105,0 +156,0 @@ if (defaultModelAnimation[key]) {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc