Wrote code that creates a simple scene:
__INIT = function () { that = this; this.editor_place = document.getElementById("editor_place"); this.cW = editor_place.clientWidth; this.cH = editor_place.clientHeight; load = new Loader; autoload = new AutoLoader; this.renderer = new THREE.WebGLRenderer({ alpha: 1, precision: "lowp", devicePixelRatio: 1, antialias: true }) this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; this.renderer.setClearColor(16777215, 0); this.renderer.setPixelRatio(window.devicePixelRatio); this.renderer.setSize(this.cW, this.cH); this.scene = new THREE.Scene; this.camera = new THREE.PerspectiveCamera(45, this.cW / this.cH, 0.1, 2E4); this.camera.position.set(0, 150, 300); this.camera.lookAt(this.scene.position); this.scene.add(this.camera); //this.controls = new THREE.EditorControls(this.camera, this.renderer.domElement); var grid = new THREE.GridHelper(500, 10, 0xBDC3C7, 0x6C7A89); grid.position = new THREE.Vector3(0, 0, 0); grid.rotation = new THREE.Euler(0, Math.PI / 2, 0); this.scene.add(grid); light = new THREE.DirectionalLight; light.position.set(20, 50, 30); this.scene.add(light); light = new THREE.DirectionalLight; light.position.set(-25, 50, -15); this.scene.add(light); this.cubes = new THREE.Object3D this.scene.add(this.cubes); //this.control = new THREE.TransformControls(this.camera, this.renderer.domElement); //this.control.addEventListener("change", this.render); //this.control.setTranslationSnap(1); //this.scene.add(this.control); this.scene.jqContainer = $("#editor_place"); this.animate = function () { requestAnimationFrame(that.animate); //that.control.update(); that.renderer.render(that.scene, that.camera) } } window.onload = function () { editor = new __INIT(); editor.animate(); }; And he did not earn:
- Comments in the code for good reason, without them the error: THREE.EditorControls (or TransformControls) is not a constructor
- And, even when outputting “THREE.WebGLRenderer 77” to the console, it shows nothing
I rummaged everything, I do not know where to dig: (