Skip to content

Commit d6515a7

Browse files
committed
GridHelper: Removed colorCenterLine
1 parent ddae84d commit d6515a7

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

docs/api/en/helpers/GridHelper.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ <h2>Examples</h2>
3030

3131
<h2>Constructor</h2>
3232

33-
<h3>[name]( [param:number size], [param:Number divisions], [param:Color colorCenterLine], [param:Color colorGrid] )</h3>
33+
<h3>[name]( [param:number size], [param:Number divisions], [param:Color color] )</h3>
3434
<p>
3535
size -- The size of the grid. Default is 10. <br />
3636
divisions -- The number of divisions across the grid. Default is 10. <br />
37-
colorCenterLine -- The color of the centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444 <br />
38-
colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
37+
color -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
3938
</p>
4039
<p>
4140
Creates a new [name] of size 'size' and divided into 'divisions' segments per side. Colors are optional.

src/helpers/GridHelper.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,27 @@ import { LineSegments } from '../objects/LineSegments.js';
22
import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
33
import { Float32BufferAttribute } from '../core/BufferAttribute.js';
44
import { BufferGeometry } from '../core/BufferGeometry.js';
5-
import { Color } from '../math/Color.js';
65

76
class GridHelper extends LineSegments {
87

9-
constructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {
8+
constructor( size = 10, divisions = 10, color = 0x444444 ) {
109

11-
color1 = new Color( color1 );
12-
color2 = new Color( color2 );
13-
14-
const center = divisions / 2;
1510
const step = size / divisions;
1611
const halfSize = size / 2;
1712

18-
const vertices = [], colors = [];
13+
const vertices = [];
1914

20-
for ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
15+
for ( let i = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
2116

2217
vertices.push( - halfSize, 0, k, halfSize, 0, k );
2318
vertices.push( k, 0, - halfSize, k, 0, halfSize );
2419

25-
const color = i === center ? color1 : color2;
26-
27-
color.toArray( colors, j ); j += 3;
28-
color.toArray( colors, j ); j += 3;
29-
color.toArray( colors, j ); j += 3;
30-
color.toArray( colors, j ); j += 3;
31-
3220
}
3321

3422
const geometry = new BufferGeometry();
3523
geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
36-
geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
3724

38-
const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
25+
const material = new LineBasicMaterial( { color: color, toneMapped: false } );
3926

4027
super( geometry, material );
4128

0 commit comments

Comments
 (0)