Merged with mrdoob's branch.

This commit is contained in:
alteredq
2011-04-13 12:43:36 +02:00
12 changed files with 142 additions and 125 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* @author drojdjou / http://everyday3d.com/
* @author bartek drozdz / http://everyday3d.com/
*/
THREE.CollisionUtils = {};
+11 -4
View File
@@ -1,5 +1,5 @@
/**
* @author drojdjou / http://everyday3d.com/
* @author bartek drozdz / http://everyday3d.com/
*/
THREE.PlaneCollider = function( point, normal ) {
@@ -38,6 +38,7 @@ THREE.MeshCollider = function( vertices, faces, normals, box ) {
THREE.CollisionSystem = function() {
this.collisionNormal = null;
this.colliders = [];
this.hits = [];
@@ -139,8 +140,12 @@ THREE.CollisionSystem.prototype.rayMesh = function( r, me ) {
var p2 = me.vertices[ me.faces[ t + 2 ] ];
var n = me.normals[ me.faces[ i ] ];
d = Math.min(d, this.rayTriangle( rt, p0, p1, p2, n, d ) );
var nd = this.rayTriangle( rt, p0, p1, p2, n, d );
if(nd < d) {
d = nd;
me.normal = this.collisionNormal;
}
}
return d;
@@ -245,7 +250,9 @@ THREE.CollisionSystem.prototype.rayTriangle = function( ray, p0, p1, p2, n, mind
var gamma = 1 - alpha - beta;
if( !(gamma >= 0) ) return Number.MAX_VALUE;
//console.log("gamma: " + gamma);
this.collisionNormal = n;
return t;
};
+2 -1
View File
@@ -2,13 +2,14 @@
* @author mr.doob / http://mrdoob.com/
*/
THREE.DirectionalLight = function ( hex, intensity, distance ) {
THREE.DirectionalLight = function ( hex, intensity, distance, castShadow ) {
THREE.Light.call( this, hex );
this.position = new THREE.Vector3( 0, 1, 0 );
this.intensity = intensity || 1;
this.distance = distance || 0;
this.castShadow = castShadow !== undefined ? castShadow : false;
};
+7 -1
View File
@@ -344,6 +344,12 @@ THREE.WebGLRenderer = function ( parameters ) {
_stencilShadow.darkness = value;
};
this.getContext = function() {
return _gl;
}
function setupLights ( program, lights ) {
@@ -3222,7 +3228,7 @@ THREE.WebGLRenderer = function ( parameters ) {
light = scene.lights[ l ];
if ( light instanceof THREE.DirectionalLight ) {
if ( light instanceof THREE.DirectionalLight && light.castShadow ) {
dirLight[ 0 ] = -light.position.x;
dirLight[ 1 ] = -light.position.y;