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.52 to 1.0.53

39

assets/EditorControls.js

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

delta.applyQuaternion(object.quaternion);
delta.multiplyScalar(distance * 2.8);
delta.multiplyScalar(distance * 4);

@@ -70,2 +70,39 @@ object.position.copy(center).add(delta);

this.shoot = function (target) {
var distance;
box.setFromObject(target);
if (box.isEmpty() === false) {
box.getCenter(center);
distance = box.getBoundingSphere(sphere).radius;
} else {
// Focusing on an Group, AmbientLight, etc
center.setFromMatrixPosition(target.matrixWorld);
distance = 0.1;
}
delta.set(0, 0, 1);
delta.applyQuaternion(object.quaternion);
const boxSize = {
x: Math.abs(box.max.x) + Math.abs(box.min.x),
y: Math.abs(box.max.y) + Math.abs(box.min.y),
z: Math.abs(box.max.z) + Math.abs(box.min.z),
}
const max = Math.max(boxSize.x, boxSize.y, boxSize.z);
if (max > distance * 1.6) {
delta.multiplyScalar(distance * 3);
} else {
delta.multiplyScalar(distance * 2.2);
}
object.position.copy(center).add(delta);
scope.dispatchEvent(changeEvent);
}
this.pan = function (delta) {

@@ -72,0 +109,0 @@

36

helper/modelHelper/model.js

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

material.materialType = FEMALE_BODY_MATERIAL_KEY;
// TODO: 移动端与海外采用不同的环境参数或 url
const files = await Promise.all([
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleBody.dTGA.abroadPath : specificMaterial.femaleBody.dTGA.domesticPath,
url: specificMaterial.femaleBody.dTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleBody.nTGA.abroadPath : specificMaterial.femaleBody.nTGA.domesticPath,
url: specificMaterial.femaleBody.nTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleBody.srmTGA.abroadPath : specificMaterial.femaleBody.srmTGA.domesticPath,
url: specificMaterial.femaleBody.srmTGA.domesticPath,
type: 'png'

@@ -219,13 +220,14 @@ }),

material.materialType = MALE_BODY_MATERIAL_KEY;
// TODO: 移动端与海外采用不同的环境参数或 url
const files = await Promise.all([
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleBody.dTGA.abroadPath : specificMaterial.maleBody.dTGA.domesticPath,
url: specificMaterial.maleBody.dTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleBody.nTGA.abroadPath : specificMaterial.maleBody.nTGA.domesticPath,
url: specificMaterial.maleBody.nTGA.domesticPath,
type: 'png'
}),
loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleBody.srmTGA.abroadPath : specificMaterial.maleBody.srmTGA.domesticPath,
url: specificMaterial.maleBody.srmTGA.domesticPath,
type: 'png'

@@ -246,13 +248,14 @@ }),

if (type === MALE_HEAD_MATERIAL_KEY) {
// TODO: 移动端与海外采用不同的环境参数或 url
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,
url: 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,
url: 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,
url: specificMaterial.maleHead.materialChannelList[1].srmTGA.domesticPath,
type: 'png'

@@ -262,3 +265,3 @@ }),

loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[2].dTGA.abroadPath : specificMaterial.maleHead.materialChannelList[2].dTGA.domesticPath,
url: specificMaterial.maleHead.materialChannelList[2].dTGA.domesticPath,
type: 'png'

@@ -268,3 +271,3 @@ }),

loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.maleHead.materialChannelList[0].dTGA.abroadPath : specificMaterial.maleHead.materialChannelList[0].dTGA.domesticPath,
url: specificMaterial.maleHead.materialChannelList[0].dTGA.domesticPath,
type: 'png'

@@ -302,13 +305,14 @@ })

if (type === FEMALE_HEAD_MATERIAL_KEY) {
// TODO: 移动端与海外采用不同的环境参数或 url
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,
url: 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,
url: 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,
url: specificMaterial.femaleHead.materialChannelList[2].srmTGA.domesticPath,
type: 'png'

@@ -318,3 +322,3 @@ }),

loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[0].dTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[0].dTGA.domesticPath,
url: specificMaterial.femaleHead.materialChannelList[0].dTGA.domesticPath,
type: 'png'

@@ -324,3 +328,3 @@ }),

loadFile({
url: process.env.VUE_APP_NAME == "abroad" ? specificMaterial.femaleHead.materialChannelList[1].dTGA.abroadPath : specificMaterial.femaleHead.materialChannelList[1].dTGA.domesticPath,
url: specificMaterial.femaleHead.materialChannelList[1].dTGA.domesticPath,
type: 'png'

@@ -327,0 +331,0 @@ })

{
"name": "star_mod_renderer",
"version": "1.0.52",
"version": "1.0.53",
"description": "star mod project render auxiliary",

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

@@ -728,2 +728,6 @@ /**

shootModel(target) {
this.cameraControls.shoot(target);
}
// 模型添加能力

@@ -730,0 +734,0 @@ addModel(model, options) {

@@ -349,3 +349,2 @@ /**

}
if (fashionConfig.animations) {

@@ -1004,46 +1003,7 @@ const loadDefaultAnimations = async () => {

calculateObjectSize(object) {
var objectPosition = new THREE.Vector3();
object.getWorldPosition(objectPosition); // 获取物体的世界坐标
// 使用投影矩阵将物体坐标投影到屏幕坐标
objectPosition.project(this.camera);
// 计算物体在Canvas上的大小(以像素为单位)
var objectSize = {
width: (objectPosition.x + 1) * 0.5 * 128,
height: (-objectPosition.y + 1) * 0.5 * 128
};
return objectSize;
}
setCalculateObjectZoom(object) {
return new Promise((resolve) => {
let timer;
const zoomLoop = () => {
const size = this.calculateObjectSize(object);
const max = Math.max(size.width, size.height);
if (max < 118 && max > 98) {
clearTimeout(timer);
resolve();
} else if (max > 118) {
this.cameraControls.zoom(new THREE.Vector3(0, 0, 1));
timer = setTimeout(zoomLoop, 30);
} else if (max < 98) {
this.cameraControls.zoom(new THREE.Vector3(0, 0, -1));
timer = setTimeout(zoomLoop, 30);
} else {
clearTimeout(timer);
resolve();
}
};
timer = setTimeout(zoomLoop, 30);
});
}
getDefaultIcon() {
return new Promise((resolve) => {
this.extraModels.forEach(modelRender => {
modelRender.setModelVisibility(false);
});
const canvas = this.getRenderDom();

@@ -1061,13 +1021,12 @@ canvas.style.background = 'rgba(255, 255, 255, 0)';

this.focusModel(this.mainModels[0].getModel());
this.dom.width = 128;
this.dom.height = 128;
this.dom.style.width = `${128}px`;
this.dom.style.height = `${128}px`;
this.dom.width = 248;
this.dom.height = 248;
this.dom.style.width = `${248}px`;
this.dom.style.height = `${248}px`;
this.setSize();
this.setCalculateObjectZoom(this.mainModels[0].getModel()).then(() => {
this.generateCurrFrameFlag = true;
setTimeout(() => {
resolve(this.currFrame);
}, 100);
});
this.shootModel(this.mainModels[0].getModel());
this.generateCurrFrameFlag = true;
setTimeout(() => {
resolve(this.currFrame);
}, 100);
})

@@ -1074,0 +1033,0 @@ }

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