topical media & game development

talk show tell print

#graphic-flex-image-effects-01-Flex-DrawTrianglesCullingTest.ax

#graphic-flex-image-effects-01-Flex-DrawTrianglesCullingTest.ax [swf] [flash] flex


  package {
  
          import flash.display.Sprite;
          import flash.display.TriangleCulling;
  
          [SWF(width=550, height=400, backgroundColor=0xFFFFFF)]
  
          
Demonstrates simple use of drawing triangles using a sold fill. Indices are used to define two triangles using four vertices. Backface culling is used to reveal only triangles defined with vertices in a clockwise manner.

  
          public class @ax-graphic-flex-image-effects-01-Flex-DrawTrianglesCullingTest extends Sprite {
  
                  
Constructor. Handles the drawing.

  
                  public function @ax-graphic-flex-image-effects-01-Flex-DrawTrianglesCullingTest() {
                          var vertices:Vector.<Number> = new Vector.<Number>();
                          vertices.push(100, 50);
                          vertices.push(150, 100);
                          vertices.push(50, 100);
                          vertices.push(100, 150);
  
                          var indices:Vector.<int> = new Vector.<int>();
                          indices.push(0, 1, 2);
                          indices.push(1, 2, 3);
  
                          graphics.beginFill(0xFF);
                          graphics.drawTriangles(vertices, indices, null, TriangleCulling.POSITIVE);
                          graphics.endFill();
                  }
  
          }
  
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.