// Generated by CoffeeScript 1.4.0 (function() { var D, aspect, camera, domEvents, height, light, loader, materials, new_material, renderer, scene, width; width = 960; height = 500; aspect = width / height; D = 8; scene = new THREE.Scene(); camera = new THREE.OrthographicCamera(-D * aspect, D * aspect, D, -D, 1, 1000); renderer = new THREE.WebGLRenderer({ precision: 'highp', antialias: true, alpha: true }); renderer.setSize(width, height); document.body.appendChild(renderer.domElement); light = new THREE.DirectionalLight(0xffffff, 1.1); light.position.set(10, 20, 15); scene.add(light); camera.position.set(20, 20, 20); camera.lookAt(new THREE.Vector3(0, 0, 0)); camera.rotation.z = 5 / 6 * Math.PI; domEvents = new THREEx.DomEvents(camera, renderer.domElement); materials = {}; new_material = new THREE.MeshLambertMaterial({ opacity: 0.85 }); loader = new THREE.ColladaLoader(); loader.load('cube.dae', function(collada) { collada.scene.children[0].children.forEach(function(mesh) { if (mesh.material.type === "MeshFaceMaterial") { mesh.material = mesh.material.materials[1]; } materials[mesh.uuid] = mesh.material; domEvents.addEventListener(mesh, 'mouseover', function(event) { new_material.color = mesh.material.color; mesh.material = new_material; return renderer.render(scene, camera); }); return domEvents.addEventListener(mesh, 'mouseout', function(event) { mesh.material = materials[mesh.uuid]; return renderer.render(scene, camera); }); }); collada.scene.scale.set(0.1, 0.1, 0.1); scene.add(collada.scene); return renderer.render(scene, camera); }); }).call(this);