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
Afficher le fichier Open project: prime31/Nez

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat LineRenderer

addPoint() public méthode

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.
Résultat LineRenderer

addPoints() public méthode

public addPoints ( Vector2 points ) : LineRenderer
points Microsoft.Xna.Framework.Vector2
Résultat LineRenderer

calculateVertices() public méthode

public calculateVertices ( ) : void
Résultat void

clearPoints() public méthode

clears all the points
public clearPoints ( ) : LineRenderer
Résultat LineRenderer

clearStartEndColors() public méthode

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

clearStartEndWidths() public méthode

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

debugRender() public méthode

public debugRender ( Graphics graphics ) : void
graphics Graphics
Résultat void

isVisibleFromCamera() public méthode

public isVisibleFromCamera ( Camera camera ) : bool
camera Camera
Résultat bool

onAddedToEntity() public méthode

public onAddedToEntity ( ) : void
Résultat void

onEntityTransformChanged() public méthode

public onEntityTransformChanged ( Transform comp ) : void
comp Transform
Résultat void

render() public méthode

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
Résultat void

setCutoffAngleForEndCapSubdivision() public méthode

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.
Résultat LineRenderer

setDegreesPerSubdivision() public méthode

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

setEndCapType() public méthode

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

setPoints() public méthode

public setPoints ( Vector2 points ) : LineRenderer
points Microsoft.Xna.Framework.Vector2
Résultat LineRenderer

setStartEndColors() public méthode

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.
Résultat LineRenderer

setStartEndWidths() public méthode

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.
Résultat LineRenderer

setTexture() public méthode

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.
Résultat LineRenderer

setUseWorldSpace() public méthode

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.
Résultat LineRenderer

updatePoint() public méthode

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

updatePoint() public méthode

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.
Résultat LineRenderer

updatePoint() public méthode

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.
Résultat LineRenderer