1 /**
2 * @author mrdoob / http://mrdoob.com/
3 * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
4 */
5
6 /**@constructor*/
7 THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) {
8
9 THREE.Geometry.call( this );
10
11 this.width = width;
12 this.height = height;
13
14 this.widthSegments = widthSegments || 1;
15 this.heightSegments = heightSegments || 1;
16
17 var ix, iz;
18 var width_half = width / 2;
19 var height_half = height / 2;
20
21 var gridX = this.widthSegments;
22 var gridZ = this.heightSegments;
23
24 var gridX1 = gridX + 1;
25 var gridZ1 = gridZ + 1;
26
27 var segment_width = this.width / gridX;
28 var segment_height = this.height / gridZ;
29
30 var normal = new THREE.Vector3( 0, 0, 1 );
31
32 for ( iz = 0; iz < gridZ1; iz ++ ) {
33
34 for ( ix = 0; ix < gridX1; ix ++ ) {
35
36 var x = ix * segment_width - width_half;
37 var y = iz * segment_height - height_half;
38
39 this.vertices.push( new THREE.Vector3( x, - y, 0 ) );
40
41 }
42
43 }
44
45 for ( iz = 0; iz < gridZ; iz ++ ) {
46
47 for ( ix = 0; ix < gridX; ix ++ ) {
48
49 var a = ix + gridX1 * iz;
50 var b = ix + gridX1 * ( iz + 1 );
51 var c = ( ix + 1 ) + gridX1 * ( iz + 1 );
52 var d = ( ix + 1 ) + gridX1 * iz;
53
54 var face = new THREE.Face4( a, b, c, d );
55 face.normal.copy( normal );
56 face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
57
58 this.faces.push( face );
59 this.faceVertexUvs[ 0 ].push( [
60 new THREE.UV( ix / gridX, 1 - iz / gridZ ),
61 new THREE.UV( ix / gridX, 1 - ( iz + 1 ) / gridZ ),
62 new THREE.UV( ( ix + 1 ) / gridX, 1 - ( iz + 1 ) / gridZ ),
63 new THREE.UV( ( ix + 1 ) / gridX, 1 - iz / gridZ )
64 ] );
65
66 }
67
68 }
69
70 this.computeCentroids();
71
72 };
73
74 THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );
75
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