提交 0824e113 编写于 作者: M Mr.doob

Editor: Removed editable setting.

上级 794dfc49
......@@ -4,7 +4,6 @@
},
"project": {
"shadows": true,
"editable": true,
"vr": false
},
"camera": {
......@@ -205,4 +204,4 @@
"source": "var ball = this.getObjectByName( 'Ball' );\n\nvar direction = new THREE.Vector3();\ndirection.x = Math.random() - 0.5;\ndirection.z = - 0.5;\ndirection.normalize();\n\nvar speed = new THREE.Vector3();\n\n//\n\nvar group = new THREE.Group();\nthis.add( group );\n\nvar paddle = this.getObjectByName( 'Paddle' );\npaddle.material.visible = false;\ngroup.add( paddle );\n\nvar brick = this.getObjectByName( 'Brick' );\n\nfor ( var j = 0; j < 8; j ++ ) {\n\n\tvar material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );\n\n\tfor ( var i = 0; i < 12; i ++ ) {\n\t\t\n\t\tvar object = brick.clone();\n\t\tobject.position.x = i * 22 - 120;\n\t\tobject.position.z = j * 14 - 120;\n\t\tgroup.add( object );\n\n\t\tvar cylinder = object.getObjectByName( 'Cylinder' );\n\t\tcylinder.material = material;\n\n\t}\n\t\n}\n\nbrick.visible = false;\nbrick.material.visible = false;\n\n//\n\nvar raycaster = new THREE.Raycaster();\n\nfunction update( event ) {\n\t\n\tif ( ball.position.x < - 150 || ball.position.x > 150 ) direction.x = - direction.x;\n\tif ( ball.position.z < - 200 || ball.position.z > 200 ) direction.z = - direction.z;\n\n\tball.position.x = Math.max( - 150, Math.min( 150, ball.position.x ) );\n\tball.position.z = Math.max( - 200, Math.min( 200, ball.position.z ) );\n\t\n\tball.position.add( speed.copy( direction ).multiplyScalar( event.delta / 4 ) );\n\t\n\traycaster.set( ball.position, direction );\n\t\n\tvar intersections = raycaster.intersectObjects( group.children );\n\t\n\tif ( intersections.length > 0 ) {\n\t\n\t\tvar intersection = intersections[ 0 ];\n\t\t\n\t\tif ( intersection.distance < 5 ) {\n\t\t\t\n\t\t\tif ( intersection.object !== paddle ) {\n\n\t\t\t\tgroup.remove( intersection.object );\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tdirection.reflect( intersection.face.normal );\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n}"
}]
}
}
\ No newline at end of file
}
......@@ -4,7 +4,6 @@
},
"project": {
"shadows": true,
"editable": true,
"vr": false
},
"camera": {
......@@ -187,4 +186,4 @@
"source": "function update( event ) {\n\n\tvar time = event.time * 0.001;\n\n\tthis.position.x = Math.sin( time ) * 400;\n\tthis.position.z = Math.cos( time ) * 400;\n\tthis.lookAt( scene.position );\n\n}"
}]
}
}
\ No newline at end of file
}
......@@ -4,7 +4,6 @@
},
"project": {
"shadows": true,
"editable": true,
"vr": false
},
"camera": {
......@@ -97,4 +96,4 @@
"source": "var original = this.getObjectByName( 'Particle' );\n\nvar particles = [];\n\nfor ( var i = 0; i < 100; i ++ ) {\n\n\tvar particle = original.clone();\n\tparticle.userData.velocity = new THREE.Vector3();\n\tthis.add( particle );\n\n\tparticles.push( particle );\n\n}\n\nfunction update( event ) {\n\t\n\tvar particle = particles.shift();\n\tparticles.push( particle );\n\t\t\n\tvar velocity = particle.userData.velocity;\n\tvelocity.x = Math.random() - 0.5;\n\tvelocity.y = Math.random() + 1;\n\tvelocity.z = Math.random() - 0.5;\n\n\tfor ( var i = 0; i < particles.length; i ++ ) {\n\n\t\tvar particle = particles[ i ];\n\n\t\tvar velocity = particle.userData.velocity;\n\n\t\tvelocity.y -= 0.098;\n\n\t\tparticle.position.add( velocity );\n\n\t\tif ( particle.position.y < 0 ) {\n\n\t\t\tparticle.position.y = 0;\n\n\t\t\tvelocity.y = - velocity.y;\n\t\t\tvelocity.multiplyScalar( 0.6 );\n\n\t\t}\n\n\t}\n\n}"
}]
}
}
\ No newline at end of file
}
......@@ -4,7 +4,6 @@
},
"project": {
"shadows": false,
"editable": false,
"vr": false
},
"camera": {
......
......@@ -13,7 +13,6 @@ var Config = function ( name ) {
'project/renderer/gammaInput': false,
'project/renderer/gammaOutput': false,
'project/renderer/shadows': true,
'project/editable': false,
'project/vr': false,
'settings/history': false
......
......@@ -500,7 +500,6 @@ Editor.prototype = {
gammaInput: this.config.getKey( 'project/renderer/gammaInput' ),
gammaOutput: this.config.getKey( 'project/renderer/gammaOutput' ),
shadows: this.config.getKey( 'project/renderer/shadows' ),
editable: this.config.getKey( 'project/editable' ),
vr: this.config.getKey( 'project/vr' )
},
camera: this.camera.toJSON(),
......
......@@ -101,20 +101,6 @@ Sidebar.Project = function ( editor ) {
container.add( rendererPropertiesRow );
// Editable
var editableRow = new UI.Row();
var editable = new UI.Checkbox( config.getKey( 'project/editable' ) ).setLeft( '100px' ).onChange( function () {
config.setKey( 'project/editable', this.getValue() );
} );
editableRow.add( new UI.Text( 'Editable' ).setWidth( '90px' ) );
editableRow.add( editable );
container.add( editableRow );
// VR
var vrRow = new UI.Row();
......
......@@ -6,8 +6,6 @@ var APP = {
Player: function () {
var scope = this;
var loader = new THREE.ObjectLoader();
var camera, scene, renderer;
......
......@@ -6,26 +6,13 @@
<meta name="generator" content="Three.js Editor">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
background-color: #000;
margin: 0px;
overflow: hidden;
}
#edit {
position: absolute;
bottom: 20px;
right: 20px;
padding: 8px;
color: #555;
background-color: #fff;
opacity: 0.5;
}
#edit:hover {
cursor: pointer;
opacity: 1;
}
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
background-color: #000;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body ontouchstart="">
......@@ -37,30 +24,13 @@
var loader = new THREE.FileLoader();
loader.load( 'app.json', function ( text ) {
var json = JSON.parse( text );
var player = new APP.Player();
player.load( json );
player.load( JSON.parse( text ) );
player.setSize( window.innerWidth, window.innerHeight );
player.play();
document.body.appendChild( player.dom );
if ( json.project.editable === true ) {
var button = document.createElement( 'div' );
button.id = 'edit';
button.textContent = 'EDIT';
button.addEventListener( 'click', function ( event ) {
var url = location.href.split( '/' ).slice( 0, - 1 ).join( '/' );
window.open( 'http://threejs.org/editor/#file=' + url + '/app.json' );
}, false );
document.body.appendChild( button );
}
window.addEventListener( 'resize', function () {
player.setSize( window.innerWidth, window.innerHeight );
} );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册