Skip to content

Commit

Permalink
Stability: Added a test to catch regressions when rendering clones.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpeiris committed Mar 7, 2016
1 parent f035de6 commit 89aaa00
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions examples/tests/cloning.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cloning Tests</title>
<meta charset="utf-8">
<style>
body {
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r73/build/three.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r73/examples/js/loaders/MTLLoader.js"></script>

<script >
var scene, renderer, camera;

scene = new THREE.Scene();
scene.position.set(0, -60, 0);
scene.scale.multiplyScalar(2);

var geometry = new THREE.BoxGeometry(1, 1, 1);
var material = new THREE.MeshBasicMaterial({color:'#ffffff'});
var cube = new THREE.Mesh(geometry, material);
cube.scale.multiplyScalar(100);

setTimeout(function()
{
var clonedCube = cube.clone();
scene.add(clonedCube);
clonedCube.position.set(0, -50, 0);

setTimeout(function()
{
var secondClonedCube = cube.clone();
scene.add(secondClonedCube);
}, 4000);
}, 2000);

if (window.altspace) {
renderer = altspace.getThreeJSRenderer();
}
else {
renderer = new THREE.WebGLRenderer();
renderer.setClearColor("#AAAAAA");
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

var aspect = window.innerWidth / window.innerHeight;
camera = new THREE.PerspectiveCamera(45, aspect, 1, 2000 );
camera.position.z = 400;
camera.position.y = 50;
camera.lookAt( scene.position );

scene.add( new THREE.AmbientLight( 0xffffff ) );
}

function animate(elapsed) {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}

animate(0);
</script>
</body>
</html>

0 comments on commit 89aaa00

Please sign in to comment.