diff --git a/ShadowEditor.Web/examples/arkanoid.app.json b/ShadowEditor.Web/examples/arkanoid.app.json deleted file mode 100644 index 7b5e109e..00000000 --- a/ShadowEditor.Web/examples/arkanoid.app.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "metadata": { - "type": "App" - }, - "project": { - "shadows": true, - "vr": false - }, - "camera": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "object": { - "uuid": "E41E9F54-8B31-4D1F-8D09-AF5E802E9A22", - "type": "PerspectiveCamera", - "name": "Camera", - "matrix": [0.9392361044883728,-2.8092810300250903e-9,-0.3432718515396118,0,-0.14778217673301697,0.902585506439209,-0.404351145029068,0,0.3098321855068207,0.43051064014434814,0.847740888595581,0,142.32125854492188,202.75485229492188,389.40936279296875,1], - "fov": 50, - "aspect": 1.536388140161725, - "near": 0.1, - "far": 100000 - } - }, - "scene": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "geometries": [ - { - "uuid": "8F05A1F2-3877-478B-8DFC-F572AC61AB3A", - "type": "PlaneGeometry", - "width": 300, - "height": 400, - "widthSegments": 1, - "heightSegments": 1 - }, - { - "uuid": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5", - "type": "CylinderGeometry", - "radiusTop": 5, - "radiusBottom": 5, - "height": 20, - "radialSegments": 32, - "heightSegments": 1, - "openEnded": false - }, - { - "uuid": "7149652B-DBD7-4CB7-A600-27A9AC005C95", - "type": "BoxGeometry", - "width": 20, - "height": 10, - "depth": 10, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }, - { - "uuid": "CABCC711-1331-4D4C-9FF6-409299F10C68", - "type": "SphereGeometry", - "radius": 5, - "widthSegments": 32, - "heightSegments": 16, - "phiStart": 0, - "phiLength": 6.28, - "thetaStart": 0, - "thetaLength": 3.14 - }, - { - "uuid": "EFBF641D-F092-462E-B7FB-0BFAD1591EFC", - "type": "BoxGeometry", - "width": 20, - "height": 10, - "depth": 10, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }], - "materials": [ - { - "uuid": "2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF", - "type": "MeshPhongMaterial", - "color": 86015, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655", - "type": "MeshPhongMaterial", - "color": 16777215, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "D98FC4D1-169E-420A-92EA-20E55009A46D", - "type": "MeshBasicMaterial", - "wireframe": true, - "color": 63744 - }, - { - "uuid": "043B208C-1F83-42C6-802C-E0E35621C27C", - "type": "MeshPhongMaterial", - "color": 16777215, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB", - "type": "MeshBasicMaterial", - "wireframe": true, - "color": 63744 - }], - "object": { - "uuid": "31517222-A9A7-4EAF-B5F6-60751C0BABA3", - "type": "Scene", - "name": "Scene", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "children": [ - { - "uuid": "EBBB1E63-6318-4752-AE2E-440A4E0B3EF3", - "type": "Mesh", - "name": "Ground", - "matrix": [1,0,0,0,0,0.0007960614748299122,-0.9999997019767761,0,0,0.9999997019767761,0.0007960614748299122,0,0,0,0,1], - "geometry": "8F05A1F2-3877-478B-8DFC-F572AC61AB3A", - "material": "2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF" - }, - { - "uuid": "6EE2E764-43E0-48E0-85F2-E0C8823C20DC", - "type": "DirectionalLight", - "name": "DirectionalLight 1", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,100,200,150,1], - "color": 16777215, - "intensity": 1 - }, - { - "uuid": "38219749-1E67-45F2-AB15-E64BA0940CAD", - "type": "Mesh", - "name": "Brick", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,5,0,1], - "children": [ - { - "uuid": "711A5955-8F17-4A8B-991A-7604D27E6FA0", - "type": "Mesh", - "name": "Cylinder", - "matrix": [0.0007962009985931218,0.0007962677045725286,0.9999995231628418,0,-0.9999997615814209,3.462185702574061e-7,0.0007962677045725286,0,2.210134084634774e-7,-0.9999997615814209,0.0007962008821777999,0,0,0,0,1], - "geometry": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5", - "material": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655" - }], - "geometry": "7149652B-DBD7-4CB7-A600-27A9AC005C95", - "material": "D98FC4D1-169E-420A-92EA-20E55009A46D" - }, - { - "uuid": "18FFA67C-F893-4E7A-8A76-8D996DEBE0C6", - "type": "Mesh", - "name": "Ball", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,5,35.54999923706055,1], - "geometry": "CABCC711-1331-4D4C-9FF6-409299F10C68", - "material": "043B208C-1F83-42C6-802C-E0E35621C27C" - }, - { - "uuid": "6D660D49-39B8-40C3-95F6-E4E007AA8D79", - "type": "Mesh", - "name": "Paddle", - "matrix": [2,0,0,0,0,1,0,0,0,0,1,0,0,5,159.5399932861328,1], - "children": [ - { - "uuid": "4F5F884C-9E1B-45E6-8F1E-4D538A46D8CB", - "type": "Mesh", - "name": "Cylinder", - "matrix": [0.0007962009985931218,0.0007962677045725286,0.9999995231628418,0,-0.9999997615814209,3.462185702574061e-7,0.0007962677045725286,0,2.210134084634774e-7,-0.9999997615814209,0.0007962008821777999,0,0,0,0,1], - "geometry": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5", - "material": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655" - }], - "geometry": "EFBF641D-F092-462E-B7FB-0BFAD1591EFC", - "material": "40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB" - }, - { - "uuid": "B0BEAF69-8B5D-4D87-ADCA-FDE83A02762D", - "type": "PointLight", - "name": "PointLight 2", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-116.54356384277344,69.48957061767578,-206.8248291015625,1], - "color": 16777215, - "intensity": 1, - "distance": 0, - "decay": 1 - }] - } - }, - "scripts": { - "6D660D49-39B8-40C3-95F6-E4E007AA8D79": [ - { - "name": "User", - "source": "function mousemove( event ) {\n\n\tthis.position.x = ( event.clientX / player.width ) * 300 - 150;\n\n}\n\n// function update( event ) {}" - }], - "31517222-A9A7-4EAF-B5F6-60751C0BABA3": [ - { - "name": "Game Logic", - "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}" - }] - } -} diff --git a/ShadowEditor.Web/examples/camera.app.json b/ShadowEditor.Web/examples/camera.app.json deleted file mode 100644 index f35b02bd..00000000 --- a/ShadowEditor.Web/examples/camera.app.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "metadata": { - "type": "App" - }, - "project": { - "shadows": true, - "vr": false - }, - "camera": { - "metadata": { - "version": 4.3, - "type": "Object", - "generator": "ObjectExporter" - }, - "object": { - "uuid": "C7FB195B-270E-47B4-95C9-1754652A9D11", - "type": "PerspectiveCamera", - "name": "Camera", - "fov": 50, - "aspect": 1.2252042007001167, - "near": 0.1, - "far": 100000, - "matrix": [0.9700406789779663,-2.851828329042405e-9,-0.24294254183769226,0,-0.04822639003396034,0.9800989627838135,-0.1925622522830963,0,0.23810774087905884,0.19850945472717285,0.950735867023468,0,154.7735595703125,129.03408813476562,617.992431640625,1] - } - }, - "scene": { - "metadata": { - "version": 4.3, - "type": "Object", - "generator": "ObjectExporter" - }, - "geometries": [ - { - "uuid": "51BB3E54-D2DF-4576-9953-FB8E940588B5", - "type": "PlaneGeometry", - "width": 1000, - "height": 1000, - "widthSegments": 1, - "heightSegments": 1 - }, - { - "uuid": "D8E200D3-27BC-49F8-A5C5-7384206E70FE", - "type": "BoxGeometry", - "width": 100, - "height": 100, - "depth": 100, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }, - { - "uuid": "25BA32DB-8B02-4ABA-A77C-69868C464A1A", - "type": "CylinderGeometry", - "radiusTop": 0, - "radiusBottom": 40, - "height": 75, - "radialSegments": 4, - "heightSegments": 1, - "openEnded": false - }, - { - "uuid": "4DECFAB5-6FD1-4D84-9A29-565807B074EA", - "type": "IcosahedronGeometry", - "radius": 40, - "detail": 2 - }], - "materials": [ - { - "uuid": "4AE8130E-B6A8-47BC-ACCF-060973C74044", - "type": "MeshPhongMaterial", - "color": 16777215, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "B5943856-E404-45D9-A427-4774202C2CD0", - "type": "MeshPhongMaterial", - "color": 37119, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "3F872310-2067-4BE4-9250-5B3F4E43797E", - "type": "MeshPhongMaterial", - "color": 15859456, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "E1826901-7922-4584-A25D-6D487E2C9BBD", - "type": "MeshPhongMaterial", - "color": 16711680, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }], - "object": { - "uuid": "3741222A-BD8F-401C-A5D2-5A907E891896", - "type": "Scene", - "name": "Scene", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "children": [ - { - "uuid": "B7CBBC6F-EC26-49B5-8D0D-67D9C535924B", - "type": "Group", - "name": "Dummy", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,100,400,1], - "children": [ - { - "uuid": "60B69C58-4201-43FD-815E-AD2EDFBBD0CE", - "type": "PerspectiveCamera", - "name": "PerspectiveCamera", - "fov": 50, - "aspect": 1, - "near": 100, - "far": 10000, - "matrix": [-1,0,-1.2246468525851679e-16,0,0,1,0,0,1.2246468525851679e-16,0,-1,0,0,0,0,1] - }] - }, - { - "uuid": "A460C230-DC88-4A8F-A3FB-AA0FE735F3ED", - "type": "Mesh", - "name": "Plane", - "geometry": "51BB3E54-D2DF-4576-9953-FB8E940588B5", - "material": "4AE8130E-B6A8-47BC-ACCF-060973C74044", - "matrix": [1,0,0,0,0,0.040785226970911026,-0.9991679191589355,0,0,0.9991679191589355,0.040785226970911026,0,0,-50,0,1] - }, - { - "uuid": "26DAAD69-725D-43B7-AF9D-990A99DEF8C5", - "type": "Mesh", - "name": "Box", - "geometry": "D8E200D3-27BC-49F8-A5C5-7384206E70FE", - "material": "B5943856-E404-45D9-A427-4774202C2CD0", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1] - }, - { - "uuid": "AAAFF2D6-4725-4AFC-A9FE-26419B11011F", - "type": "Mesh", - "name": "Cylinder", - "geometry": "25BA32DB-8B02-4ABA-A77C-69868C464A1A", - "material": "3F872310-2067-4BE4-9250-5B3F4E43797E", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-130,-15,0,1] - }, - { - "uuid": "B855E267-A266-4098-ACD6-6A1FDE7B88BA", - "type": "Mesh", - "name": "Icosahedron", - "geometry": "4DECFAB5-6FD1-4D84-9A29-565807B074EA", - "material": "E1826901-7922-4584-A25D-6D487E2C9BBD", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,130,-10,0,1] - }, - { - "uuid": "E2939A7B-5E40-438A-8C1B-32126FBC6892", - "type": "PointLight", - "name": "PointLight 1", - "color": 9474221, - "intensity": 0.75, - "distance": 0, - "decay": 1, - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-93.86000061035156,127.12999725341797,-114.30000305175781,1] - }, - { - "uuid": "3412781E-27CC-43C3-A5DB-54C0C8E42ED6", - "type": "PointLight", - "name": "PointLight 2", - "color": 12773063, - "intensity": 1, - "distance": 0, - "decay": 1, - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,88.12999725341797,8.3100004196167,125.44999694824219,1] - }] - } - }, - "scripts": { - "60B69C58-4201-43FD-815E-AD2EDFBBD0CE": [ - { - "name": "Player Camera", - "source": "player.setCamera( this );" - }], - "B7CBBC6F-EC26-49B5-8D0D-67D9C535924B": [ - { - "name": "Orbit", - "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}" - }] - } -} diff --git a/ShadowEditor.Web/examples/particles.app.json b/ShadowEditor.Web/examples/particles.app.json deleted file mode 100644 index 4c184e97..00000000 --- a/ShadowEditor.Web/examples/particles.app.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "metadata": { - "type": "App" - }, - "project": { - "shadows": true, - "vr": false - }, - "camera": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "object": { - "uuid": "763F3000-7D7C-4BE6-80B6-914DEEBD9AA2", - "type": "PerspectiveCamera", - "name": "Camera", - "matrix": [0.7071067690849304,-3.398992198810902e-11,-0.7071068286895752,0,-0.2357022613286972,0.9428090453147888,-0.235702246427536,0,0.6666666865348816,0.3333333134651184,0.6666666269302368,0,41.824005126953125,20.912002563476562,41.824005126953125,1], - "fov": 50, - "zoom": 1, - "near": 0.1, - "far": 100000, - "focus": 10, - "aspect": 0.46657381615598886, - "filmGauge": 35, - "filmOffset": 0 - } - }, - "scene": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "geometries": [ - { - "uuid": "E80D9EC5-D722-4812-8226-5F355EAC9B96", - "type": "PlaneGeometry", - "width": 1000, - "height": 1000, - "widthSegments": 1, - "heightSegments": 1 - }], - "materials": [ - { - "uuid": "3A9449D2-62DB-4BB4-ABBD-6F3F9D46DE1A", - "type": "MeshStandardMaterial", - "color": 5465019, - "roughness": 1, - "metalness": 0, - "emissive": 0 - }, - { - "uuid": "F5361474-F5F1-412F-8D99-3699B868092D", - "type": "SpriteMaterial", - "color": 16777215 - }], - "object": { - "uuid": "3741222A-BD8F-401C-A5D2-5A907E891896", - "type": "Scene", - "name": "Scene", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "children": [ - { - "uuid": "05B57416-1BE5-4A96-BB05-9D9CD112D52B", - "type": "Mesh", - "name": "Ground", - "matrix": [1,0,0,0,0,0.0007959486683830619,-0.9999997019767761,0,0,0.9999997019767761,0.0007959486683830619,0,0,-0.5,0,1], - "geometry": "E80D9EC5-D722-4812-8226-5F355EAC9B96", - "material": "3A9449D2-62DB-4BB4-ABBD-6F3F9D46DE1A" - }, - { - "uuid": "0A3CB873-07E6-4EEB-830B-68192504111B", - "type": "Sprite", - "name": "Particle", - "matrix": [0.4000000059604645,0,0,0,0,0.4000000059604645,0,0,0,0,0.4000000059604645,0,0,0,0,1], - "material": "F5361474-F5F1-412F-8D99-3699B868092D" - }, - { - "uuid": "40E5CDA4-0E39-4265-9293-3E9EC3207F61", - "type": "PointLight", - "name": "PointLight", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,11.828879356384277,0,1], - "color": 16777215, - "intensity": 1, - "distance": 0, - "decay": 1 - }] - } - }, - "scripts": { - "3741222A-BD8F-401C-A5D2-5A907E891896": [ - { - "name": "Fountain", - "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}" - }] - } -} diff --git a/ShadowEditor.Web/examples/pong.app.json b/ShadowEditor.Web/examples/pong.app.json deleted file mode 100644 index 023b59c3..00000000 --- a/ShadowEditor.Web/examples/pong.app.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "metadata": { - "type": "App" - }, - "project": { - "shadows": false, - "vr": false - }, - "camera": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "object": { - "uuid": "B901700E-2B1B-4D74-9201-164193F8304E", - "type": "PerspectiveCamera", - "name": "Camera", - "matrix": [0.9522120356559753,4.608077919243669e-9,-0.3054378032684326,0,-0.17742955684661865,0.8139732480049133,-0.553142249584198,0,0.24861818552017212,0.5809023976325989,0.7750750780105591,0,18.645999908447266,43.56800079345703,58.13100051879883,1], - "focalLength": 10, - "zoom": 1, - "fov": 50, - "aspect": 1.3217270194986073, - "near": 0.1, - "far": 100000 - } - }, - "scene": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "geometries": [ - { - "uuid": "713F75F5-5D04-4069-89CB-2035F5619AC3", - "type": "PlaneGeometry", - "width": 60, - "height": 40, - "widthSegments": 1, - "heightSegments": 1 - }, - { - "uuid": "4537EA66-3CD6-43A1-97A9-EB59F3258BF9", - "type": "BoxGeometry", - "width": 1, - "height": 1, - "depth": 1, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }, - { - "uuid": "3C546CA4-FF0F-4BA1-9406-0CD0D560A396", - "type": "BoxGeometry", - "width": 2, - "height": 2, - "depth": 10, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }, - { - "uuid": "4628F4A7-D572-45C2-9A67-807D71FF19EC", - "type": "BoxGeometry", - "width": 2, - "height": 2, - "depth": 10, - "widthSegments": 1, - "heightSegments": 1, - "depthSegments": 1 - }], - "materials": [ - { - "uuid": "7EDF7C08-6325-418A-BBAB-89341C694730", - "type": "MeshPhongMaterial", - "color": 16777215, - "emissive": 0, - "specular": 16777215, - "shininess": 30 - }, - { - "uuid": "B1CAF098-FE36-45E1-BEBE-8D6AC04821CC", - "type": "MeshPhongMaterial", - "color": 16711680, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }, - { - "uuid": "FBDBE66D-B613-4741-802D-5AE1DE07DE46", - "type": "MeshPhongMaterial", - "color": 2752767, - "emissive": 0, - "specular": 1118481, - "shininess": 30 - }], - "object": { - "uuid": "31517222-A9A7-4EAF-B5F6-60751C0BABA3", - "type": "Scene", - "name": "Scene", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "children": [ - { - "uuid": "B47D0BFC-D63A-4CBB-985E-9C4DBDF086E4", - "type": "Mesh", - "name": "Ground", - "matrix": [1,0,0,0,0,0.0007960238144733012,-0.9999997019767761,0,0,0.9999997019767761,0.0007960238144733012,0,0,-1,0,1], - "geometry": "713F75F5-5D04-4069-89CB-2035F5619AC3", - "material": "7EDF7C08-6325-418A-BBAB-89341C694730" - }, - { - "uuid": "CE13E58A-4E8B-4F72-9E2E-7DE57C58F989", - "type": "Mesh", - "name": "Ball", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "geometry": "4537EA66-3CD6-43A1-97A9-EB59F3258BF9", - "material": "B1CAF098-FE36-45E1-BEBE-8D6AC04821CC" - }, - { - "uuid": "2AAEA3AA-EC45-492B-B450-10473D1EC6C5", - "type": "Mesh", - "name": "Pad 1", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-24,0,0,1], - "geometry": "3C546CA4-FF0F-4BA1-9406-0CD0D560A396", - "material": "FBDBE66D-B613-4741-802D-5AE1DE07DE46" - }, - { - "uuid": "F1DD46A7-6584-4A37-BC76-852C3911077E", - "type": "Mesh", - "name": "Pad 2", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,24,0,0,1], - "geometry": "4628F4A7-D572-45C2-9A67-807D71FF19EC", - "material": "FBDBE66D-B613-4741-802D-5AE1DE07DE46" - }, - { - "uuid": "C62AAE9F-9E51-46A5-BD2B-71BA804FC0B3", - "type": "DirectionalLight", - "name": "DirectionalLight 3", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,10,20,15,1], - "color": 16777215, - "intensity": 1 - }] - } - }, - "scripts": { - "31517222-A9A7-4EAF-B5F6-60751C0BABA3": [ - { - "name": "Game logic", - "source": "var ball = this.getObjectByName( 'Ball' );\n\nvar position = ball.position;\n\nvar velocity = new THREE.Vector3();\n\nvar direction = new THREE.Vector3();\ndirection.x = Math.random() - 0.5;\ndirection.z = Math.random() - 0.5;\ndirection.normalize();\n\nvar pad1 = this.getObjectByName( 'Pad 1' );\nvar pad2 = this.getObjectByName( 'Pad 2' );\n\nvar raycaster = new THREE.Raycaster();\nvar objects = [ pad1, pad2 ];\n\n//\n\nfunction mousemove( event ) {\n\n\tpad1.position.z = ( event.clientX / player.width ) * 30 - 15;\n\tpad2.position.z = - pad1.position.z;\n\n}\n\nfunction update( event ) {\n\t\n\tif ( position.x < -30 || position.x > 30 ) direction.x = - direction.x;\n\tif ( position.z < -20 || position.z > 20 ) direction.z = - direction.z;\n\t\n\tposition.x = Math.max( - 30, Math.min( 30, position.x ) );\n\tposition.z = Math.max( - 20, Math.min( 20, position.z ) );\n\t\n\traycaster.set( position, direction );\n\t\n\tvar intersections = raycaster.intersectObjects( objects );\n\t\n\tif ( intersections.length > 0 ) {\n\n\t\tvar intersection = intersections[ 0 ];\n\t\t\n\t\tif ( intersection.distance < 1 ) {\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\tposition.add( velocity.copy( direction ).multiplyScalar( event.delta / 20 ) );\n\n}" - }] - } -} diff --git a/ShadowEditor.Web/examples/shaders.app.json b/ShadowEditor.Web/examples/shaders.app.json deleted file mode 100644 index 19093fda..00000000 --- a/ShadowEditor.Web/examples/shaders.app.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "metadata": { - "type": "App" - }, - "project": { - "gammaInput": true, - "gammaOutput": true, - "shadows": true, - "vr": false - }, - "camera": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "object": { - "uuid": "FC3E973B-5A4A-4177-BD9C-A58E61E0593B", - "type": "PerspectiveCamera", - "name": "Camera", - "matrix": [0.605503,0,-0.795843,0,-0.261526,0.944464,-0.198978,0,0.751645,0.328615,0.571876,0,2.571484,1.124239,1.956469,1], - "fov": 50, - "zoom": 1, - "near": 0.1, - "far": 10000, - "focus": 10, - "aspect": 1.368715, - "filmGauge": 35, - "filmOffset": 0 - } - }, - "scene": { - "metadata": { - "version": 4.4, - "type": "Object", - "generator": "Object3D.toJSON" - }, - "geometries": [ - { - "uuid": "EA781333-F3AE-470D-9110-A9724FCB42AA", - "type": "IcosahedronGeometry", - "radius": 1, - "detail": 4 - }], - "materials": [ - { - "uuid": "50ED51F1-DEA4-4B61-8082-BF41609E8C27", - "type": "ShaderMaterial", - "depthFunc": 3, - "depthTest": true, - "depthWrite": true, - "wireframe": true, - "skinning": false, - "morphTargets": false, - "uniforms": { - "time": { - "value": 0.0 - } - }, - "vertexShader": "uniform float time;\nvarying vec3 vPosition;\nvoid main() {\n\tvPosition = position;\n\tvPosition.x += sin( time + vPosition.z * 4.0 ) / 4.0;\n\tvPosition.y += cos( time + vPosition.z * 4.0 ) / 4.0;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( vPosition, 1.0 );\n}", - "fragmentShader": "varying vec3 vPosition;\nvoid main() {\n\tgl_FragColor = vec4( vPosition * 2.0, 1.0 );\n}" - }], - "object": { - "uuid": "5FC9ACA9-2A93-474D-AA32-FACC76551914", - "type": "Scene", - "name": "Scene", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "children": [ - { - "uuid": "FC7B6CF2-6386-4F47-9CE6-8ADB9FCA6E1F", - "type": "Mesh", - "name": "Icosahedron 1", - "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], - "geometry": "EA781333-F3AE-470D-9110-A9724FCB42AA", - "material": "50ED51F1-DEA4-4B61-8082-BF41609E8C27" - }], - "background": 11184810 - } - }, - "scripts": { - "FC7B6CF2-6386-4F47-9CE6-8ADB9FCA6E1F": [ - { - "name": "", - "source": "function update( event ) {\n\n\tthis.material.uniforms.time.value = event.time / 500.0;\n\n}" - }] - } -} diff --git a/ShadowEditor.Web/src/core/AppPlayer.js b/ShadowEditor.Web/src/core/AppPlayer.js index 523de032..c3b603c5 100644 --- a/ShadowEditor.Web/src/core/AppPlayer.js +++ b/ShadowEditor.Web/src/core/AppPlayer.js @@ -1,10 +1,14 @@ +import SceneSerializer from '../serialization/core/SceneSerializer'; +import CamerasSerializer from '../serialization/camera/CamerasSerializer'; +import ScriptSerializer from '../serialization/app/ScriptSerializer'; + /** * 播放器 * @author mrdoob / http://mrdoob.com/ * @author tengge / https://github.com/tengge1 + * @param {*} app */ -function AppPlayer() { - var loader = new THREE.ObjectLoader(); +function AppPlayer(app) { var camera, scene, renderer; var events = {}; @@ -25,8 +29,11 @@ function AppPlayer() { dom.appendChild(renderer.domElement); - this.setScene(loader.parse(json.scene)); - this.setCamera(loader.parse(json.camera)); + var scene = new SceneSerializer(this.app).fromJSON(json.filter(n => n.metadata.generator === 'SceneSerializer')[0]); + this.setScene(scene); + + var camera = new CamerasSerializer(this.app).fromJSON(json.filter(n => n.metadata.generator === 'PerspectiveCameraSerializer')[0]); + this.setCamera(camera); events = { init: [], @@ -53,7 +60,9 @@ function AppPlayer() { var scriptWrapResult = JSON.stringify(scriptWrapResultObj).replace(/\"/g, ''); - for (var uuid in json.scripts) { + var all_scripts = new ScriptSerializer(this.app).fromJSON(json.filter(n => n.metadata.generator === 'ScriptSerializer')[0]); + + for (var uuid in all_scripts) { var object = scene.getObjectByProperty('uuid', uuid, true); if (object === undefined) { @@ -61,7 +70,7 @@ function AppPlayer() { continue; } - var scripts = json.scripts[uuid]; + var scripts = all_scripts[uuid]; for (var i = 0; i < scripts.length; i++) { var script = scripts[i]; diff --git a/ShadowEditor.Web/src/editor/Player.js b/ShadowEditor.Web/src/editor/Player.js index a2bd17ca..0ad28514 100644 --- a/ShadowEditor.Web/src/editor/Player.js +++ b/ShadowEditor.Web/src/editor/Player.js @@ -27,7 +27,7 @@ Player.prototype.render = function () { this.container.render(); - this.player = new AppPlayer(); + this.player = new AppPlayer(this.app); this.container.dom.appendChild(this.player.dom); this.app.on(`resize.${this.id}`, this.onResize.bind(this)); diff --git a/ShadowEditor.Web/src/editor/menubar/ExampleMenu.js b/ShadowEditor.Web/src/editor/menubar/ExampleMenu.js deleted file mode 100644 index 9400c59d..00000000 --- a/ShadowEditor.Web/src/editor/menubar/ExampleMenu.js +++ /dev/null @@ -1,69 +0,0 @@ -import UI from '../../ui/UI'; - -/** - * 示例菜单 - * @author tengge / https://github.com/tengge1 - * @param {*} options - */ -function ExampleMenu(options) { - UI.Control.call(this, options); - this.app = options.app; -} - -ExampleMenu.prototype = Object.create(UI.Control.prototype); -ExampleMenu.prototype.constructor = ExampleMenu; - -ExampleMenu.prototype.render = function () { - var _this = this; - - var container = UI.create({ - xtype: 'div', - parent: this.parent, - cls: 'menu', - children: [{ - xtype: 'div', - cls: 'title', - html: '示例' - }, { - xtype: 'div', - cls: 'options', - children: [{ - id: 'mArkanoid', - xtype: 'div', - cls: 'option', - html: '打砖块', - onClick: function () { - _this.app.call('mArkanoid'); - } - }, { - id: 'mCamera', - xtype: 'div', - cls: 'option', - html: '相机', - onClick: function () { - _this.app.call('mCamera'); - } - }, { - id: 'mParticles', - xtype: 'div', - cls: 'option', - html: '粒子', - onClick: function () { - _this.app.call('mParticles'); - } - }, { - id: 'mPong', - xtype: 'div', - cls: 'option', - html: '乒乓球', - onClick: function () { - _this.app.call('mPong'); - } - }] - }] - }); - - container.render(); -} - -export default ExampleMenu; \ No newline at end of file diff --git a/ShadowEditor.Web/src/editor/menubar/Menubar.js b/ShadowEditor.Web/src/editor/menubar/Menubar.js index f2af6cdc..e5efd5a4 100644 --- a/ShadowEditor.Web/src/editor/menubar/Menubar.js +++ b/ShadowEditor.Web/src/editor/menubar/Menubar.js @@ -9,7 +9,6 @@ import AnimationMenu from './AnimationMenu'; import PhysicsMenu from './PhysicsMenu'; import ComponentMenu from './ComponentMenu'; import PlayMenu from './PlayMenu'; -import ExampleMenu from './ExampleMenu'; import OptionsMenu from './OptionsMenu'; import HelpMenu from './HelpMenu'; import StatusMenu from './StatusMenu'; @@ -49,7 +48,6 @@ Menubar.prototype.render = function () { new PhysicsMenu(params), new ComponentMenu(params), new PlayMenu(params), - new ExampleMenu(params), new OptionsMenu(params), new HelpMenu(params), diff --git a/ShadowEditor.Web/src/editor/menubar/PlayMenu.js b/ShadowEditor.Web/src/editor/menubar/PlayMenu.js index d0abc99b..21bad662 100644 --- a/ShadowEditor.Web/src/editor/menubar/PlayMenu.js +++ b/ShadowEditor.Web/src/editor/menubar/PlayMenu.js @@ -1,4 +1,5 @@ import UI from '../../ui/UI'; +import Converter from '../../serialization/Converter'; /** * 启动菜单 @@ -52,7 +53,11 @@ PlayMenu.prototype.startPlayer = function () { // 启动播放器 container.dom.style.display = ''; - player.load(editor.toJSON()); + var converter = new Converter(this.app); + var json = converter.toJSON(); + + debugger + player.load(json); player.setSize(container.dom.clientWidth, container.dom.clientHeight); player.play(); }; diff --git a/ShadowEditor.Web/src/event/EventDispatcher.js b/ShadowEditor.Web/src/event/EventDispatcher.js index 3bffb396..596c4142 100644 --- a/ShadowEditor.Web/src/event/EventDispatcher.js +++ b/ShadowEditor.Web/src/event/EventDispatcher.js @@ -74,8 +74,6 @@ import AddPhysicsClothEvent from './menu/physics/AddPhysicsClothEvent'; import ParticleEmitterEvent from './menu/component/ParticleEmitterEvent'; -import ExampleEvent from './menu/example/ExampleEvent'; - import SurfaceOptionsEvent from './menu/options/SurfaceOptionsEvent'; import SceneOptionsEvent from './menu/options/SceneOptionsEvent'; import RendererOptionsEvent from './menu/options/RendererOptionsEvent'; @@ -180,8 +178,6 @@ function EventDispatcher(app) { new ParticleEmitterEvent(this.app), - new ExampleEvent(this.app), - new SurfaceOptionsEvent(this.app), new SceneOptionsEvent(this.app), new RendererOptionsEvent(this.app), diff --git a/ShadowEditor.Web/src/event/EventList.js b/ShadowEditor.Web/src/event/EventList.js index 8988be7a..8f4e17d2 100644 --- a/ShadowEditor.Web/src/event/EventList.js +++ b/ShadowEditor.Web/src/event/EventList.js @@ -77,11 +77,6 @@ var EventList = [ 'mParticleEmitter', // 粒子发射器 - 'mArkanoid', // 打砖块 - 'mCamera', // 相机 - 'mParticles', // 粒子 - 'mPong', // 乒乓球 - 'mSurfaceOptions', // 外观选项 'mSceneOptions', // 场景选项 'mRendererOptions', // 渲染器选项 diff --git a/ShadowEditor.Web/src/event/menu/example/ExampleEvent.js b/ShadowEditor.Web/src/event/menu/example/ExampleEvent.js deleted file mode 100644 index 8a4fd7ae..00000000 --- a/ShadowEditor.Web/src/event/menu/example/ExampleEvent.js +++ /dev/null @@ -1,55 +0,0 @@ -import MenuEvent from '../MenuEvent'; -import UI from '../../../ui/UI'; - -/** - * 示例事件 - * @author tengge / https://github.com/tengge1 - * @param {*} app - */ -function ExampleEvent(app) { - MenuEvent.call(this, app); - this.isPlaying = false; -} - -ExampleEvent.prototype = Object.create(MenuEvent.prototype); -ExampleEvent.prototype.constructor = ExampleEvent; - -ExampleEvent.prototype.start = function () { - var _this = this; - this.app.on('mArkanoid.' + this.id, function () { - _this.onExample('arkanoid.app.json'); - }); - this.app.on('mCamera.' + this.id, function () { - _this.onExample('camera.app.json'); - }); - this.app.on('mParticles.' + this.id, function () { - _this.onExample('particles.app.json'); - }); - this.app.on('mPong.' + this.id, function () { - _this.onExample('pong.app.json'); - }); -}; - -ExampleEvent.prototype.stop = function () { - this.app.on('mArkanoid.' + this.id, null); - this.app.on('mCamera.' + this.id, null); - this.app.on('mParticles.' + this.id, null); - this.app.on('mPong.' + this.id, null); -}; - -ExampleEvent.prototype.onExample = function (name) { - var editor = this.app.editor; - - UI.confirm('询问', '任何未保存数据将丢失。确定吗?', function (event, btn) { - if (btn === 'ok') { - var loader = new THREE.FileLoader(); - - loader.load('examples/' + name, function (text) { - editor.clear(); - editor.fromJSON(JSON.parse(text)); - }); - } - }); -}; - -export default ExampleEvent; \ No newline at end of file