Kaynağa Gözat

Merge pull request #13323 from looeee/inline_birds

EXAMPLES:  moved code from bird.js into canvas_geometry_birds
Mr.doob 7 yıl önce
ebeveyn
işleme
b96b294cc6
2 değiştirilmiş dosya ile 39 ekleme ve 43 silme
  1. 39 3
      examples/canvas_geometry_birds.html
  2. 0 40
      examples/obj/Bird.js

+ 39 - 3
examples/canvas_geometry_birds.html

@@ -35,11 +35,47 @@
 
 		<script src="js/libs/stats.min.js"></script>
 
-		<script src="obj/Bird.js"></script>
-
 		<script>
 
-			// Based on http://www.openprocessing.org/visuals/?visualID=6910
+			var Bird = function () {
+
+				var scope = this;
+
+				THREE.Geometry.call( this );
+
+				v(   5,   0,   0 );
+				v( - 5, - 2,   1 );
+				v( - 5,   0,   0 );
+				v( - 5, - 2, - 1 );
+
+				v(   0,   2, - 6 );
+				v(   0,   2,   6 );
+				v(   2,   0,   0 );
+				v( - 3,   0,   0 );
+
+				f3( 0, 2, 1 );
+
+				f3( 4, 7, 6 );
+				f3( 5, 6, 7 );
+
+				this.computeFaceNormals();
+
+				function v( x, y, z ) {
+
+					scope.vertices.push( new THREE.Vector3( x, y, z ) );
+
+				}
+
+				function f3( a, b, c ) {
+
+					scope.faces.push( new THREE.Face3( a, b, c ) );
+
+				}
+
+			}
+
+			Bird.prototype = Object.create( THREE.Geometry.prototype );
+			Bird.prototype.constructor = Bird;
 
 			var Boid = function() {
 

+ 0 - 40
examples/obj/Bird.js

@@ -1,40 +0,0 @@
-var Bird = function () {
-
-	var scope = this;
-
-	THREE.Geometry.call( this );
-
-	v(   5,   0,   0 );
-	v( - 5, - 2,   1 );
-	v( - 5,   0,   0 );
-	v( - 5, - 2, - 1 );
-
-	v(   0,   2, - 6 );
-	v(   0,   2,   6 );
-	v(   2,   0,   0 );
-	v( - 3,   0,   0 );
-
-	f3( 0, 2, 1 );
-	// f3( 0, 3, 2 );
-
-	f3( 4, 7, 6 );
-	f3( 5, 6, 7 );
-
-	this.computeFaceNormals();
-
-	function v( x, y, z ) {
-
-		scope.vertices.push( new THREE.Vector3( x, y, z ) );
-
-	}
-
-	function f3( a, b, c ) {
-
-		scope.faces.push( new THREE.Face3( a, b, c ) );
-
-	}
-
-}
-
-Bird.prototype = Object.create( THREE.Geometry.prototype );
-Bird.prototype.constructor = Bird;