Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | List of all members
Drawing Class Reference

http://forum.unity3d.com/threads/71979-Drawing-lines-in-the-editor More...

Static Public Member Functions

static void DrawBezierLine (Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments)
 
static void DrawGraph (Vector2[] points, float[] xGrads, Color axisColor, Color lineColor, float height, float width=0f)
 
static void DrawLine (Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
 

Detailed Description

http://forum.unity3d.com/threads/71979-Drawing-lines-in-the-editor

Rewritten to improve performance by Yossarian King / August 2013.

This version produces virtually identical results to the original (tested by drawing one over the other and observing errors of one pixel or less), but for large numbers of lines this version is more than four times faster than the original, and comes within about 70% of the raw performance of Graphics.DrawTexture.

Peak performance on my laptop is around 200,000 lines per second. The laptop is Windows 7 64-bit, Intel Core2 Duo CPU 2.53GHz, 4G RAM, NVIDIA GeForce GT 220M. Line width and anti-aliasing had negligible impact on performance.

For a graph of benchmark results in a standalone Windows build, see this image: https://app.box.com/s/hyuhi565dtolqdm97e00

For a Google spreadsheet with full benchmark results, see: https://docs.google.com/spreadsheet/ccc?key=0AvJlJlbRO26VdHhzeHNRMVF2UHZHMXFCTVFZN011V1E&usp=sharing

Member Function Documentation

static void Drawing.DrawBezierLine ( Vector2  start,
Vector2  startTangent,
Vector2  end,
Vector2  endTangent,
Color  color,
float  width,
bool  antiAlias,
int  segments 
)
inlinestatic
static void Drawing.DrawGraph ( Vector2[]  points,
float[]  xGrads,
Color  axisColor,
Color  lineColor,
float  height,
float  width = 0f 
)
inlinestatic
static void Drawing.DrawLine ( Vector2  pointA,
Vector2  pointB,
Color  color,
float  width,
bool  antiAlias 
)
inlinestatic

< Early out on tiny lines to avoid divide by zero.

< Use GL matrix and Graphics.DrawTexture rather than GUI.matrix and GUI.DrawTexture,


The documentation for this class was generated from the following file: