Plane.js 579 B

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