Example #1
0
 public DrawCircles(int capacity)
 {
     for (var i = 0; i < capacity; i++)
     {
         freePrimitives.AddFirst(new CirclePrimitive( ));
     }
 }
Example #2
0
 public DrawStrings(int capacity)
 {
     for (var i = 0; i < capacity; i++)
     {
         freePrimitives.AddFirst(new TextPrimitive( ));
     }
 }
Example #3
0
 public DrawQuads(int capacity)
 {
     for (var i = 0; i < capacity; i++)
     {
         freePrimitives.AddFirst(new QuadPrimitive( ));
     }
 }
Example #4
0
        public void Add(Vector3 center, Vector3 normal, float radius, Color color, float hideAt = 0)
        {
            var primitive = freePrimitives.First;

            if (primitive == null)
            {
                primitive = new CirclePrimitive( );
            }
            else
            {
                primitive.Remove( );
            }

            normal = normal.normalized;
            Vector3 forward = normal == Vector3.up ?
                              Vector3.ProjectOnPlane(Vector3.forward, normal).normalized : Vector3.ProjectOnPlane(Vector3.up, normal).normalized;
            Vector3 right = Vector3.Cross(normal, forward);

            primitive.Value.center  = center;
            primitive.Value.forward = forward;
            primitive.Value.right   = right;
            primitive.Value.radius  = radius;
            primitive.Value.color   = color;
            primitive.Value.hideAt  = hideAt;
            usedPrimitives.AddFirst(primitive);
        }
Example #5
0
 public void Add ( Vector3 point1, Vector3 point2, Vector3 point3, Color color, float hideAt = 0 )
 {
     var primitive = freePrimitives.First;
     if ( primitive == null )
         primitive = new TrianglePrimitive ( );
     else
         primitive.Remove ( );
     primitive.Value.point1 = point1;
     primitive.Value.point2 = point2;
     primitive.Value.point3 = point3;
     primitive.Value.color = color;
     primitive.Value.hideAt = hideAt;
     usedPrimitives.AddFirst ( primitive );
 }
Example #6
0
        public void Add(Vector3 point1, Vector3 point2, Color color, float hideAt = 0)
        {
            var primitive = freePrimitives.First;

            if (primitive == null)
            {
                primitive = new LinePrimitive( );
            }
            else
            {
                primitive.Remove( );
            }
            primitive.Value.point1 = point1;
            primitive.Value.point2 = point2;
            primitive.Value.color  = color;
            primitive.Value.hideAt = hideAt;
            usedPrimitives.AddFirst(primitive);
        }
Example #7
0
        public void Add(Vector3 position, string text, Color color, float hideAt = 0)
        {
            var primitive = freePrimitives.First;

            if (primitive == null)
            {
                primitive = new TextPrimitive( );
            }
            else
            {
                primitive.Remove( );
            }
            var textPrim = primitive.Value;

            textPrim.position = position;
            textPrim.text     = text;
            textPrim.color    = color;
            textPrim.hideAt   = hideAt;
            usedPrimitives.AddFirst(primitive);
        }
Example #8
0
 public DrawTriangles ( int capacity )
 {
     for ( var i = 0 ; i < capacity ; i++ )
         freePrimitives.AddFirst ( new TrianglePrimitive ( ) );
 }