Переделал создание объекта.
1+
При создании объекта при движении мыши меняется размер объекта. Ранее это было решено удалением старого объекта и созданием в этой же точке нового с новым размером.
Сейчас меняется геометрия этого объекта.
TA_Enteties.js
this.updateObject = function( parameterName, parameterValue, entity ) {
let geom = entity.geometry;
let params = {};
Object.assign( params, geom.parameters );
params[ parameterName ] = parameterValue;
let newGeom = this.createGeometry ( entity.geometry.type, params );
entity.geometry.dispose();
entity.geometry = newGeom;
}
switch (mode.entity) {
case 'BoxBufferGeometry':
if (this.currentEntity !== null ) {
GLOBALSCOPE.updateObject( 'width', width, this.currentEntity);
GLOBALSCOPE.updateObject( 'height', width, this.currentEntity);
GLOBALSCOPE.updateObject( 'depth', width, this.currentEntity);
}
else{
this.currentEntity = GLOBALSCOPE.createBox(x, y, z, width, width, width, 'material');
this.currentEntity.name = "CUBE";
scene.add(this.currentEntity);
}
break;
case 'SphereBufferGeometry':
if (this.currentEntity !== null ) {
GLOBALSCOPE.updateObject( 'radius', width, this.currentEntity);
}
else{
this.currentEntity = GLOBALSCOPE.createSphere(x, y, z, width, 12);
this.currentEntity.name = "SPHERE";
scene.add(this.currentEntity);
}
break;
default:
break;
Добавил иконки к кнопкам. Думаю оставить только иконки или все-таки с надписями. Сами изображения иконок надо б переделать, конечно.
TA_UI.js
addElement( container, elementName, text, imgLink, func ) {
let dom = document.createElement( elementName );
container.appendChild( dom );
let img = document.createElement( 'img' );
img.src = ( imgLink );
dom.innerHTML = text;
dom.appendChild( img );
if (typeof( func ) === 'function') {
dom.addEventListener( 'click', func, false );
}
return dom;
}
TertuisAxis.js
let buttonCube = taUI.addElement(
addToSceneContainer,
'button',
'',
"./ico/cubeico.PNG",
function () {
taScene.mode.action = 'creationEntity';
taScene.mode.entity = 'BoxBufferGeometry';
}
);


1+
