Axes.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @author sroucheray / http://sroucheray.org/
  3. * @author mr.doob / http://mrdoob.com/
  4. */
  5. THREE.Axes = function () {
  6. THREE.Object3D.call( this );
  7. var lineGeometry = new THREE.Geometry();
  8. lineGeometry.vertices.push( new THREE.Vertex() );
  9. lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 100, 0 ) ) );
  10. var coneGeometry = new THREE.CylinderGeometry( 0, 5, 25, 5, 1 );
  11. // x
  12. var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0xff0000 } ) );
  13. line.rotation.z = - Math.PI / 2;
  14. this.add( line );
  15. var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0xff0000 } ) );
  16. cone.position.x = 100;
  17. cone.rotation.z = - Math.PI / 2;
  18. this.add( cone );
  19. // y
  20. var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0x00ff00 } ) );
  21. this.add( line );
  22. var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0x00ff00 } ) );
  23. cone.position.y = 100;
  24. this.add( cone );
  25. // z
  26. var line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color : 0x0000ff } ) );
  27. line.rotation.x = Math.PI / 2;
  28. this.add( line );
  29. var cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color : 0x0000ff } ) );
  30. cone.position.z = 100;
  31. cone.rotation.x = Math.PI / 2;
  32. this.add( cone );
  33. };
  34. THREE.Axes.prototype = new THREE.Object3D();
  35. THREE.Axes.prototype.constructor = THREE.Axes;