Plane.js 628 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. var Plane = function (width, height) {
  5. THREE.Geometry.call(this);
  6. var scope = this,
  7. width_half = width / 2,
  8. height_half = height / 2;
  9. v( -width_half, height_half, 0 );
  10. v( width_half, height_half, 0 );
  11. v( width_half, -height_half, 0 );
  12. v( -width_half, -height_half, 0 );
  13. f4( 0, 1, 2, 3 );
  14. function v(x, y, z) {
  15. scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
  16. }
  17. function f4(a, b, c, d) {
  18. scope.faces.push( new THREE.Face4(a, b, c, d) );
  19. }
  20. }
  21. Plane.prototype = new THREE.Geometry();
  22. Plane.prototype.constructor = Plane;