/
counterbugtech
/
KontrBugCAD
Обзор
Документация
Войти
/
counterbugtech
/
KontrBugCAD
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/core/parametric/executors/ImageExecutor.js
1 строка
768 B
counterbugtech
first commit
04 мар 2026, 11:25
Верифицирован
04 мар 2026, 11:25
b2afbd6
Код
Авторство
О чём код?
import*as THREE from"three";import{ParametricExecutor}from"./ParametricExecutor.js";export class ImageExecutor extends ParametricExecutor{execute(t,e){const{imageURL:r,width:o,height:a,depth:i,position:n,rotation:c,opacity:p,transparent:s,color:u}=t.parameters,E=(new THREE.TextureLoader).load(r);E.transparent=s,E.colorSpace=THREE.SRGBColorSpace;const m=new THREE.MeshStandardMaterial({map:E,transparent:s,opacity:p,color:u||16777215,side:THREE.DoubleSide}),d=new THREE.BoxGeometry(o,a,i),h=new THREE.Mesh(d,m);return h.position.fromArray(n),h.rotation.fromArray(c),h.castShadow=!0,h.receiveShadow=!0,h.userData={type:"image",imageURL:r,width:o,height:a,depth:i,opacity:p,transparent:s,rotation:c,color:u},t.outputs.length>0?h.uuid=t.outputs[0]:t.outputs=[h.uuid],h}}