PMVLedBulbEditor2

by murgiaMarco

HTML

<html lang="en">
	<head>
		<title>pmvEditor</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="https://threejs.org/files/main.css">
	</head>
	<body oncontextmenu="return false;">

		<script type="module">



			import * as THREE from 'https://threejs.org//build/three.module.js';

			import Stats from 'https://threejs.org/examples/jsm/libs/stats.module.js';

			let camera, scene, renderer, stats, group, raycaster;
      

			let buttonMouse;
			let INTERSECTED;
			let mouseX = 0, mouseY = 0;

			let windowHalfX = window.innerWidth / 2;
			let windowHalfY = window.innerHeight / 2;

        let materialLedOff = new THREE.MeshBasicMaterial( {color: 0x000000} );

        let materialLedOn = new THREE.MeshBasicMaterial( {color: 0xffffff} );
			
      
      let ledArray = [];
      let mouseDown = false;
      let mouseDrag = false;

				let  zDistance = 10;

			  let  hMax = 60;
        let  lMax = 60;
        
        let  space = 10;
        let  margin = 10;

      
      init();
			animate();

			function init() {

        
        
          var mnuItem = document.createElement("button");
 				 mnuItem.name = name;
          mnuItem.innerHTML = "ExportData";
          mnuItem.addEventListener("click", readArray);
          mnuItem.style.position = "absolute";
          mnuItem.style.right = "0px";

          document.body.appendChild(mnuItem);
        
        
        
				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
        
        
        
        
        var commandAxe = (hMax < lMax) ? lMax : hMax;
        
				camera.position.z = zDistance * commandAxe;
camera.position.x += ((lMax * space)/2) - space;				
				/* camera.position.x = 0 */;
         
         camera.position.y += ((hMax * space)/2) - space;

				scene = new THREE.Scene();
				scene.background = new...