1 /**
2 * @author mrdoob / http://mrdoob.com/
3 * @author alteredq / http://alteredqualia.com/
4 */
5
6 /**@constructor*/
7 THREE.Frustum = function ( ) {
8
9 this.planes = [
10
11 new THREE.Vector4(),
12 new THREE.Vector4(),
13 new THREE.Vector4(),
14 new THREE.Vector4(),
15 new THREE.Vector4(),
16 new THREE.Vector4()
17
18 ];
19
20 };
21
22 THREE.Frustum.prototype.setFromMatrix = function ( m ) {
23
24 var plane;
25 var planes = this.planes;
26
27 var me = m.elements;
28 var me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3];
29 var me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7];
30 var me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11];
31 var me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15];
32
33 planes[ 0 ].set( me3 - me0, me7 - me4, me11 - me8, me15 - me12 );
34 planes[ 1 ].set( me3 + me0, me7 + me4, me11 + me8, me15 + me12 );
35 planes[ 2 ].set( me3 + me1, me7 + me5, me11 + me9, me15 + me13 );
36 planes[ 3 ].set( me3 - me1, me7 - me5, me11 - me9, me15 - me13 );
37 planes[ 4 ].set( me3 - me2, me7 - me6, me11 - me10, me15 - me14 );
38 planes[ 5 ].set( me3 + me2, me7 + me6, me11 + me10, me15 + me14 );
39
40 for ( var i = 0; i < 6; i ++ ) {
41
42 plane = planes[ i ];
43 plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
44
45 }
46
47 };
48
49 THREE.Frustum.prototype.contains = function ( object ) {
50
51 var distance = 0.0;
52 var planes = this.planes;
53 var matrix = object.matrixWorld;
54 var me = matrix.elements;
55 var radius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
56
57 for ( var i = 0; i < 6; i ++ ) {
58
59 distance = planes[ i ].x * me[12] + planes[ i ].y * me[13] + planes[ i ].z * me[14] + planes[ i ].w;
60 if ( distance <= radius ) return false;
61
62 }
63
64 return true;
65
66 };
67
68 THREE.Frustum.__v1 = new THREE.Vector3();
69
nike free rn
new balance hombre baratas
cinturones gucci
ugg rebajas
cinturon gucci
ray ban baratas
nike cortez
peuterey mujer
christian louboutin madrid
mbt zapatos
gafas ray ban baratas
mbt ofertas
air max blancas
mbt barcelona
nike air max 90
woolrich barcelona
nike mujer
botas ugg
gafas de sol carrera aratas
air max 2016 baratas
oakley baratas
nike air max 2016