mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-15 06:20:23 +00:00
three: noImplicitAny remaining fixes
This commit is contained in:
@@ -104,7 +104,7 @@
|
||||
|
||||
//
|
||||
|
||||
function onDocumentMouseDown(event) {
|
||||
function onDocumentMouseDown(event: MouseEvent) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseUp(event) {
|
||||
function onDocumentMouseUp(event: MouseEvent) {
|
||||
|
||||
document.removeEventListener('mousemove', onDocumentMouseMove, false);
|
||||
document.removeEventListener('mouseup', onDocumentMouseUp, false);
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseOut(event) {
|
||||
function onDocumentMouseOut(event: MouseEvent) {
|
||||
|
||||
document.removeEventListener('mousemove', onDocumentMouseMove, false);
|
||||
document.removeEventListener('mouseup', onDocumentMouseUp, false);
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
function onDocumentTouchStart(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length === 1) {
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchMove(event) {
|
||||
function onDocumentTouchMove(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length === 1) {
|
||||
|
||||
|
||||
@@ -85,17 +85,17 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
function onDocumentTouchStart(event: TouchEvent) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
event.clientX = event.touches[0].clientX;
|
||||
event.clientY = event.touches[0].clientY;
|
||||
onDocumentMouseDown(event);
|
||||
let usurpedEvent = event as any;
|
||||
usurpedEvent.clientX = event.touches[0].clientX;
|
||||
usurpedEvent.clientY = event.touches[0].clientY;
|
||||
onDocumentMouseDown(usurpedEvent);
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseDown(event) {
|
||||
function onDocumentMouseDown(event: MouseEvent) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
scene.add(light3);
|
||||
|
||||
var PI2 = Math.PI * 2;
|
||||
var program = function (context) {
|
||||
var program = function (context: CanvasRenderingContext2D) {
|
||||
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 0.5, 0, PI2, true);
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
var PI2 = Math.PI * 2;
|
||||
var program = function (context) {
|
||||
var program = function (context: CanvasRenderingContext2D) {
|
||||
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 0.5, 0, PI2, true);
|
||||
@@ -98,9 +98,9 @@
|
||||
|
||||
}
|
||||
|
||||
// Lights
|
||||
// Lights
|
||||
|
||||
scene.add(new THREE.AmbientLight(Math.random() * 0x202020));
|
||||
scene.add(new THREE.AmbientLight(Math.random() * 0x202020));
|
||||
|
||||
var directionalLight = new THREE.DirectionalLight(Math.random() * 0xffffff);
|
||||
directionalLight.position.x = Math.random() - 0.5;
|
||||
@@ -154,12 +154,12 @@
|
||||
|
||||
}
|
||||
|
||||
function loadImage(path) {
|
||||
function loadImage(path: string) {
|
||||
|
||||
var image = document.createElement('img');
|
||||
var texture = new THREE.Texture(image, THREE.UVMapping)
|
||||
|
||||
image.onload = function () { texture.needsUpdate = true; };
|
||||
image.onload = function () { texture.needsUpdate = true; };
|
||||
image.src = path;
|
||||
|
||||
return texture;
|
||||
|
||||
@@ -80,13 +80,13 @@
|
||||
|
||||
//
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
mouseY = event.clientY - windowHalfY;
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
function onDocumentTouchStart(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length > 1) {
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onDocumentTouchMove(event) {
|
||||
function onDocumentTouchMove(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length == 1) {
|
||||
|
||||
|
||||
@@ -131,8 +131,15 @@
|
||||
var camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.CSS3DRenderer;
|
||||
var controls: THREE.TrackballControls;
|
||||
|
||||
var objects = [];
|
||||
var targets = { table: [], sphere: [], helix: [], grid: [] };
|
||||
var objects: THREE.CSS3DObject[] = [];
|
||||
class Targets {
|
||||
constructor() {}
|
||||
public table: THREE.Object3D[] = [];
|
||||
public sphere: THREE.Object3D[] = [];
|
||||
public helix: THREE.Object3D[] = [];
|
||||
public grid: THREE.Object3D[] = [];
|
||||
}
|
||||
let targets = new Targets();
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -262,28 +269,28 @@
|
||||
controls.addEventListener('change', render);
|
||||
|
||||
var button = document.getElementById('table');
|
||||
button.addEventListener('click', function (event) {
|
||||
button.addEventListener('click', function (event: MouseEvent) {
|
||||
|
||||
transform(targets.table, 2000);
|
||||
|
||||
}, false);
|
||||
|
||||
var button = document.getElementById('sphere');
|
||||
button.addEventListener('click', function (event) {
|
||||
button.addEventListener('click', function (event: MouseEvent) {
|
||||
|
||||
transform(targets.sphere, 2000);
|
||||
|
||||
}, false);
|
||||
|
||||
var button = document.getElementById('helix');
|
||||
button.addEventListener('click', function (event) {
|
||||
button.addEventListener('click', function (event: MouseEvent) {
|
||||
|
||||
transform(targets.helix, 2000);
|
||||
|
||||
}, false);
|
||||
|
||||
var button = document.getElementById('grid');
|
||||
button.addEventListener('click', function (event) {
|
||||
button.addEventListener('click', function (event: MouseEvent) {
|
||||
|
||||
transform(targets.grid, 2000);
|
||||
|
||||
@@ -297,7 +304,7 @@
|
||||
|
||||
}
|
||||
|
||||
function transform(targets, duration) {
|
||||
function transform(targets: THREE.Object3D[], duration: number) {
|
||||
|
||||
TWEEN.removeAll();
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
var controls: THREE.TrackballControls;
|
||||
|
||||
var particlesTotal = 512;
|
||||
var positions = [];
|
||||
var objects = [];
|
||||
var positions: number[] = [];
|
||||
var objects: THREE.CSS3DSprite[] = [];
|
||||
var current = 0;
|
||||
|
||||
init();
|
||||
@@ -28,7 +28,7 @@
|
||||
scene = new THREE.Scene();
|
||||
|
||||
var image = document.createElement('img');
|
||||
image.addEventListener('load', function (event) {
|
||||
image.addEventListener('load', function (event: Event) {
|
||||
|
||||
for (var i = 0; i < particlesTotal; i++) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
object.position.x = Math.random() * 4000 - 2000,
|
||||
object.position.y = Math.random() * 4000 - 2000,
|
||||
object.position.z = Math.random() * 4000 - 2000
|
||||
scene.add(object);
|
||||
scene.add(object);
|
||||
|
||||
objects.push(object);
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
ok( b.clone().union( c ).equals( c ), "Passed!" );
|
||||
});
|
||||
|
||||
var compareBox = function ( a, b, threshold? ) {
|
||||
var compareBox = function ( a: THREE.Box3, b: THREE.Box3, threshold?: number ) {
|
||||
threshold = threshold || 0.0001;
|
||||
return ( a.min.distanceTo( b.min ) < threshold &&
|
||||
a.max.distanceTo( b.max ) < threshold );
|
||||
@@ -768,7 +768,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
var eulerAxyz = new THREE.Euler( 1, 0, 0, "XYZ" );
|
||||
var eulerAzyx = new THREE.Euler( 0, 1, 0, "ZYX" );
|
||||
|
||||
var matrixEquals4 = function( a, b ) {
|
||||
var matrixEquals4 = function( a: THREE.Matrix4, b: THREE.Matrix4 ) {
|
||||
var tolerance = 0.0001;
|
||||
if( a.elements.length != b.elements.length ) {
|
||||
return false;
|
||||
@@ -782,14 +782,14 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
return true;
|
||||
};
|
||||
|
||||
var eulerEquals = function (a, b, tolerance?: any) {
|
||||
var eulerEquals = function (a: THREE.Euler, b: THREE.Euler, tolerance?: number) {
|
||||
tolerance = tolerance || 0.0001;
|
||||
var diff = Math.abs(a.x - b.x) + Math.abs(a.y - b.y) + Math.abs(a.z - b.z);
|
||||
return (diff < tolerance);
|
||||
};
|
||||
|
||||
|
||||
var quatEquals = function (a, b, tolerance?: any) {
|
||||
var quatEquals = function (a: THREE.Quaternion, b: THREE.Quaternion, tolerance?: number) {
|
||||
tolerance = tolerance || 0.0001;
|
||||
var diff = Math.abs(a.x - b.x) + Math.abs(a.y - b.y) + Math.abs(a.z - b.z) + Math.abs(a.w - b.w);
|
||||
return (diff < tolerance);
|
||||
@@ -843,7 +843,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
var v2 = new THREE.Euler().setFromQuaternion( q, v.order );
|
||||
var q2 = new THREE.Quaternion().setFromEuler( v2 );
|
||||
ok(eulerEquals(q, q2), "Passed!");
|
||||
ok(quatEquals(q, q2), "Passed!");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -899,7 +899,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
var unit3 = new THREE.Vector3( 1, 0, 0 );
|
||||
|
||||
var planeEquals = function ( a, b, tolerance ) {
|
||||
var planeEquals = function ( a: THREE.Plane, b: THREE.Plane, tolerance: number ) {
|
||||
tolerance = tolerance || 0.0001;
|
||||
if( a.normal.distanceTo( b.normal ) > tolerance ) {
|
||||
return false;
|
||||
@@ -1116,7 +1116,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
// -------------------------------------------- Matrix3
|
||||
|
||||
var matrixEquals3 = function( a, b, tolerance? ) {
|
||||
var matrixEquals3 = function( a: THREE.Matrix, b: THREE.Matrix, tolerance?: number ) {
|
||||
tolerance = tolerance || 0.0001;
|
||||
if( a.elements.length != b.elements.length ) {
|
||||
return false;
|
||||
@@ -1131,7 +1131,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
};
|
||||
|
||||
|
||||
var toMatrix4 = function( m3 ) {
|
||||
var toMatrix4 = function( m3: THREE.Matrix3 ) {
|
||||
var result = new THREE.Matrix4();
|
||||
var re = result.elements;
|
||||
var me = m3.elements;
|
||||
@@ -1330,20 +1330,6 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
// -------------------------------------------- Matrix4
|
||||
|
||||
var matrixEquals4 = function (a, b) {
|
||||
var tolerance = 0.0001;
|
||||
if( a.elements.length != b.elements.length ) {
|
||||
return false;
|
||||
}
|
||||
for( var i = 0, il = a.elements.length; i < il; i ++ ) {
|
||||
var delta = a.elements[i] - b.elements[i];
|
||||
if( delta > tolerance ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
test( "constructor", function() {
|
||||
var a = new THREE.Matrix4();
|
||||
ok( a.determinant() == 1, "Passed!" );
|
||||
@@ -1662,7 +1648,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
// -------------------------------------------- Plane
|
||||
|
||||
var comparePlane = function ( a, b, threshold? ) {
|
||||
var comparePlane = function ( a: THREE.Plane, b: THREE.Plane, threshold?: number ) {
|
||||
threshold = threshold || 0.0001;
|
||||
return ( a.normal.distanceTo( b.normal ) < threshold &&
|
||||
Math.abs( a.constant - b.constant ) < threshold );
|
||||
@@ -1861,7 +1847,7 @@ declare function equal<T>(a: T, b: T, desc?: string): void;
|
||||
|
||||
|
||||
|
||||
var qSub = function ( a, b ) {
|
||||
var qSub = function ( a: THREE.Quaternion, b: THREE.Quaternion ) {
|
||||
var result = new THREE.Quaternion();
|
||||
result.copy( a );
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// -------
|
||||
|
||||
/* testing cloth simulation */
|
||||
var pinsFormation = [];
|
||||
var pins = [6];
|
||||
var pinsFormation: number[][] = [];
|
||||
var pins: number[] = [6];
|
||||
|
||||
pinsFormation.push(pins);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
var loader = new THREE.JSONLoader();
|
||||
loader.load( "models/skinned/knight.js", function ( geometry, materials ) {
|
||||
|
||||
createScene( geometry, materials, 0, FLOOR, -300, 60 )
|
||||
createScene( geometry, materials as THREE.MeshPhongMaterial[], 0, FLOOR, -300, 60 )
|
||||
|
||||
} );
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
}
|
||||
|
||||
function createScene( geometry, materials, x, y, z, s ) {
|
||||
function createScene( geometry: THREE.Geometry, materials: THREE.MeshPhongMaterial[], x: number, y: number, z: number, s: number ) {
|
||||
|
||||
//ensureLoop( geometry.animation );
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove( event ) {
|
||||
function onDocumentMouseMove( event: MouseEvent ) {
|
||||
|
||||
mouseX = ( event.clientX - windowHalfX );
|
||||
mouseY = ( event.clientY - windowHalfY );
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
//
|
||||
|
||||
function onKeyDown ( event ) {
|
||||
function onKeyDown ( event: KeyboardEvent ) {
|
||||
|
||||
switch( event.keyCode ) {
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
//
|
||||
|
||||
function onWindowResize( event ) {
|
||||
function onWindowResize( event: Event ) {
|
||||
|
||||
SCREEN_WIDTH = window.innerWidth;
|
||||
SCREEN_HEIGHT = window.innerHeight;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
var geometry = new THREE.SphereBufferGeometry( radius, segments, rings );
|
||||
|
||||
displacement = new Float32Array( geometry.attributes["position"].count );
|
||||
noise = new Float32Array( geometry.attributes["position"].count );
|
||||
displacement = new Float32Array( geometry.getAttribute('position').count );
|
||||
noise = new Float32Array( geometry.getAttribute('position').count );
|
||||
|
||||
for ( var i = 0; i < displacement.length; i ++ ) {
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
var raycaster: THREE.Raycaster;
|
||||
var mouse = new THREE.Vector2();
|
||||
var intersection = null;
|
||||
var spheres = [];
|
||||
var spheres: THREE.Mesh[] = [];
|
||||
var spheresIndex = 0;
|
||||
var clock: THREE.Clock;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
init();
|
||||
animate();
|
||||
|
||||
function generatePointCloudGeometry(color, width, length) {
|
||||
function generatePointCloudGeometry(color: THREE.Color, width: number, length: number) {
|
||||
|
||||
var geometry = new THREE.BufferGeometry();
|
||||
var numPoints = width * length;
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
}
|
||||
|
||||
function generatePointcloud(color, width, length) {
|
||||
function generatePointcloud(color: THREE.Color, width: number, length: number) {
|
||||
|
||||
var geometry = generatePointCloudGeometry(color, width, length);
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
}
|
||||
|
||||
function generateIndexedPointcloud(color, width, length) {
|
||||
function generateIndexedPointcloud(color: THREE.Color, width: number, length: number) {
|
||||
|
||||
var geometry = generatePointCloudGeometry(color, width, length);
|
||||
var numPoints = width * length;
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
}
|
||||
|
||||
function generateIndexedWithOffsetPointcloud(color, width, length) {
|
||||
function generateIndexedWithOffsetPointcloud(color: THREE.Color, width: number, length: number) {
|
||||
|
||||
var geometry = generatePointCloudGeometry(color, width, length);
|
||||
var numPoints = width * length;
|
||||
@@ -142,11 +142,11 @@
|
||||
|
||||
}
|
||||
|
||||
function generateRegularPointcloud(color, width, length) {
|
||||
function generateRegularPointcloud(color: THREE.Color, width: number, length: number) {
|
||||
|
||||
var geometry = new THREE.Geometry();
|
||||
|
||||
var colors = [];
|
||||
var colors: THREE.Color[] = [];
|
||||
|
||||
var k = 0;
|
||||
|
||||
@@ -160,15 +160,9 @@
|
||||
var y = ( Math.cos(u * Math.PI * 8) + Math.sin(v * Math.PI * 8) ) / 20;
|
||||
var z = v - 0.5;
|
||||
var v2 = new THREE.Vector3(x, y, z);
|
||||
|
||||
var intensity = ( y + 0.1 ) * 7;
|
||||
colors[3 * k] = color.r * intensity;
|
||||
colors[3 * k + 1] = color.g * intensity;
|
||||
colors[3 * k + 2] = color.b * intensity;
|
||||
|
||||
geometry.vertices.push(v2);
|
||||
var intensity = ( y + 0.1 ) * 7;
|
||||
colors[k] = ( color.clone().multiplyScalar(intensity) );
|
||||
|
||||
k++;
|
||||
|
||||
}
|
||||
@@ -260,7 +254,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
addLight(0.08, 0.8, 0.5, 0, 0, -1000);
|
||||
addLight(0.995, 0.5, 0.9, 5000, 5000, -1000);
|
||||
|
||||
function addLight(h, s, l, x, y, z) {
|
||||
function addLight(h: number, s: number, l: number, x: number, y: number, z: number) {
|
||||
|
||||
var light = new THREE.PointLight(0xffffff, 1.5, 4500);
|
||||
light.color.setHSL(h, s, l);
|
||||
@@ -148,7 +148,7 @@
|
||||
|
||||
//
|
||||
|
||||
function lensFlareUpdateCallback(object) {
|
||||
function lensFlareUpdateCallback(object: THREE.LensFlare) {
|
||||
|
||||
var f: number, fl = object.lensFlares.length;
|
||||
var flare;
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
//
|
||||
|
||||
function onWindowResize(event) {
|
||||
function onWindowResize(event: Event) {
|
||||
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
||||
|
||||
var camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGLRenderer, dirLight: THREE.DirectionalLight, hemiLight: THREE.HemisphereLight;
|
||||
var mixers = [];
|
||||
var mixers: THREE.AnimationMixer[] = [];
|
||||
var stats: Stats;
|
||||
|
||||
var clock = new THREE.Clock();
|
||||
@@ -169,7 +169,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onKeyDown ( event ) {
|
||||
function onKeyDown ( event: KeyboardEvent ) {
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
|
||||
|
||||
@@ -146,14 +146,14 @@
|
||||
|
||||
//
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
mouseY = event.clientY - windowHalfY;
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchStart(event) {
|
||||
function onDocumentTouchStart(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length > 1) {
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchMove(event) {
|
||||
function onDocumentTouchMove(event: TouchEvent) {
|
||||
|
||||
if (event.touches.length == 1) {
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
|
||||
var camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGLRenderer, objects, controls: THREE.OrbitControls;
|
||||
var particleLight, pointLight: THREE.PointLight;
|
||||
var trunk;
|
||||
var trunk: THREE.Object3D;
|
||||
|
||||
var loader = new THREE.AWDLoader();
|
||||
|
||||
loader.materialFactory = createMaterial;
|
||||
loader.load('./models/awd/simple/simple.awd', function (_trunk) {
|
||||
loader.load('./models/awd/simple/simple.awd', function (_trunk: THREE.Object3D) {
|
||||
|
||||
trunk = _trunk;
|
||||
|
||||
@@ -29,15 +29,13 @@
|
||||
});
|
||||
|
||||
|
||||
function createMaterial(name) {
|
||||
// console.log( name );
|
||||
// var mat = new THREE.MeshPhongMaterial({
|
||||
// color: 0xaaaaaa,
|
||||
// shininess: 20
|
||||
|
||||
// });
|
||||
// return mat;
|
||||
return null;
|
||||
function createMaterial(name: string) {
|
||||
console.log( name );
|
||||
var mat = new THREE.MeshPhongMaterial({
|
||||
color: 0xaaaaaa,
|
||||
shininess: 20
|
||||
});
|
||||
return mat;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +104,7 @@
|
||||
|
||||
pointLight.position.x = Math.sin(timer * 4) * 3000;
|
||||
pointLight.position.y = 600
|
||||
pointLight.position.z = Math.cos(timer * 4) * 3000;
|
||||
pointLight.position.z = Math.cos(timer * 4) * 3000;
|
||||
|
||||
renderer.render(scene, camera);
|
||||
|
||||
|
||||
@@ -13,8 +13,12 @@
|
||||
|
||||
var camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGLRenderer, objects: THREE.Mesh[];
|
||||
var particleLight: THREE.Mesh;
|
||||
|
||||
var materials = [];
|
||||
var materials: ( THREE.MeshBasicMaterial |
|
||||
THREE.MeshPhongMaterial |
|
||||
THREE.MeshNormalMaterial |
|
||||
THREE.MeshLambertMaterial |
|
||||
THREE.MeshFaceMaterial |
|
||||
THREE.MeshDepthMaterial ) [] = [];
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -224,8 +228,8 @@
|
||||
|
||||
}
|
||||
|
||||
materials[materials.length - 3].emissive.setHSL(0.54, 1, 0.35 * (0.5 + 0.5 * Math.sin(35 * timer)));
|
||||
materials[materials.length - 4].emissive.setHSL(0.04, 1, 0.35 * (0.5 + 0.5 * Math.cos(35 * timer)));
|
||||
(materials[materials.length - 3] as THREE.MeshPhongMaterial).emissive.setHSL(0.54, 1, 0.35 * (0.5 + 0.5 * Math.sin(35 * timer)));
|
||||
(materials[materials.length - 4] as THREE.MeshLambertMaterial).emissive.setHSL(0.04, 1, 0.35 * (0.5 + 0.5 * Math.cos(35 * timer)));
|
||||
|
||||
particleLight.position.x = Math.sin(timer * 7) * 300;
|
||||
particleLight.position.y = Math.cos(timer * 5) * 400;
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove(event) {
|
||||
function onDocumentMouseMove(event: MouseEvent) {
|
||||
|
||||
mouseX = (event.clientX - windowHalfX);
|
||||
mouseY = (event.clientY - windowHalfY) * 2;
|
||||
|
||||
@@ -86,14 +86,14 @@
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove( event ) {
|
||||
function onDocumentMouseMove( event: MouseEvent ) {
|
||||
|
||||
mouseX = event.clientX - windowHalfX;
|
||||
mouseY = event.clientY - windowHalfY;
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchStart( event ) {
|
||||
function onDocumentTouchStart( event: TouchEvent ) {
|
||||
|
||||
if ( event.touches.length == 1 ) {
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onDocumentTouchMove( event ) {
|
||||
function onDocumentTouchMove( event: TouchEvent ) {
|
||||
|
||||
if ( event.touches.length == 1 ) {
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
}
|
||||
|
||||
function createHUDSprites ( texture ) {
|
||||
function createHUDSprites ( texture: THREE.Texture ) {
|
||||
|
||||
var material = new THREE.SpriteMaterial( { map: texture } );
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -6,7 +6,7 @@
|
||||
declare namespace THREE {
|
||||
export interface SpriteCanvasMaterialParameters extends MaterialParameters {
|
||||
color?: number;
|
||||
program?: (context: any, color: Color) => void;
|
||||
program?: (context: CanvasRenderingContext2D, color: Color) => void;
|
||||
}
|
||||
|
||||
export class SpriteCanvasMaterial extends Material {
|
||||
@@ -14,7 +14,7 @@ declare namespace THREE {
|
||||
|
||||
color: Color;
|
||||
|
||||
program(context: any, color: Color): void;
|
||||
program(context: CanvasRenderingContext2D, color: Color): void;
|
||||
}
|
||||
|
||||
export interface CanvasRendererParameters {
|
||||
|
||||
Reference in New Issue
Block a user