import * as THREE from 'https://esm.sh/three'; import { BaseGeometryElement } from './ThreeBaseGeometry.js'; const attrs_position = [ 'x', 'y', 'z' ]; const attrs_dimensions = [ 'height', 'width', 'depth' ]; export class CubeElement extends BaseGeometryElement { parentO3DCallback(parent) { var scene = this.closest('three-scene'); this.geometry = new THREE.BoxGeometry(this.width, this.height, this.depth); // width, height, depth this.material = new THREE.MeshLambertMaterial({ color: this.color }); this.mesh = new THREE.Mesh(this.geometry, this.material); this.mesh.position.set(this.x, this.y, this.z); // Optional, 0,0,0 is the default parent.add(this.mesh); } } customElements.define('three-cube', CubeElement);