提交 f5e7e679 编写于 作者: H Hectate

Updating PolarGridHelper per code review changes requested

上级 73e006e6
import { LineSegments } from '../../objects/LineSegments';
import { VertexColors } from '../../constants';
import { LineBasicMaterial } from '../../materials/LineBasicMaterial';
import { Float32Attribute } from '../../core/BufferAttribute';
import { Float32BufferAttribute } from '../../core/BufferAttribute';
import { BufferGeometry } from '../../core/BufferGeometry';
import { Color } from '../../math/Color';
import { _Math as Math } from '../../math/Math';
/**
* @author mrdoob / http://mrdoob.com/
......@@ -18,8 +17,8 @@ function PolarGridHelper( radius, radials, circles, divisions, color1, color2 )
radials = radials || 16;
circles = circles || 8;
divisions = divisions || 50;
color1 = new THREE.Color( color1 !== undefined ? color1 : 0x444444 );
color2 = new THREE.Color( color2 !== undefined ? color2 : 0x888888 );
color1 = new Color( color1 !== undefined ? color1 : 0x444444 );
color2 = new Color( color2 !== undefined ? color2 : 0x888888 );
var vertices = [];
var colors = [];
......@@ -80,15 +79,15 @@ function PolarGridHelper( radius, radials, circles, divisions, color1, color2 )
}
var geometry = new THREE.BufferGeometry();
geometry.addAttribute( 'position', new THREE.Float32Attribute( vertices, 3 ) );
geometry.addAttribute( 'color', new THREE.Float32Attribute( colors, 3 ) );
var geometry = new BufferGeometry();
geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
var material = new LineBasicMaterial( { vertexColors: VertexColors } );
THREE.LineSegments.call( this, geometry, material );
LineSegments.call( this, geometry, material );
}
PolarGridHelper.prototype = Object.create( THREE.LineSegments.prototype );
PolarGridHelper.prototype = Object.create( LineSegments.prototype );
PolarGridHelper.prototype.constructor = PolarGridHelper;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册