AxisHelper.js 821 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @author sroucheray / http://sroucheray.org/
  3. * @author mrdoob / http://mrdoob.com/
  4. */
  5. THREE.AxisHelper = function ( size ) {
  6. size = size || 1;
  7. var geometry = new THREE.Geometry();
  8. geometry.vertices.push(
  9. new THREE.Vector3(), new THREE.Vector3( size, 0, 0 ),
  10. new THREE.Vector3(), new THREE.Vector3( 0, size, 0 ),
  11. new THREE.Vector3(), new THREE.Vector3( 0, 0, size )
  12. );
  13. geometry.colors.push(
  14. new THREE.Color( 0xff0000 ), new THREE.Color( 0xffaa00 ),
  15. new THREE.Color( 0x00ff00 ), new THREE.Color( 0xaaff00 ),
  16. new THREE.Color( 0x0000ff ), new THREE.Color( 0x00aaff )
  17. );
  18. var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
  19. THREE.Line.call( this, geometry, material, THREE.LinePieces );
  20. };
  21. THREE.AxisHelper.prototype = Object.create( THREE.Line.prototype );