mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 00:18:20 +08:00
Fix failing tests after https://github.com/Microsoft/TypeScript/pull/11263 (#11835)
* Fix fialing tests after https://github.com/Microsoft/TypeScript/pull/11263 * Fix more failures
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import fs = require("fs");
|
||||
|
||||
var fs, path;
|
||||
var path: {
|
||||
exists: (path: string, callback?: (err: string, exists: boolean) => any) => void;
|
||||
};
|
||||
|
||||
function callback() {}
|
||||
function callback() { }
|
||||
|
||||
async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
|
||||
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
|
||||
|
||||
@@ -889,7 +889,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
response = { status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!" };
|
||||
response = { status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!", responseType: "json" };
|
||||
request.respondWith(response);
|
||||
|
||||
sharedContext.responseCallback = success;
|
||||
@@ -1102,7 +1102,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
response = { status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}' };
|
||||
response = { status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}', responseType: "json"};
|
||||
request.respondWith(response);
|
||||
|
||||
sharedContext.responseCallback = error;
|
||||
@@ -1138,7 +1138,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
response = { status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){" };
|
||||
response = { status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){",responseType: "json"};
|
||||
request.respondWith(response);
|
||||
|
||||
sharedContext.responseCallback = error;
|
||||
@@ -1175,7 +1175,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
||||
client.send();
|
||||
|
||||
request = mockAjax.requests.mostRecent();
|
||||
response = { contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text" };
|
||||
response = { contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text", status: 200, statusText: 'OK' };
|
||||
request.responseTimeout(response);
|
||||
|
||||
sharedContext.responseCallback = error;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -816,11 +816,7 @@ function test_autocomplete() {
|
||||
}, response);
|
||||
},
|
||||
search: () => {
|
||||
// custom minLength
|
||||
var term = null
|
||||
if (term.length < 2) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
focus: () => {
|
||||
return false;
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('Templating', function() {
|
||||
});
|
||||
|
||||
it('Should be able to access newly rendered/inserted elements in \'afterRender\' callaback', function () {
|
||||
var passedElement, passedDataItem;
|
||||
var passedElement:any, passedDataItem;
|
||||
var myCallback = function(elementsArray, dataItem) {
|
||||
expect(elementsArray.length).toEqual(1);
|
||||
passedElement = elementsArray[0];
|
||||
|
||||
@@ -242,7 +242,13 @@ function test_bindings() {
|
||||
}
|
||||
};
|
||||
|
||||
var node, containerElem, nodeToInsert, insertAfter, nodeToPrepend, arrayOfNodes;
|
||||
var node: Node = <any>{};
|
||||
var insertAfter: Node = <any>{};
|
||||
var nodeToPrepend: Node = <any>{};
|
||||
var arrayOfNodes: Node[] = <any>[];
|
||||
var containerElem: KnockoutVirtualElement = <any>{};
|
||||
var nodeToInsert: Node = <any>{}
|
||||
|
||||
ko.virtualElements.emptyNode(containerElem);
|
||||
ko.virtualElements.firstChild(containerElem);
|
||||
ko.virtualElements.insertAfter(containerElem, nodeToInsert, insertAfter);
|
||||
@@ -568,7 +574,7 @@ function test_misc() {
|
||||
|
||||
var x = ko.observableArray([1, 2, 3]);
|
||||
|
||||
var element;
|
||||
var element: Element = <any>{};
|
||||
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
|
||||
$(element).datepicker("destroy");
|
||||
});
|
||||
|
||||
@@ -7,11 +7,11 @@ function test_activityDefaults() {
|
||||
container: 'i',
|
||||
inactiveClass: ''
|
||||
};
|
||||
|
||||
|
||||
ko.bindingHandlers.activity.defaultOptions = {
|
||||
activityClass: 'some Value'
|
||||
};
|
||||
|
||||
|
||||
ko.bindingHandlers.activity.defaultOptions = {
|
||||
};
|
||||
}
|
||||
@@ -60,12 +60,12 @@ function test_asyncCommand_isExecuting() {
|
||||
}
|
||||
|
||||
function test_dirtyFlag() {
|
||||
var viewModel;
|
||||
var viewModel: any;
|
||||
viewModel.dirtyFlag = new ko.DirtyFlag(viewModel.model);
|
||||
viewModel.dirtyFlag().isDirty();
|
||||
viewModel.dirtyFlag().reset();
|
||||
|
||||
var self;
|
||||
var self: any;
|
||||
this.dirtyFlag = new ko.DirtyFlag(
|
||||
self.firstName,
|
||||
self.lastName);
|
||||
|
||||
@@ -13,20 +13,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '1px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '1px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene();
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -62,7 +62,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
//// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Materials
|
||||
@@ -71,16 +71,16 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
box_material = Physijs.createMaterial(
|
||||
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }),
|
||||
.4, // low friction
|
||||
.6 // high restitution
|
||||
);
|
||||
box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
box_material.map.repeat.set( .25, .25 );
|
||||
// box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// box_material.map.repeat.set( .25, .25 );
|
||||
|
||||
// Ground
|
||||
ground = new Physijs.BoxMesh(
|
||||
@@ -131,8 +131,8 @@ render = function() {
|
||||
setMousePosition = function( evt ) {
|
||||
// Find where mouse cursor intersects the ground plane
|
||||
var vector = new THREE.Vector3(
|
||||
( evt.clientX / renderer.domElement.clientWidth ) * 2 - 1,
|
||||
-( ( evt.clientY / renderer.domElement.clientHeight ) * 2 - 1 ),
|
||||
( evt.clientX / renderer.dom.clientWidth ) * 2 - 1,
|
||||
-( ( evt.clientY / renderer.dom.clientHeight ) * 2 - 1 ),
|
||||
.5
|
||||
);
|
||||
projector.unprojectVector( vector, camera );
|
||||
|
||||
@@ -12,20 +12,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -60,7 +60,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
//// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Ground
|
||||
@@ -69,8 +69,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.3 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
//ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
ground = new Physijs.BoxMesh(
|
||||
new THREE.BoxGeometry(100, 1, 100),
|
||||
@@ -89,7 +89,7 @@ initScene = function() {
|
||||
spawnBox = (function() {
|
||||
|
||||
var box_geometry = new THREE.BoxGeometry( 4, 4, 4 ),
|
||||
handleCollision = function( collided_with, linearVelocity, angularVelocity ) {
|
||||
handleCollision = function( collided_with ) {
|
||||
var target = <any>this;
|
||||
target.collisions = 0;
|
||||
switch (++target.collisions) {
|
||||
@@ -127,8 +127,8 @@ spawnBox = (function() {
|
||||
.6, // medium friction
|
||||
.3 // low restitution
|
||||
);
|
||||
material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping;
|
||||
material.map.repeat.set( .5, .5 );
|
||||
// material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping;
|
||||
// material.map.repeat.set( .5, .5 );
|
||||
|
||||
//material = new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) });
|
||||
|
||||
@@ -137,7 +137,7 @@ spawnBox = (function() {
|
||||
material
|
||||
);
|
||||
|
||||
box.collisions = 0;
|
||||
// box.collisions = 0;
|
||||
|
||||
box.position.set(
|
||||
Math.random() * 15 - 7.5,
|
||||
|
||||
@@ -12,20 +12,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -50, 0 ));
|
||||
@@ -60,7 +60,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Materials
|
||||
@@ -69,16 +69,16 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
chair_material = Physijs.createMaterial(
|
||||
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/wood.jpg' ) }),
|
||||
.6, // medium friction
|
||||
.2 // low restitution
|
||||
);
|
||||
chair_material.map.wrapS = chair_material.map.wrapT = THREE.RepeatWrapping;
|
||||
chair_material.map.repeat.set( .25, .25 );
|
||||
// chair_material.map.wrapS = chair_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// chair_material.map.repeat.set( .25, .25 );
|
||||
|
||||
// Ground
|
||||
ground = new Physijs.BoxMesh(
|
||||
|
||||
@@ -14,20 +14,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -62,7 +62,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
//// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Materials
|
||||
@@ -71,8 +71,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
// Ground
|
||||
ground = new Physijs.BoxMesh(
|
||||
|
||||
@@ -17,20 +17,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 });
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -65,7 +65,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// // light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Materials
|
||||
@@ -74,8 +74,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 2.5, 2.5 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 2.5, 2.5 );
|
||||
|
||||
// Ground
|
||||
NoiseGen = new SimplexNoise;
|
||||
@@ -155,7 +155,7 @@ createShape = (function() {
|
||||
break;
|
||||
}
|
||||
|
||||
shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 );
|
||||
// shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 );
|
||||
shape.castShadow = true;
|
||||
shape.receiveShadow = true;
|
||||
|
||||
|
||||
@@ -12,20 +12,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '1px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '1px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 });
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -78,7 +78,7 @@ initScene = function() {
|
||||
dir_light.shadowCameraFar = 200;
|
||||
dir_light.shadowBias = -.001
|
||||
dir_light.shadowMapWidth = dir_light.shadowMapHeight = 2048;
|
||||
dir_light.shadowDarkness = .5;
|
||||
// dir_light.shadowDarkness = .5;
|
||||
scene.add( dir_light );
|
||||
|
||||
// Materials
|
||||
@@ -87,16 +87,16 @@ initScene = function() {
|
||||
.9, // high friction
|
||||
.2 // low restitution
|
||||
);
|
||||
table_material.map.wrapS = table_material.map.wrapT = THREE.RepeatWrapping;
|
||||
table_material.map.repeat.set( 5, 5 );
|
||||
// table_material.map.wrapS = table_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// table_material.map.repeat.set( 5, 5 );
|
||||
|
||||
block_material = Physijs.createMaterial(
|
||||
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }),
|
||||
.4, // medium friction
|
||||
.4 // medium restitution
|
||||
);
|
||||
block_material.map.wrapS = block_material.map.wrapT = THREE.RepeatWrapping;
|
||||
block_material.map.repeat.set( 1, .5 );
|
||||
// block_material.map.wrapS = block_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// block_material.map.repeat.set( 1, .5 );
|
||||
|
||||
// Table
|
||||
table = new Physijs.BoxMesh(
|
||||
@@ -179,10 +179,10 @@ initEventHandling = (function() {
|
||||
selected_block = intersections[0].object;
|
||||
|
||||
_vector.set( 0, 0, 0 );
|
||||
selected_block.setAngularFactor( _vector );
|
||||
selected_block.setAngularVelocity( _vector );
|
||||
selected_block.setLinearFactor( _vector );
|
||||
selected_block.setLinearVelocity( _vector );
|
||||
// selected_block.setAngularFactor( _vector );
|
||||
// selected_block.setAngularVelocity( _vector );
|
||||
// selected_block.setLinearFactor( _vector );
|
||||
// selected_block.setLinearVelocity( _vector );
|
||||
|
||||
mouse_pos.copy( intersections[0].point );
|
||||
block_offset.subVectors( selected_block.position, mouse_pos );
|
||||
@@ -225,9 +225,9 @@ initEventHandling = (function() {
|
||||
};
|
||||
|
||||
return function() {
|
||||
renderer.domElement.addEventListener( 'mousedown', handleMouseDown );
|
||||
renderer.domElement.addEventListener( 'mousemove', handleMouseMove );
|
||||
renderer.domElement.addEventListener( 'mouseup', handleMouseUp );
|
||||
renderer.dom.addEventListener( 'mousedown', handleMouseDown );
|
||||
renderer.dom.addEventListener( 'mousemove', handleMouseMove );
|
||||
renderer.dom.addEventListener( 'mouseup', handleMouseUp );
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
@@ -17,20 +17,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// // renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -81,7 +81,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// // light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Ground
|
||||
@@ -90,8 +90,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.3 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
ground = new Physijs.BoxMesh(
|
||||
new THREE.BoxGeometry(100, 1, 100),
|
||||
@@ -119,7 +119,7 @@ spawnBox = (function() {
|
||||
.3 // low restitution
|
||||
);
|
||||
|
||||
material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
// material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
|
||||
box = new Physijs.BoxMesh(
|
||||
box_geometry,
|
||||
@@ -130,8 +130,8 @@ spawnBox = (function() {
|
||||
material
|
||||
);
|
||||
|
||||
childBox.collisions = 0;
|
||||
box.collisions = 0;
|
||||
// childBox.collisions = 0;
|
||||
// box.collisions = 0;
|
||||
box.add(childBox);
|
||||
|
||||
box.position.set(
|
||||
|
||||
@@ -17,20 +17,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -81,7 +81,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Ground
|
||||
@@ -90,8 +90,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.3 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
ground = new Physijs.BoxMesh(
|
||||
new THREE.BoxGeometry(100, 1, 100),
|
||||
@@ -119,13 +119,13 @@ spawnBox = (function() {
|
||||
.3 // low restitution
|
||||
);
|
||||
|
||||
material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
// material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
|
||||
box = new Physijs.ConvexMesh(
|
||||
box_geometry,
|
||||
material
|
||||
);
|
||||
box.collisions = 0;
|
||||
// box.collisions = 0;
|
||||
|
||||
box.position.set(
|
||||
Math.random() * 15 - 7.5,
|
||||
|
||||
@@ -17,20 +17,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -81,7 +81,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Ground
|
||||
@@ -90,8 +90,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.3 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
ground = new Physijs.BoxMesh(
|
||||
new THREE.BoxGeometry(100, 1, 100),
|
||||
@@ -119,13 +119,13 @@ spawnBox = (function() {
|
||||
.3 // low restitution
|
||||
);
|
||||
|
||||
material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
// material.color.setRGB(Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100);
|
||||
|
||||
box = new Physijs.BoxMesh(
|
||||
box_geometry,
|
||||
material
|
||||
);
|
||||
box.collisions = 0;
|
||||
// box.collisions = 0;
|
||||
|
||||
box.position.set(
|
||||
Math.random() * 15 - 7.5,
|
||||
|
||||
@@ -18,20 +18,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '0px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '0px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 });
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -66,7 +66,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 200;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
// Materials
|
||||
@@ -75,8 +75,8 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 2.5, 2.5 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 2.5, 2.5 );
|
||||
|
||||
// Ground
|
||||
ground = new Physijs.BoxMesh(
|
||||
@@ -204,7 +204,7 @@ createShape = (function() {
|
||||
break;
|
||||
}
|
||||
|
||||
shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 );
|
||||
// shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 );
|
||||
shape.castShadow = true;
|
||||
shape.receiveShadow = true;
|
||||
|
||||
|
||||
@@ -18,20 +18,20 @@ initScene = function() {
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMapEnabled = true;
|
||||
renderer.shadowMapSoft = true;
|
||||
// renderer.shadowMapSoft = true;
|
||||
document.getElementById( 'viewport' ).appendChild( renderer.domElement );
|
||||
|
||||
render_stats = new Stats();
|
||||
render_stats.domElement.style.position = 'absolute';
|
||||
render_stats.domElement.style.top = '1px';
|
||||
render_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.domElement );
|
||||
render_stats.dom.style.position = 'absolute';
|
||||
render_stats.dom.style.top = '1px';
|
||||
render_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( render_stats.dom );
|
||||
|
||||
physics_stats = new Stats();
|
||||
physics_stats.domElement.style.position = 'absolute';
|
||||
physics_stats.domElement.style.top = '50px';
|
||||
physics_stats.domElement.style.zIndex = 100;
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.domElement );
|
||||
physics_stats.dom.style.position = 'absolute';
|
||||
physics_stats.dom.style.top = '50px';
|
||||
physics_stats.dom.style.zIndex = '100';
|
||||
document.getElementById( 'viewport' ).appendChild( physics_stats.dom );
|
||||
|
||||
scene = new Physijs.Scene;
|
||||
scene.setGravity(new THREE.Vector3( 0, -30, 0 ));
|
||||
@@ -84,7 +84,7 @@ initScene = function() {
|
||||
light.shadowCameraFar = 400;
|
||||
light.shadowBias = -.0001
|
||||
light.shadowMapWidth = light.shadowMapHeight = 2048;
|
||||
light.shadowDarkness = .7;
|
||||
// light.shadowDarkness = .7;
|
||||
scene.add( light );
|
||||
|
||||
|
||||
@@ -97,16 +97,16 @@ initScene = function() {
|
||||
.8, // high friction
|
||||
.4 // low restitution
|
||||
);
|
||||
ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
ground_material.map.repeat.set( 3, 3 );
|
||||
// ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// ground_material.map.repeat.set( 3, 3 );
|
||||
|
||||
box_material = Physijs.createMaterial(
|
||||
new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }),
|
||||
.4, // low friction
|
||||
.6 // high restitution
|
||||
);
|
||||
box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
box_material.map.repeat.set( .25, .25 );
|
||||
// box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping;
|
||||
// box_material.map.repeat.set( .25, .25 );
|
||||
|
||||
// Ground
|
||||
var NoiseGen = new SimplexNoise;
|
||||
|
||||
@@ -96,9 +96,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
document.addEventListener('mousedown', onDocumentMouseDown, false);
|
||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
document.addEventListener('mousedown', onDocumentMouseDown, false);
|
||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||
|
||||
@@ -135,9 +135,9 @@
|
||||
debugContext.strokeStyle = '#000000';
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||
|
||||
@@ -43,13 +43,16 @@
|
||||
|
||||
if (!Detector.webgl) Detector.addGetWebGLMessage();
|
||||
|
||||
var container, stats;
|
||||
var camera, scene, renderer;
|
||||
|
||||
var clothGeometry;
|
||||
var sphere;
|
||||
var object, arrow;
|
||||
|
||||
var container: HTMLElement;
|
||||
var stats: Stats;
|
||||
var camera: THREE.PerspectiveCamera;
|
||||
var scene: THREE.Scene;
|
||||
var renderer: THREE.WebGLRenderer;
|
||||
var clothGeometry: THREE.ParametricGeometry;
|
||||
var sphere: THREE.Mesh;
|
||||
var object: THREE.Mesh;
|
||||
var arrow: THREE.ArrowHelper;
|
||||
var light: THREE.DirectionalLight, materials;
|
||||
var rotate = true;
|
||||
|
||||
init();
|
||||
@@ -75,8 +78,6 @@
|
||||
|
||||
// lights
|
||||
|
||||
var light, materials;
|
||||
|
||||
scene.add(new THREE.AmbientLight(0x666666));
|
||||
|
||||
light = new THREE.DirectionalLight(0xdfebff, 1.75);
|
||||
@@ -97,7 +98,7 @@
|
||||
light.shadowCameraBottom = -d;
|
||||
|
||||
light.shadowCameraFar = 1000;
|
||||
light.shadowDarkness = 0.5;
|
||||
//light.shadowDarkness = 0.5;
|
||||
|
||||
scene.add(light);
|
||||
|
||||
@@ -111,7 +112,7 @@
|
||||
|
||||
// cloth geometry
|
||||
clothGeometry = new THREE.ParametricGeometry(clothFunction, cloth.w, cloth.h);
|
||||
clothGeometry.dynamic = true;
|
||||
//clothGeometry.dynamic = true;
|
||||
clothGeometry.computeFaceNormals();
|
||||
|
||||
var uniforms = { texture: { value: clothTexture } };
|
||||
@@ -126,7 +127,7 @@
|
||||
object.receiveShadow = true;
|
||||
scene.add(object);
|
||||
|
||||
object.customDepthMaterial = new THREE.ShaderMaterial({ uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader });
|
||||
//object.customDepthMaterial = new THREE.ShaderMaterial({ uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader });
|
||||
|
||||
// sphere
|
||||
|
||||
@@ -217,7 +218,7 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
container.appendChild(stats.domElement);
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
var SCREEN_HEIGHT = window.innerHeight;
|
||||
var FLOOR = -250;
|
||||
|
||||
var container,stats;
|
||||
|
||||
var camera, scene;
|
||||
var renderer;
|
||||
|
||||
var mesh, helper;
|
||||
|
||||
var mixer;
|
||||
var container: HTMLElement;
|
||||
var stats: Stats;
|
||||
var camera: THREE.PerspectiveCamera;
|
||||
var scene: THREE.Scene;
|
||||
var renderer: THREE.WebGLRenderer;
|
||||
var mesh: THREE.Mesh;
|
||||
var helper: THREE.SkeletonHelper;
|
||||
var mixer: THREE.AnimationMixer;
|
||||
|
||||
var mouseX = 0, mouseY = 0;
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
// STATS
|
||||
|
||||
stats = new Stats();
|
||||
container.appendChild( stats.domElement );
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
//
|
||||
|
||||
@@ -177,12 +177,12 @@
|
||||
mesh.receiveShadow = true;
|
||||
|
||||
helper = new THREE.SkeletonHelper( mesh );
|
||||
helper.material.linewidth = 3;
|
||||
//helper.material.linewidth = 3;
|
||||
helper.visible = false;
|
||||
scene.add( helper );
|
||||
|
||||
|
||||
var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', mesh.geometry.morphTargets, 3, true );
|
||||
var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', (mesh.geometry as THREE.Geometry).morphTargets, 3, true );
|
||||
var clipBones = geometry.animations[0];
|
||||
|
||||
mixer = new THREE.AnimationMixer( mesh );
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
|
||||
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
||||
|
||||
var container, stats;
|
||||
|
||||
var camera, scene, renderer;
|
||||
|
||||
var mesh;
|
||||
var container: HTMLElement;
|
||||
var stats: Stats;
|
||||
var camera: THREE.PerspectiveCamera;
|
||||
var scene: THREE.Scene;
|
||||
var renderer: THREE.WebGLRenderer;
|
||||
var mesh: THREE.Mesh;
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -176,9 +177,9 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild( stats.domElement );
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
var SCREEN_WIDTH = window.innerWidth;
|
||||
var SCREEN_HEIGHT = window.innerHeight;
|
||||
|
||||
var container, stats;
|
||||
var camera, scene, renderer, mesh;
|
||||
var container: HTMLElement;
|
||||
var stats: Stats;
|
||||
var camera: THREE.PerspectiveCamera;
|
||||
var scene: THREE.Scene;
|
||||
var renderer: THREE.WebGLRenderer;
|
||||
var mesh: THREE.Mesh;
|
||||
|
||||
var cameraRig, activeCamera, activeHelper;
|
||||
var cameraPerspective, cameraOrtho;
|
||||
var cameraPerspectiveHelper, cameraOrthoHelper;
|
||||
@@ -112,7 +117,7 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
container.appendChild( stats.domElement );
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
@@ -104,16 +104,16 @@
|
||||
|
||||
uniforms.amplitude.value = 2.5 * Math.sin(sphere.rotation.y * 0.125);
|
||||
uniforms.color.value.offsetHSL(0.0005, 0, 0);
|
||||
|
||||
|
||||
for ( var i = 0; i < displacement.length; i ++ ) {
|
||||
|
||||
|
||||
displacement[ i ] = Math.sin( 0.1 * i + time );
|
||||
|
||||
|
||||
noise[ i ] += 0.5 * ( 0.5 - Math.random() );
|
||||
noise[ i ] = THREE.Math.clamp( noise[ i ], -5, 5 );
|
||||
|
||||
|
||||
displacement[ i ] += noise[ i ];
|
||||
|
||||
|
||||
}
|
||||
|
||||
sphere.geometry.attributes.displacement.needsUpdate = true;
|
||||
|
||||
@@ -116,9 +116,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
||||
|
||||
@@ -147,4 +147,4 @@
|
||||
renderer.render(scene, camera);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,9 +249,9 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
// stats
|
||||
|
||||
stats = new Stats();
|
||||
container.appendChild(stats.domElement);
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
// events
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
// STATS
|
||||
|
||||
stats = new Stats();
|
||||
container.appendChild( stats.domElement );
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -73,23 +73,20 @@
|
||||
|
||||
material = new THREE.LineBasicMaterial({ color: 0xffffff, opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors });
|
||||
|
||||
var line, p, scale = 0.3, d = 225;
|
||||
var parameters = [
|
||||
var line, scale = 0.3, d = 225;
|
||||
var parameters : [THREE.LineBasicMaterial, number, [number, number, number], THREE.Geometry][] = [
|
||||
[material, scale * 1.5, [-d, 0, 0], geometry],
|
||||
[material, scale * 1.5, [0, 0, 0], geometry2],
|
||||
[material, scale * 1.5, [d, 0, 0], geometry3]
|
||||
];
|
||||
|
||||
for (i = 0; i < parameters.length; ++i) {
|
||||
|
||||
p = parameters[i];
|
||||
for (const p of parameters) {
|
||||
line = new THREE.Line(p[3], p[0]);
|
||||
line.scale.x = line.scale.y = line.scale.z = p[1];
|
||||
line.position.x = p[2][0];
|
||||
line.position.y = p[2][1];
|
||||
line.position.z = p[2][2];
|
||||
scene.add(line);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -77,9 +77,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -146,10 +146,10 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
|
||||
container.appendChild(stats.domElement);
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
//
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild( stats.domElement );
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
container.appendChild(stats.domElement);
|
||||
stats.dom.style.position = 'absolute';
|
||||
stats.dom.style.top = '0px';
|
||||
container.appendChild(stats.dom);
|
||||
|
||||
onWindowResize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user