提交 8bf406ca 编写于 作者: M Mr.doob

Editor: Tweaked global editor/THREE code.

上级 3c5724b2
......@@ -67,7 +67,9 @@
//
var editor = new Editor();
window.editor = editor;
window.editor = editor; // Expose editor to Console
window.THREE = THREE; // Expose THREE to APP Scripts and Console
var viewport = new Viewport( editor );
document.body.appendChild( viewport.dom );
......
......@@ -2,12 +2,10 @@
* @author mrdoob / http://mrdoob.com/
*/
import * as THREE from '../../build/three.module.js';
import { UIPanel } from './libs/ui.js';
import { APP } from './libs/app.js';
var Player = function ( editor ) {
function Player( editor ) {
var signals = editor.signals;
......@@ -18,7 +16,7 @@ var Player = function ( editor ) {
//
var player = new APP.Player( THREE );
var player = new APP.Player();
container.dom.appendChild( player.dom );
window.addEventListener( 'resize', function () {
......@@ -48,6 +46,6 @@ var Player = function ( editor ) {
return container;
};
}
export { Player };
......@@ -4,9 +4,7 @@
var APP = {
Player: function ( THREE ) {
window.THREE = THREE; // FIX for editor scripts (they require THREE in global namespace)
Player: function () {
var renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
......
......@@ -22,10 +22,12 @@
import * as THREE from './js/three.module.js';
import { APP } from './js/app.js';
window.THREE = THREE; // Used by APP Scripts.
var loader = new THREE.FileLoader();
loader.load( 'app.json', function ( text ) {
var player = new APP.Player( THREE );
var player = new APP.Player();
player.load( JSON.parse( text ) );
player.setSize( window.innerWidth, window.innerHeight );
player.play();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册