mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
update to three.js r68.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
// Cube
|
||||
|
||||
var geometry = new THREE.CubeGeometry(200, 200, 200);
|
||||
var geometry = new THREE.BoxGeometry(200, 200, 200);
|
||||
|
||||
for (var i = 0; i < geometry.faces.length; i += 2) {
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference path="../../three.d.ts" />
|
||||
/// <reference path="../three-tests-setup.ts" />
|
||||
/// <reference path="../../../tween.js/tween.js.d.ts" />
|
||||
|
||||
// https://github.com/mrdoob/three.js/blob/master/examples/canvas_interactive_cubes_tween.html
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// ------- variable definitions that does not exist in the original code. These are for typescript.
|
||||
// -------
|
||||
var camera, scene, renderer,
|
||||
particle1, particle2, particle3,
|
||||
light1, light2, light3,
|
||||
loader, mesh;
|
||||
|
||||
@@ -43,14 +42,14 @@
|
||||
|
||||
}
|
||||
|
||||
particle1 = new THREE.Sprite(new THREE.SpriteCanvasMaterial({ color: 0xff0040, program: program }));
|
||||
scene.add(particle1);
|
||||
var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0xff0040, program: program } ) );
|
||||
light1.add( sprite );
|
||||
|
||||
particle2 = new THREE.Sprite(new THREE.SpriteCanvasMaterial({ color: 0x0040ff, program: program }));
|
||||
scene.add(particle2);
|
||||
var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0x0040ff, program: program } ) );
|
||||
light2.add( sprite );
|
||||
|
||||
particle3 = new THREE.Sprite(new THREE.SpriteCanvasMaterial({ color: 0x80ff80, program: program }));
|
||||
scene.add(particle3);
|
||||
var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0x80ff80, program: program } ) );
|
||||
light3.add( sprite );
|
||||
|
||||
loader = new THREE.JSONLoader();
|
||||
loader.load('obj/WaltHeadLo.js', function (geometry) {
|
||||
@@ -94,29 +93,17 @@
|
||||
|
||||
if (mesh) mesh.rotation.y -= 0.01;
|
||||
|
||||
particle1.position.x = Math.sin(time * 0.7) * 30;
|
||||
particle1.position.y = Math.cos(time * 0.5) * 40;
|
||||
particle1.position.z = Math.cos(time * 0.3) * 30;
|
||||
light1.position.x = Math.sin( time * 0.7 ) * 30;
|
||||
light1.position.y = Math.cos( time * 0.5 ) * 40;
|
||||
light1.position.z = Math.cos( time * 0.3 ) * 30;
|
||||
|
||||
light1.position.x = particle1.position.x;
|
||||
light1.position.y = particle1.position.y;
|
||||
light1.position.z = particle1.position.z;
|
||||
light2.position.x = Math.cos( time * 0.3 ) * 30;
|
||||
light2.position.y = Math.sin( time * 0.5 ) * 40;
|
||||
light2.position.z = Math.sin( time * 0.7 ) * 30;
|
||||
|
||||
particle2.position.x = Math.cos(time * 0.3) * 30;
|
||||
particle2.position.y = Math.sin(time * 0.5) * 40;
|
||||
particle2.position.z = Math.sin(time * 0.7) * 30;
|
||||
|
||||
light2.position.x = particle2.position.x;
|
||||
light2.position.y = particle2.position.y;
|
||||
light2.position.z = particle2.position.z;
|
||||
|
||||
particle3.position.x = Math.sin(time * 0.7) * 30;
|
||||
particle3.position.y = Math.cos(time * 0.3) * 40;
|
||||
particle3.position.z = Math.sin(time * 0.5) * 30;
|
||||
|
||||
light3.position.x = particle3.position.x;
|
||||
light3.position.y = particle3.position.y;
|
||||
light3.position.z = particle3.position.z;
|
||||
light3.position.x = Math.sin( time * 0.7 ) * 30;
|
||||
light3.position.y = Math.cos( time * 0.3 ) * 40;
|
||||
light3.position.z = Math.sin( time * 0.5 ) * 30;
|
||||
|
||||
renderer.render(scene, camera);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
var container, stats;
|
||||
|
||||
var camera, scene, renderer, objects;
|
||||
var particleLight, pointLight;
|
||||
var pointLight;
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -103,10 +103,6 @@
|
||||
|
||||
}
|
||||
|
||||
particleLight = new THREE.Sprite(new THREE.SpriteCanvasMaterial({ color: 0xffffff, program: program }));
|
||||
particleLight.scale.x = particleLight.scale.y = 8;
|
||||
scene.add(particleLight);
|
||||
|
||||
// Lights
|
||||
|
||||
scene.add(new THREE.AmbientLight(Math.random() * 0x202020));
|
||||
@@ -121,6 +117,10 @@
|
||||
pointLight = new THREE.PointLight(0xffffff, 1);
|
||||
scene.add(pointLight);
|
||||
|
||||
var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0xffffff, program: program } ) );
|
||||
sprite.scale.set( 8, 8, 8 );
|
||||
pointLight.add( sprite );
|
||||
|
||||
renderer = new THREE.CanvasRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
container.appendChild(renderer.domElement);
|
||||
@@ -198,13 +198,10 @@
|
||||
|
||||
}
|
||||
|
||||
particleLight.position.x = Math.sin(timer * 7) * 300;
|
||||
particleLight.position.y = Math.cos(timer * 5) * 400;
|
||||
particleLight.position.z = Math.cos(timer * 3) * 300;
|
||||
pointLight.position.x = Math.sin( timer * 7 ) * 300;
|
||||
pointLight.position.y = Math.cos( timer * 5 ) * 400;
|
||||
pointLight.position.z = Math.cos( timer * 3 ) * 300;
|
||||
|
||||
pointLight.position.x = particleLight.position.x;
|
||||
pointLight.position.y = particleLight.position.y;
|
||||
pointLight.position.z = particleLight.position.z;
|
||||
|
||||
renderer.render(scene, camera);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user