Ejemplo n.º 1
0
        public static Face MakeFace( List<Vector3> vertices, int offset, ShapeFill fill, bool reverseWind )
        {
            List<int> indices = new List<int>();

            for(int i = 0; i < vertices.Count/2; i++)
            {
                indices.Add( (vertices.Count - 1) - i + offset);
                indices.Add( i + offset );
            }

            List<int> triangles = TriangleStripToTriangles( indices.ToArray(), reverseWind );
            return new Face( vertices, triangles, fill  );
        }
Ejemplo n.º 2
0
        public static Face MakeEdgeFace( List<Vector3> vertices, int edgeLength, int offset, ShapeFill fill, bool reverseWind = false )
        {
            List<int> indices = new List<int>();

            for( int i = 0; i < edgeLength; i++ )
            {
                indices.Add( i + offset );
                indices.Add( i + edgeLength + offset );
            }

            indices.Add( offset );
            indices.Add( edgeLength + offset );

            List<int> triangles = TriangleStripToTriangles( indices.ToArray(), reverseWind );
            return new Face( vertices, triangles, fill );
        }
Ejemplo n.º 3
0
        public static Material RequestMaterial( ShapeFill fill )
        {
            ShapeMaterial cachedMaterial = null;
            for(int i = 0; i < shapeMaterials.Count; i++ )
            {
                ShapeMaterial material = shapeMaterials[i];
                if( material.MatchesShapeFillRequirements( fill ) )
                {
                    cachedMaterial = material;
                    break;
                }
            }

            if( cachedMaterial == null )
            {
                cachedMaterial = new ShapeMaterial( fill );
                shapeMaterials.Add( cachedMaterial );
            }

            return cachedMaterial.material;
        }
Ejemplo n.º 4
0
        public ShapeMaterial( ShapeFill fill )
        {
            this.fill = fill.Copy();

            GenerateMaterial();
        }
Ejemplo n.º 5
0
 bool MatchesShapeFillRequirements( ShapeFill fill )
 {
     return this.fill.IsEquivalent( fill );
 }
Ejemplo n.º 6
0
 public Face( List<Vector3> vertices, List<int> triangles, ShapeFill fill )
 {
     this.vertices = vertices;
     this.triangles = triangles;
     this.fill = fill;
 }
Ejemplo n.º 7
0
 public bool IsEquivalent( ShapeFill fill )
 {
     return
         this.fillType == fill.fillType &&
         this.fillTypeAdvanced == fill.fillTypeAdvanced &&
         this.blendMode == fill.blendMode &&
         this.isLit == fill.isLit &&
         this.texture == fill.texture;
 }
Ejemplo n.º 8
0
        public ShapeFill Copy()
        {
            ShapeFill fill = new ShapeFill();

            fill.fillType = this.fillType;
            fill.fillTypeAdvanced = this.fillTypeAdvanced;
            fill.blendMode = this.blendMode;
            fill.isLit = this.isLit;
            fill.texture = this.texture;

            return fill;
        }