Redid the creation of the object.
0
When creating an object with a mouse movement, the size of the object changes. Previously, this was decided by deleting the old object and creating at the same point a new one with a new size.
Now the geometry of this object is changing.
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;
Added icons to buttons. I think to leave only icons or all the same with inscriptions. The images of the icons themselves should be redone, of course.
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'; } );
0