UNPKG

three

Version:

JavaScript 3D library

34 lines (24 loc) 891 B
/** * @author sroucheray / http://sroucheray.org/ * @author mrdoob / http://mrdoob.com/ */ THREE.AxisHelper = function ( size ) { size = size || 1; var vertices = new Float32Array( [ 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size ] ); var colors = new Float32Array( [ 1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1 ] ); var geometry = new THREE.BufferGeometry(); geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) ); var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); THREE.LineSegments.call( this, geometry, material ); }; THREE.AxisHelper.prototype = Object.create( THREE.LineSegments.prototype ); THREE.AxisHelper.prototype.constructor = THREE.AxisHelper;