C# Class Nez.LineRenderer

Renders a trail behind a moving object Adapted from http://www.paradeofrain.com/2010/01/28/update-on-continuous-2d-trails-in-xna/
Inheritance: RenderableComponent
Show file Open project: prime31/Nez

Public Methods

Method Description
addPoint ( Vector2 point, float width = 20 ) : LineRenderer

adds a point to the line. If start/end widths are not set each point should have a width set here.

addPoint ( Vector2 point, float width, Microsoft.Xna.Framework.Color color ) : LineRenderer

adds a point to the line. If start/end widths are not set each point should have a width set here. If start/end colors are not set a color should be set as well.

addPoints ( Vector2 points ) : LineRenderer
calculateVertices ( ) : void
clearPoints ( ) : LineRenderer

clears all the points

clearStartEndColors ( ) : LineRenderer

clears the global start/end colors and goes back to using the individual point colors

clearStartEndWidths ( ) : LineRenderer

clears the global start/end widths and goes back to using the individual point widths

debugRender ( Graphics graphics ) : void
isVisibleFromCamera ( Camera camera ) : bool
onAddedToEntity ( ) : void
onEntityTransformChanged ( Transform comp ) : void
render ( Graphics graphics, Camera camera ) : void
setCutoffAngleForEndCapSubdivision ( float cutoffAngleForEndCapSubdivision ) : LineRenderer

sets the cutoff angle for use with EndCapType.JaggedWithCutoff. Any angles less than the cutoff angle will have jagged joints and all others will have standard.

setDegreesPerSubdivision ( float degreesPerSubdivision ) : LineRenderer

sets the number of degrees between each subdivision for use with EndCapType.Smooth

setEndCapType ( EndCapType endCapType ) : LineRenderer

sets the EndCapType used for rendering the line

setPoints ( Vector2 points ) : LineRenderer
setStartEndColors ( Microsoft.Xna.Framework.Color startColor, Microsoft.Xna.Framework.Color endColor ) : LineRenderer

sets the start and end color. If these are set, the individual point colors will be ignored.

setStartEndWidths ( float startWidth, float endWidth ) : LineRenderer

sets the start and end width. If these are set, the individual point widths will be ignored.

setTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : LineRenderer

sets the texture. Textures should be horizontally tileable. Pass in null to unset the texture.

setUseWorldSpace ( bool useWorldSpace ) : LineRenderer

sets whether local or world space will be used for rendering. Defaults to world space. Using local space will take into account all the Transform properties including scale/rotation/position.

updatePoint ( int index, Vector2 point ) : LineRenderer

updates a points properties

updatePoint ( int index, Vector2 point, float width ) : LineRenderer

updates a points properties

updatePoint ( int index, Vector2 point, float width, Microsoft.Xna.Framework.Color color ) : LineRenderer

updates a points properties

Private Methods

Method Description
addFirstSegment ( Segment &segment, Segment &nextSegment, int &vertIndex ) : void
addSegment ( Segment &segment, int &vertIndex ) : void
addSingleSegmentLine ( Segment &segment, Microsoft.Xna.Framework.Color nextPointColor ) : void
addVert ( int index, Vector2 position, Vector2 texCoord, Microsoft.Xna.Framework.Color col ) : void
patchJaggedJoint ( Segment &segment, int &vertIndex ) : void
patchJoint ( Segment &segment, int &vertIndex ) : void
patchSmoothJoint ( Segment &segment, int &vertIndex ) : void
patchStandardJoint ( Segment &segment, int &vertIndex ) : void

Method Details

addPoint() public method

adds a point to the line. If start/end widths are not set each point should have a width set here.
public addPoint ( Vector2 point, float width = 20 ) : LineRenderer
point Microsoft.Xna.Framework.Vector2 Point.
width float Width.
return LineRenderer

addPoint() public method

adds a point to the line. If start/end widths are not set each point should have a width set here. If start/end colors are not set a color should be set as well.
public addPoint ( Vector2 point, float width, Microsoft.Xna.Framework.Color color ) : LineRenderer
point Microsoft.Xna.Framework.Vector2 Point.
width float Width.
color Microsoft.Xna.Framework.Color Color.
return LineRenderer

addPoints() public method

public addPoints ( Vector2 points ) : LineRenderer
points Microsoft.Xna.Framework.Vector2
return LineRenderer

calculateVertices() public method

public calculateVertices ( ) : void
return void

clearPoints() public method

clears all the points
public clearPoints ( ) : LineRenderer
return LineRenderer

clearStartEndColors() public method

clears the global start/end colors and goes back to using the individual point colors
public clearStartEndColors ( ) : LineRenderer
return LineRenderer

clearStartEndWidths() public method

clears the global start/end widths and goes back to using the individual point widths
public clearStartEndWidths ( ) : LineRenderer
return LineRenderer

debugRender() public method

public debugRender ( Graphics graphics ) : void
graphics Graphics
return void

isVisibleFromCamera() public method

public isVisibleFromCamera ( Camera camera ) : bool
camera Camera
return bool

onAddedToEntity() public method

public onAddedToEntity ( ) : void
return void

onEntityTransformChanged() public method

public onEntityTransformChanged ( Transform comp ) : void
comp Transform
return void

render() public method

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
return void

setCutoffAngleForEndCapSubdivision() public method

sets the cutoff angle for use with EndCapType.JaggedWithCutoff. Any angles less than the cutoff angle will have jagged joints and all others will have standard.
public setCutoffAngleForEndCapSubdivision ( float cutoffAngleForEndCapSubdivision ) : LineRenderer
cutoffAngleForEndCapSubdivision float Cutoff angle for end cap subdivision.
return LineRenderer

setDegreesPerSubdivision() public method

sets the number of degrees between each subdivision for use with EndCapType.Smooth
public setDegreesPerSubdivision ( float degreesPerSubdivision ) : LineRenderer
degreesPerSubdivision float Degrees per subdivision.
return LineRenderer

setEndCapType() public method

sets the EndCapType used for rendering the line
public setEndCapType ( EndCapType endCapType ) : LineRenderer
endCapType EndCapType End cap type.
return LineRenderer

setPoints() public method

public setPoints ( Vector2 points ) : LineRenderer
points Microsoft.Xna.Framework.Vector2
return LineRenderer

setStartEndColors() public method

sets the start and end color. If these are set, the individual point colors will be ignored.
public setStartEndColors ( Microsoft.Xna.Framework.Color startColor, Microsoft.Xna.Framework.Color endColor ) : LineRenderer
startColor Microsoft.Xna.Framework.Color Start color.
endColor Microsoft.Xna.Framework.Color End color.
return LineRenderer

setStartEndWidths() public method

sets the start and end width. If these are set, the individual point widths will be ignored.
public setStartEndWidths ( float startWidth, float endWidth ) : LineRenderer
startWidth float Start width.
endWidth float End width.
return LineRenderer

setTexture() public method

sets the texture. Textures should be horizontally tileable. Pass in null to unset the texture.
public setTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : LineRenderer
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
return LineRenderer

setUseWorldSpace() public method

sets whether local or world space will be used for rendering. Defaults to world space. Using local space will take into account all the Transform properties including scale/rotation/position.
public setUseWorldSpace ( bool useWorldSpace ) : LineRenderer
useWorldSpace bool If set to true use world space.
return LineRenderer

updatePoint() public method

updates a points properties
public updatePoint ( int index, Vector2 point ) : LineRenderer
index int Index.
point Microsoft.Xna.Framework.Vector2 Point.
return LineRenderer

updatePoint() public method

updates a points properties
public updatePoint ( int index, Vector2 point, float width ) : LineRenderer
index int Index.
point Microsoft.Xna.Framework.Vector2 Point.
width float Width.
return LineRenderer

updatePoint() public method

updates a points properties
public updatePoint ( int index, Vector2 point, float width, Microsoft.Xna.Framework.Color color ) : LineRenderer
index int Index.
point Microsoft.Xna.Framework.Vector2 Point.
width float Width.
color Microsoft.Xna.Framework.Color Color.
return LineRenderer