Draw XXL documentation


Draw Screenspace.RayColorFade(...);

Draw a ray with color fade in screenspace.

The camera which defines the screenspace can be appointed in several ways. One option is: Every function has an overload that is identical except that it takes a Camera as first parameter. Another more convenient option is: If no Camera is supplied then Draw XXL automatically searches for one according to the global DefaultScreenspaceWindowForDrawing setting (which can point to a Gameview camera or a Sceneview camera). Moreover there is the option to apoint a camera once to the global defaultCameraForDrawing field, which also has the effect that no camera has to be supplied as parameter to the actual draw functions.

Green parameters are required. Yellow parameters are optional, but have to be supplied in order.


static void DrawScreenspace.RayColorFade(...);

Code snippet names: drawScreenRayColFade and drawScreenRayColFade_func.
Parameters:
Image Type Parameter Name Description
Vector2 start The start position of the ray. This is in the cameras viewport space and goes from (0,0), which is the bottom-left corner to (1,1), which is the top-right corner.
Vector2 direction The ray that gets drawn, mounted at the start position. See also the "interpretDirectionAsUnwarped" parameter.
Color startColor The color of the ray at the start position.
Color endColor The color of the ray at the end position.
float width_relToViewportHeight The width of the line measured in relative units to the viewport height. The default value of 0 means that that the line will have a width of one pixel.
string text An optional text to display along the line.
bool interpretDirectionAsUnwarped The direction vector parameter has been supplied as a Vector2, though the camera viewport is not always a square. This leaves the question open whether the direction vector should be treated as vector inside the potentially warped viewport space or in an unwarped space where the x units have the same size than the y units. In warped space the Vector (1,1) goes from the lower left corner to the upper right corner, which is not necessarily 45°. In unwarped space 1 unit always corresponds to the viewport height and the vector (1,1) rises with unwarped 45° independent from the viewport aspect ratio.
LineStyle style A style for the line. The default is called "solid", which is a straight line, but it can also be dotted, dashed, zigzag, sine, freehand, ... . The patterns of dotted/dashed lineStyles may get unnaturally scaled when using a camera with extreme values for the near clip plane (e.g. "<0.3" or "very big").
float stylePatternScaleFactor If the style parameter has been set to custom style (meaning not the default solid style) then this parameter scales the line pattern. That means e.g. how big the toothes of a zigzag pattern appears.
float animationSpeed If the style parameter has been set to custom style (meaning not the default solid style) then it can be animated and appears as if the pattern walks along the line. Note that seamlessly changing the animation speed to get an effect of an accelerating or decelerating animation is not possible inside a static draw function like the here documented one. You can still get this effect when using a line object instead, which can keep track of the acceleration.
float endPlatesSize_relToViewportHeight The line can optinally have end position markers which are called "end plates" here. The size of the end plates is measured in relative units to the viewport height. The global settings DrawBasics.disableEndPlates_atLineStart and DrawBasics.disableEndPlates_atLineEnd can be used to draw the plate only at one specific line end and leave the other end without plate.
float alphaFadeOutLength_0to1 With this parameter an effect can be created where the line does not end distincly at the line end position, but slowly fades out towards the line end position. The default value of 0 means that the effect is disabled.
float enlargeSmallTextToThisMinRelTextSize This only has effect if the "text" parameter is used. The normal behaviour of text is that it scales with the line lenght. Though depending on the situation the line may get very small, up until the text is not readable anymore. This parameter sets a limit for the minimum text size. The text carrying line may get shorter and shorter but the text can stay visible. The value is measured in relative units to the viewport height.
float durationInSec The duration in seconds how long the drawn thing stays visible. The default value of 0 means that it stays only during the current Update frame. Instead of using this parameter you can also overwrite him with a global setting so you don't always have to supply all other preceding function parameters till you reach this late parameter.


static void DrawScreenspace.RayColorFade(...);

Code snippet names: drawScreenRayColFade_cam and drawScreenRayColFade_cam_func.
Parameters:
Image Type Parameter Name Description
Camera targetCamera This parameter is the only difference to the other overload. It specifies the camera explicitly instead of relying on DefaultScreenspaceWindowForDrawing or defaultCameraForDrawing.
Vector2 start Same as previous overload. See there.
Vector2 direction Same as previous overload. See there.
Color startColor Same as previous overload. See there.
Color endColor Same as previous overload. See there.
float width_relToViewportHeight Same as previous overload. See there.
string text Same as previous overload. See there.
bool interpretDirectionAsUnwarped Same as previous overload. See there.
LineStyle style Same as previous overload. See there.
float stylePatternScaleFactor Same as previous overload. See there.
float animationSpeed Same as previous overload. See there.
float endPlatesSize_relToViewportHeight Same as previous overload. See there.
float alphaFadeOutLength_0to1 Same as previous overload. See there.
float enlargeSmallTextToThisMinRelTextSize Same as previous overload. See there.
float durationInSec Same as previous overload. See there.