diff --git a/babylon.js/TODO.md b/babylon.js/TODO.md index 98670ca5c5916f940090b591efe10afa564b1fd7..332f174ef9c8ad766e76834d743670e1dc6756f2 100644 --- a/babylon.js/TODO.md +++ b/babylon.js/TODO.md @@ -1,8 +1,9 @@ -- port it to ar-session.js -- put the gatefunctions in a babylon-ar.js +- babylon forum - http://www.html5gamedevs.com/topic/31654-babylonaugmented-reality-in-arjs/?tab=comments&_fromLogin=1 # Remaining issue -- babylon.js object very shacky - while three.js super stable - reason unkonwn - - camera projection matrix to set - resize to handle + +- DONE babylon.js object very shacky - while three.js super stable - reason unkonwn +- DONE put the gatefunctions in a babylon-ar.js +- DONE port it to new api ar-session.js diff --git a/babylon.js/examples/manual.html b/babylon.js/examples/dev.html similarity index 50% rename from babylon.js/examples/manual.html rename to babylon.js/examples/dev.html index e6d8987eee0bcceca635295db386c0641a2436fd..6661839f26a934a3bcb06ff1370f5db25cb6c10c 100644 --- a/babylon.js/examples/manual.html +++ b/babylon.js/examples/dev.html @@ -23,25 +23,16 @@ window.addEventListener('DOMContentLoaded', function(){ canvasElement.style.position = 'absolute' canvasElement.style.zIndex = -1 document.body.appendChild(canvasElement) - var engine = new BABYLON.Engine(canvasElement, true); + var engine = new BABYLON.Engine(canvasElement, true) var babylonCamera; - - /*********************************CREATE-LIGHTS******************************/ - var createLights = function() { - var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,10,0), scene); - light.intensity = 0.4; - - var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(-1, -2, -1), scene); - light.position = new BABYLON.Vector3(20, 39, 20); - light.intensity = 0.5; - } + /******************************CREATE-MOON*****************************/ var createMoon = function(){ - var material = new BABYLON.StandardMaterial("proutMaterial", scene); - material.diffuseTexture = new BABYLON.Texture("images/UV_Grid_Sm.jpg", scene); + var material = new BABYLON.StandardMaterial("proutMaterial", scene) + material.diffuseTexture = new BABYLON.Texture("images/UV_Grid_Sm.jpg", scene) - var mesh = BABYLON.Mesh.CreateSphere("mesh", 12, 1, scene); + var mesh = BABYLON.Mesh.CreateSphere("mesh", 12, 1, scene) // mesh.position.y = 60; mesh.material = material; @@ -49,81 +40,78 @@ window.addEventListener('DOMContentLoaded', function(){ } var displayMeshAxis = function (mesh) { - mesh.computeWorldMatrix(); - var matrix = mesh.getWorldMatrix(); + mesh.computeWorldMatrix() + var matrix = mesh.getWorldMatrix() var origin = mesh.position; // find existing axis for this box and dispose - var xAxis = scene.getMeshByName("xAxis"+mesh.name); - var yAxis = scene.getMeshByName("yAxis"+mesh.name); - var zAxis = scene.getMeshByName("zAxis"+mesh.name); - if (xAxis!=null){ xAxis.dispose();} - if (yAxis!=null){ yAxis.dispose();} - if (zAxis!=null){ zAxis.dispose();} + var xAxis = scene.getMeshByName("xAxis"+mesh.name) + var yAxis = scene.getMeshByName("yAxis"+mesh.name) + var zAxis = scene.getMeshByName("zAxis"+mesh.name) + if (xAxis!=null){ xAxis.dispose()} + if (yAxis!=null){ yAxis.dispose()} + if (zAxis!=null){ zAxis.dispose()} // calculate new normals for this mesh in world coordinate system - var xNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(100,0,0),matrix); - var yNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(0,100,0),matrix); - var zNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(0,0,100),matrix); + var xNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(100,0,0),matrix) + var yNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(0,100,0),matrix) + var zNormal=BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(0,0,100),matrix) // create axis lines - xAxis = BABYLON.Mesh.CreateDashedLines("xAxis"+mesh.name, [origin, xNormal],3,10,200, scene, false); - xAxis.color = BABYLON.Color3.Red(); - yAxis = BABYLON.Mesh.CreateDashedLines("yAxis"+mesh.name, [origin, yNormal],3,10,200, scene, false); - yAxis.color = BABYLON.Color3.Green(); - zAxis = BABYLON.Mesh.CreateDashedLines("zAxis"+mesh.name, [origin, zNormal],3,10,200, scene, false); - zAxis.color = BABYLON.Color3.Blue(); + xAxis = BABYLON.Mesh.CreateDashedLines("xAxis"+mesh.name, [origin, xNormal],3,10,200, scene, false) + xAxis.color = BABYLON.Color3.Red() + yAxis = BABYLON.Mesh.CreateDashedLines("yAxis"+mesh.name, [origin, yNormal],3,10,200, scene, false) + yAxis.color = BABYLON.Color3.Green() + zAxis = BABYLON.Mesh.CreateDashedLines("zAxis"+mesh.name, [origin, zNormal],3,10,200, scene, false) + zAxis.color = BABYLON.Color3.Blue() } /****************************CREATE-SYMPHONY*******************************/ var createImagePlane = function(){ - - var material = new BABYLON.StandardMaterial("texturePlane", scene); - material.twoSidedLighting = true - material.diffuseTexture = new BABYLON.Texture("images/UV_Grid_Sm.jpg", scene); - material.specularColor = new BABYLON.Color3(1, 1, 1); - - // material.backFaceCulling = true; - // var mesh = BABYLON.Mesh.CreatePlane("mesh", 2, scene); - var mesh = BABYLON.MeshBuilder.CreatePlane("plane1", { size: 2, sideOrientation: BABYLON.Mesh.DOUBLESIDE - }, scene); - - mesh.material = material; + }, scene) mesh.position = new BABYLON.Vector3(0,0, 0) mesh.rotation.y = Math.PI - + + var material = new BABYLON.StandardMaterial("texturePlane", scene) + material.twoSidedLighting = true + material.diffuseTexture = new BABYLON.Texture("images/UV_Grid_Sm.jpg", scene) + material.specularColor = new BABYLON.Color3(1, 1, 1) + mesh.material = material } /******************************Initialization******************************/ - var scene = new BABYLON.Scene(engine); + var scene = new BABYLON.Scene(engine) scene.useRightHandedSystem = true - scene.clearColor = new BABYLON.Color4(0, 0, 0, 0); + scene.clearColor = new BABYLON.Color4(0, 0, 0, 0) var babylonCamera = ARjs.Babylon.createCamera(scene) - var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,10,0), scene); - light.intensity = 0.4; - - var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(-1, -2, -1), scene); - light.position = new BABYLON.Vector3(20, 39, 20); - light.intensity = 0.5; + // add ligts + var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,10,0), scene) + light.intensity = 0.4 + var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(-1, -2, -1), scene) + light.position = new BABYLON.Vector3(20, 39, 20) + light.intensity = 0.5 - createMoon(); - createImagePlane(); + createMoon() + createImagePlane() engine.runRenderLoop(function(){ - ARjs.Babylon.setObject3D(babylonCamera, markerControls.object3d) + ARjs.Babylon.updateObjectPose(babylonCamera, camera) - scene.render(); - }); + scene.render() + }) window.addEventListener('resize', function(){ - engine.resize(); - }); -}); + engine.resize() + }) +})