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.36 to 1.0.37

73

default.js

@@ -44,2 +44,21 @@ import * as THREE from 'star_mod_custom_three';

domesticPath: {
nx: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343648_nx.png',
ny: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343609_ny.png',
nz: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343665_nz.png',
px: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343675_px.png',
py: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343685_py.png',
pz: 'https://mod-img.westar.qq.com/mod/modOfficial/1692343696_pz.png'
},
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: {
name: 'dreamland',
domesticPath: {
nx: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621848-dark-s_nx.jpg',

@@ -61,7 +80,26 @@ ny: 'https://westar-cdn-source-1258344700.cos.ap-nanjing.myqcloud.com/mod/modPicture/366054930261217241/1671621866-dark-s_ny.jpg',

},
dreamland: {
name: 'dreamland',
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'
dusk: {
name: 'dusk',
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: {
// name: 'dreamland',
// 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: {

@@ -72,27 +110,10 @@ // name: 'sky',

// },
dusk: {
name: 'dusk',
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'
}
// dusk: {
// name: 'dusk',
// 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'
// }
}
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) => {

@@ -99,0 +120,0 @@ const { abroadPath, domesticPath } = envMapMenu[name];

{
"name": "star_mod_renderer",
"version": "1.0.36",
"version": "1.0.37",
"description": "star mod project render auxiliary ",

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

@@ -1,11 +0,17 @@

import * as THREE from 'star_mod_custom_three';
import { Signal } from './assets/signals.min.js';
import { EditorControls } from './assets/EditorControls.js';
import { TransformControls } from 'star_mod_custom_three/examples/jsm/controls/TransformControls.js';
import { ViewHelper } from 'star_mod_custom_three/examples/jsm/helpers/ViewHelper.js';
import { SCENE_BACKGROUND_COLOR, AMBIENT_LIGHT_COLOR, DIRECTION_LIGHT_COLOR, DIRECTION_LIGHT_INTENSITY, AMBIENT_LIGHT_INTENSITY } from './default.js';
import * as THREE from "star_mod_custom_three";
import { Signal } from "./assets/signals.min.js";
import { EditorControls } from "./assets/EditorControls.js";
import { TransformControls } from "star_mod_custom_three/examples/jsm/controls/TransformControls.js";
import { ViewHelper } from "star_mod_custom_three/examples/jsm/helpers/ViewHelper.js";
import {
SCENE_BACKGROUND_COLOR,
AMBIENT_LIGHT_COLOR,
DIRECTION_LIGHT_COLOR,
DIRECTION_LIGHT_INTENSITY,
AMBIENT_LIGHT_INTENSITY,
} from "./default.js";
export class RenderBase {
dom = null;
mode = 'editor'
mode = "editor";
scene = null;

@@ -23,3 +29,3 @@ camera = null;

// 渲染器初始化
constructor({ mode = 'editor', dom }) {
constructor({ mode = "editor", dom }) {
this.mode = this.getCurrMode(mode);

@@ -30,3 +36,3 @@ this.dom = dom;

// 对容器进行清空
this.dom.innerHTML = '';
this.dom.innerHTML = "";
}

@@ -41,12 +47,12 @@ this.initCommonAbility();

getCurrMode(mode) {
if (mode === 'editor') {
if (mode === "editor") {
return {
isEditor: true
}
isEditor: true,
};
}
if (mode === 'render') {
if (mode === "render") {
return {
isRender: true
}
isRender: true,
};
}

@@ -101,3 +107,3 @@ }

} else {
this.dom = document.createElement('div');
this.dom = document.createElement("div");
this.dom.style = "position: relative;";

@@ -142,3 +148,7 @@ this.dom.append(this.renderer.domElement);

}
this.cameraControls = new EditorControls(this.camera, this.dom, 'orthographic');
this.cameraControls = new EditorControls(
this.camera,
this.dom,
"orthographic"
);
this.camera.zoom = 10;

@@ -161,8 +171,8 @@ this.viewHelper = new ViewHelper(this.camera, this.dom);

this.viewHelper.controls = this.cameraControls;
const dom = document.createElement('div');
dom.style.position = 'absolute';
dom.style.right = '0px';
dom.style.bottom = '0px';
dom.style.height = '128px';
dom.style.width = '128px';
const dom = document.createElement("div");
dom.style.position = "absolute";
dom.style.right = "0px";
dom.style.bottom = "0px";
dom.style.height = "128px";
dom.style.width = "128px";

@@ -191,12 +201,28 @@ this.dom.append(dom);

// 临时
this.ambientLight = new THREE.AmbientLight(AMBIENT_LIGHT_COLOR, AMBIENT_LIGHT_INTENSITY);
this.hemisphereLight = new THREE.HemisphereLight(AMBIENT_LIGHT_COLOR, AMBIENT_LIGHT_COLOR, AMBIENT_LIGHT_INTENSITY);
this.ambientLight = new THREE.AmbientLight(
AMBIENT_LIGHT_COLOR,
AMBIENT_LIGHT_INTENSITY
);
this.hemisphereLight = new THREE.HemisphereLight(
AMBIENT_LIGHT_COLOR,
AMBIENT_LIGHT_COLOR,
AMBIENT_LIGHT_INTENSITY
);
this.directionalLights = [
new THREE.DirectionalLight(DIRECTION_LIGHT_COLOR, DIRECTION_LIGHT_INTENSITY),
new THREE.DirectionalLight(DIRECTION_LIGHT_COLOR, DIRECTION_LIGHT_INTENSITY),
new THREE.DirectionalLight(DIRECTION_LIGHT_COLOR, DIRECTION_LIGHT_INTENSITY)
new THREE.DirectionalLight(
DIRECTION_LIGHT_COLOR,
DIRECTION_LIGHT_INTENSITY
),
new THREE.DirectionalLight(
DIRECTION_LIGHT_COLOR,
DIRECTION_LIGHT_INTENSITY
),
new THREE.DirectionalLight(
DIRECTION_LIGHT_COLOR,
DIRECTION_LIGHT_INTENSITY
),
];
this.addModel(this.ambientLight);
this.addModel(this.hemisphereLight);
this.directionalLights.forEach(item => {
this.directionalLights.forEach((item) => {
this.addModel(item);

@@ -221,11 +247,11 @@ });

if (light.color) {
this.directionalLights.forEach(item => {
this.directionalLights.forEach((item) => {
item.color.set(light.color);
})
});
}
if (light.intensity) {
this.directionalLights.forEach(item => {
this.directionalLights.forEach((item) => {
item.intensity = light.intensity;
})
});
}

@@ -249,3 +275,3 @@ }

// resize
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
// TODO:重置大小

@@ -259,4 +285,4 @@ this.setSize();

// delete
window.addEventListener('keydown', (event) => {
if (event.key.toLowerCase() === 'delete' && this.currSelectModel) {
window.addEventListener("keydown", (event) => {
if (event.key.toLowerCase() === "delete" && this.currSelectModel) {
// 直接触发删除能力

@@ -268,20 +294,32 @@ this.signals.removeCurrSelectObject.dispatch();

// 单击
this.dom.addEventListener('mousedown', (event) => {
const array = this.getMousePosition(this.dom, event.clientX, event.clientY);
this.dom.addEventListener("mousedown", (event) => {
const array = this.getMousePosition(
this.dom,
event.clientX,
event.clientY
);
this.onDownPosition.fromArray(array);
document.addEventListener('mouseup', this.onMouseUp.bind(this));
document.addEventListener("mouseup", this.onMouseUp.bind(this));
});
this.dom.addEventListener('touchstart', (event) => {
this.dom.addEventListener("touchstart", (event) => {
const touch = event.changedTouches[0];
const array = this.getMousePosition(this.dom, touch.clientX, touch.clientY);
const array = this.getMousePosition(
this.dom,
touch.clientX,
touch.clientY
);
this.onDownPosition.fromArray(array);
document.addEventListener('touchend', this.onTouchEnd.bind(this));
document.addEventListener("touchend", this.onTouchEnd.bind(this));
});
// 双击
this.dom.addEventListener('dblclick', (event) => {
const array = this.getMousePosition(this.dom, event.clientX, event.clientY);
this.dom.addEventListener("dblclick", (event) => {
const array = this.getMousePosition(
this.dom,
event.clientX,
event.clientY
);
this.onDoubleClickPosition.fromArray(array);

@@ -292,3 +330,2 @@

if (intersects.length > 0) {
const intersect = intersects[0];

@@ -307,9 +344,7 @@

}
}
getIntersects(point) {
this.mouse.set(point.x * 2 - 1, -(point.y * 2) + 1);
this.mouse.set((point.x * 2) - 1, - (point.y * 2) + 1);
this.raycaster.setFromCamera(this.mouse, this.camera);

@@ -320,10 +355,6 @@

this.scene.traverseVisible(function (child) {
objects.push(child);
});
return this.raycaster.intersectObjects(objects, false);
}

@@ -333,9 +364,13 @@

if (this.dom) {
const array = this.getMousePosition(this.dom, event.clientX, event.clientY);
const array = this.getMousePosition(
this.dom,
event.clientX,
event.clientY
);
this.onUpPosition && this.onUpPosition.fromArray(array);
this.handleClick();
}
document.removeEventListener('mouseup', this.onMouseUp);
document.removeEventListener("mouseup", this.onMouseUp);
}

@@ -347,10 +382,13 @@

const array = this.getMousePosition(this.dom, touch.clientX, touch.clientY);
const array = this.getMousePosition(
this.dom,
touch.clientX,
touch.clientY
);
this.onUpPosition && this.onUpPosition.fromArray(array);
this.handleClick();
}
document.removeEventListener('touchend', this.onTouchEnd);
document.removeEventListener("touchend", this.onTouchEnd);
}

@@ -360,3 +398,2 @@

if (this.onDownPosition.distanceTo(this.onUpPosition) === 0) {
const intersects = this.getIntersects(this.onUpPosition);

@@ -366,3 +403,2 @@

this.intersectionsDetected(intersects);
}

@@ -382,7 +418,7 @@ }

// 移除模型
model.parent && model.parent.remove(model)
model.parent && model.parent.remove(model);
// TODO: 移除材质
if (model.children) {
model.traverse(child => {
model.traverse((child) => {
if (child.geometry) {

@@ -394,3 +430,3 @@ child.geometry.dispose();

}
})
});
} else {

@@ -408,11 +444,19 @@ if (model.geometry) {

initTransformControls() {
this.transformControls = new TransformControls(this.camera, this.dom);
this.changeTransformControls('translate');
this.changeTransformControls("translate");
this.transformControls.addEventListener('change', this.onTransformControlsChange.bind(this));
this.transformControls.addEventListener(
"change",
this.onTransformControlsChange.bind(this)
);
this.transformControls.addEventListener('mouseDown', this.onTransformControlsMouseDown.bind(this));
this.transformControls.addEventListener(
"mouseDown",
this.onTransformControlsMouseDown.bind(this)
);
this.transformControls.addEventListener('mouseUp', this.onTransformControlsMouseUp.bind(this));
this.transformControls.addEventListener(
"mouseUp",
this.onTransformControlsMouseUp.bind(this)
);

@@ -446,5 +490,14 @@ this.scene.add(this.transformControls);

this.scene.remove(this.transformControls);
this.transformControls.removeEventListener('change', this.onTransformControlsChange.bind(this));
this.transformControls.removeEventListener('mouseDown', this.onTransformControlsMouseDown.bind(this));
this.transformControls.removeEventListener('mouseUp', this.onTransformControlsMouseUp.bind(this));
this.transformControls.removeEventListener(
"change",
this.onTransformControlsChange.bind(this)
);
this.transformControls.removeEventListener(
"mouseDown",
this.onTransformControlsMouseDown.bind(this)
);
this.transformControls.removeEventListener(
"mouseUp",
this.onTransformControlsMouseUp.bind(this)
);
this.transformControls.dispose();

@@ -471,3 +524,2 @@ this.transformControls = null;

this.selectModel(object);
} else {

@@ -502,7 +554,6 @@ this.selectModel(null);

}
}
selectModelByName(name) {
const object = this.scene.children.find(item => item.name === name);
const object = this.scene.children.find((item) => item.name === name);
this.selectModel(object);

@@ -521,3 +572,4 @@ }

if (target === this.camera || target === this.scene) return;
if (target === this.ambientLight || this.directionalLights.includes(target)) return;
if (target === this.ambientLight || this.directionalLights.includes(target))
return;

@@ -537,7 +589,6 @@ this.cameraControls.focus(target);

grid.visible = false;
grid.traverse(child => {
grid.traverse((child) => {
child.visible = false;
})
});
this.grids.push(grid);

@@ -548,3 +599,3 @@ this.addModel(grid);

changeGirdVisible() {
this.grids.forEach(item => {
this.grids.forEach((item) => {
item.visible = !item.visible;

@@ -562,2 +613,5 @@ });

setSize(width, height) {
if (!this.dom) {
return;
}
if (width && height) {

@@ -584,3 +638,8 @@ this.dom.width = width;

// 节流?
this.renderer.setViewport(0, 0, this.dom.offsetWidth, this.dom.offsetHeight);
this.renderer.setViewport(
0,
0,
this.dom.offsetWidth,
this.dom.offsetHeight
);
this.renderer.render(this.scene, this.camera);

@@ -599,4 +658,4 @@ this.renderer.autoClear = false;

clear() {
this.scene.children.forEach(item => {
this.removeModel(item)
this.scene.children.forEach((item) => {
this.removeModel(item);
});

@@ -603,0 +662,0 @@ this.renderer.dispose();

@@ -1,7 +0,7 @@

import * as THREE from 'star_mod_custom_three';
import * as THREE from "star_mod_custom_three";
import TgaLoader from "tga-js";
import { RenderBase } from './render.base';
import {
getEnvMapByName,
defaultModel,
import { RenderBase } from "./render.base";
import {
getEnvMapByName,
defaultModel,
defaultModelAnimation,

@@ -12,10 +12,6 @@ FEMALE_HAIR_KEY,

MALE_HEAD_MATERIAL_KEY,
} from "./default";
import { ModelProcessor } from './helper/modelHelper/index';
import {
calculateVerticesAndFace,
} from './helper/calculate';
import {
loadFile
} from "./helper/filesHelper";
} from "./default";
import { ModelProcessor } from "./helper/modelHelper/index";
import { calculateVerticesAndFace } from "./helper/calculate";
import { loadFile } from "./helper/filesHelper";

@@ -31,24 +27,32 @@ export class Render extends RenderBase {

constructor({ container, platform } = { container: null, platform: 'pc' }) {
super({ mode: 'render', dom: container });
constructor(
{ container, platform, isShowScene } = {
container: null,
platform: "pc",
isShowScene: true,
}
) {
super({ mode: "render", dom: container });
this.setAnimationLoop(() => {
this.customUpdate();
});
let processEnv = 'domestic';
let processEnv = "domestic";
try {
if (platform === 'pc') {
if (platform === "pc") {
processEnv = process.env.VUE_APP_NAME;
} else if (platform === 'mobile') {
processEnv = import.meta.env.VITE_APP_NAME
} else if (platform === "mobile") {
processEnv = import.meta.env.VITE_APP_NAME;
}
} catch (e) {
console.error(e);
processEnv = 'domestic';
processEnv = "domestic";
}
getEnvMapByName('sky', processEnv).then(env => {
this.setSceneEnvironment(env.data);
});
if (isShowScene) {
getEnvMapByName("sky", processEnv).then((env) => {
this.setSceneEnvironment(env.data);
});
}
}
setRenderModel(model) {
setRenderModel(model, isShowModelInfo = true) {
// 计算设置模型

@@ -72,20 +76,10 @@ const modelRender = new ModelProcessor(model);

}
this.directionalLights[0].position.set(
max * 2,
max * 2,
max * 2
);
this.directionalLights[1].position.set(
max * -2,
max * -2,
max * -2
);
this.directionalLights[2].position.set(
0,
max * -2,
max * 2
);
this.directionalLights[0].position.set(max * 2, max * 2, max * 2);
this.directionalLights[1].position.set(max * -2, max * -2, max * -2);
this.directionalLights[2].position.set(0, max * -2, max * 2);
this.modelRender = modelRender;
this.handleRenderModelInfo();
if (isShowModelInfo) {
this.handleRenderModelInfo();
}
}

@@ -95,4 +89,4 @@

const group = new THREE.Group();
const modelRenderList = []
list.forEach(model => {
const modelRenderList = [];
list.forEach((model) => {
const modelRender = new ModelProcessor(model);

@@ -122,3 +116,3 @@ group.add(modelRender.getModel());

url: meshUrl,
type: 'fbx'
type: "fbx",
});

@@ -141,3 +135,3 @@ const modelRender = new ModelProcessor(mesh);

url: meshUrl,
type: 'fbx'
type: "fbx",
});

@@ -162,4 +156,5 @@ const modelRender = new ModelProcessor(mesh);

setAnimationList(list) {
const bones = this.combinationModelGroup.children[1].children[0].clone(true);
if (this.combinationModelGroup.children[0].children[0].type === 'Bone') {
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);

@@ -171,3 +166,7 @@ }

playAnimation(index) {
const flock = new THREE.AnimationObjectGroup(this.combinationModelGroup.children[0], this.maleHeadModel, this.combinationModelGroup.children[1]);
const flock = new THREE.AnimationObjectGroup(
this.combinationModelGroup.children[0],
this.maleHeadModel,
this.combinationModelGroup.children[1]
);
this.mixer = new THREE.AnimationMixer(flock);

@@ -181,16 +180,23 @@ this.animationAction = this.mixer.clipAction(this.animations[index]);

if (defaultModelAnimation[key]) {
const url = defaultModelAnimation[key].dancing.domesticPath;
const url = defaultModelAnimation[key].dancing.domesticPath;
const file = await loadFile({
url,
type: 'fbx'
type: "fbx",
});
const modelRender = new ModelProcessor(file);
const bones = this.combinationModelGroup.children[1].children[0].clone(true);
if (this.combinationModelGroup.children[0].children[0].type === 'Bone') {
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);
}
const flock = new THREE.AnimationObjectGroup(this.combinationModelGroup.children[0], this.maleHeadModel, this.combinationModelGroup.children[1]);
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(modelRender.getModel().animations[0]);
// modelRender.getModel()
this.animationAction = this.mixer.clipAction(
modelRender.getModel().animations[0]
);
this.animationAction.play();

@@ -204,17 +210,19 @@ }

const size = mainObject.getModelSize();
const div = document.createElement('div');
const div = document.createElement("div");
div.innerHTML = `
vertices: ${vertices}<br>
triangles: ${faces}<br>
size: ${parseInt(size.x)}cm * ${parseInt(size.y)}cm * ${parseInt(size.z)}cm
size: ${parseInt(size.x)}cm * ${parseInt(size.y)}cm * ${parseInt(
size.z
)}cm
`;
div.style.position = 'absolute';
div.style.bottom = '6px';
div.style.left = '6px';
div.style.color = '#fff';
div.style.fontSize = '12px';
div.style.zIndex = '100';
div.style.transform = 'scale(0.8)';
div.style.transformOrigin = 'left bottom';
div.style.textAlign = 'left';
div.style.position = "absolute";
div.style.bottom = "6px";
div.style.left = "6px";
div.style.color = "#fff";
div.style.fontSize = "12px";
div.style.zIndex = "100";
div.style.transform = "scale(0.8)";
div.style.transformOrigin = "left bottom";
div.style.textAlign = "left";

@@ -254,3 +262,2 @@ this.dom.appendChild(div);

}
}

@@ -260,5 +267,10 @@

if (this.renderer) {
this.renderer.setViewport(0, 0, this.dom.offsetWidth, this.dom.offsetHeight);
this.renderer.setViewport(
0,
0,
this.dom.offsetWidth,
this.dom.offsetHeight
);
this.renderer.render(this.scene, this.camera);
if(this.mixer!==null){
if (this.mixer !== null) {
//clock.getDelta()方法获得两帧的时间间隔

@@ -271,2 +283,3 @@ // 更新混合器相关的时间

let imgData = this.renderer.domElement.toDataURL("image/jpeg");
console.log("this.renderer");
img.src = imgData;

@@ -284,6 +297,7 @@

this.generateCurrFrameFlag = true;
console.log("this.generateCurrFrameFlag", this.generateCurrFrameFlag);
setTimeout(() => {
resolve(this.currFrame);
}, 100);
})
});
}

@@ -290,0 +304,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