mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-15 07:56:00 +10:00
Merged with mrdoob's branch.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @author drojdjou / http://everyday3d.com/
|
||||
* @author bartek drozdz / http://everyday3d.com/
|
||||
*/
|
||||
|
||||
THREE.CollisionUtils = {};
|
||||
|
||||
@@ -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,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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user