source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/src/extras/helpers/GridHelper.js@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 971 bytes
Line 
1/**
2 * @author mrdoob / http://mrdoob.com/
3 */
4
5THREE.GridHelper = function ( size, step ) {
6
7 var geometry = new THREE.Geometry();
8 var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
9
10 this.color1 = new THREE.Color( 0x444444 );
11 this.color2 = new THREE.Color( 0x888888 );
12
13 for ( var i = - size; i <= size; i += step ) {
14
15 geometry.vertices.push(
16 new THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ),
17 new THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size )
18 );
19
20 var color = i === 0 ? this.color1 : this.color2;
21
22 geometry.colors.push( color, color, color, color );
23
24 }
25
26 THREE.Line.call( this, geometry, material, THREE.LinePieces );
27
28};
29
30THREE.GridHelper.prototype = Object.create( THREE.Line.prototype );
31
32THREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) {
33
34 this.color1.set( colorCenterLine );
35 this.color2.set( colorGrid );
36
37 this.geometry.colorsNeedUpdate = true;
38
39}
Note: See TracBrowser for help on using the repository browser.