gophergfx
    Preparing search index...

    Class Line2

    The base class for 2D lines. This class extends Node2 so it can be added directly to the GopherGfx 2D scene graph. The class can draw line segments, line strips, and line loops. The vertices are interpreted differently depending upon the LineMode2 that is set. WebGL only supports lines that are exactly 1 pixel thick. To draw a more substantial "line", you need to draw the line using triangles.

    Hierarchy (View Summary)

    Index
    _localBoundingBox: BoundingBox2

    Bounding box in this transform's local coordinate space

    _localBoundingCircle: BoundingCircle

    Bounding circle in this transform's local coordinate space

    _position: Vector2

    Vector2 representing the position

    _rotation: number

    Rotation of the transform in radians

    _scale: Vector2

    Vector2 representing the scale

    _shear: Vector2 | null
    _worldBoundingBox: BoundingBox2

    Bounding box in the world coordinate space

    _worldBoundingCircle: BoundingCircle

    Bounding box in the world coordinate space

    boundingBox: BoundingBox2

    Bounding box in vertex coordinate space

    boundingCircle: BoundingCircle

    Bounding circle in vertex coordinate space

    children: Node2[]

    Array of children for this transform

    color: Color
    colorBuffer: WebGLBuffer | null
    gl: WebGL2RenderingContext
    hasVertexColors: boolean

    Flag that determines whether to use vertex colors.

    layer: number

    Integer representing the layer of this transform

    lineMode: number
    localBoundsDirty: boolean
    localMatrixDirty: boolean
    localMatrixUpdated: boolean
    localToParentMatrix: Matrix3

    Matrix3 representing the transformation matrix in local space

    localToWorldMatrix: Matrix3

    Matrix3 representing the transformation matrix in world space

    parent: Node2 | null

    Parent transform for this transform

    positionBuffer: WebGLBuffer | null
    vertexCount: number
    visible: boolean

    Boolean indicating whether this transform should be rendered

    worldBoundsDirty: boolean
    worldMatrixDirty: boolean
    • get rotation(): number

      Returns number

    • set rotation(value: number): void

      Parameters

      • value: number

      Returns void

    • Adds a child Node2 to the current Node2

      Parameters

      • child: Node2

        The child Node2 to add

      Returns void

    • Creates a default set of colors for the Line object, with each vertex having a color of white (r,g,b,a = 1,1,1,1)

      Returns void

    • Gets the vertex colors of the Line object

      Returns number[]

      An array of numbers representing the vertex colors

    • Gets the vertex positions of the Line object

      Returns number[]

      An array of numbers representing the vertex positions

    • Returns the appropriate OpenGL line mode for the current LineMode2 value

      Returns number

      The OpenGL line mode corresponding to the LineMode2 value

    • Checks if this Node2 intersects another Node2, using either a BoundingCircle or AxisAlignedBoundingBox

      Parameters

      • other: Node2

        The Node2 to check for intersection with

      • mode: IntersectionMode2 = IntersectionMode2.BOUNDING_CIRCLE

        The IntersectionMode2 to use for the comparison (default: BOUNDING_CIRCLE)

      • space: CoordinateSpace2 = CoordinateSpace2.LOCAL_SPACE

        The CoordinateSpace2 to use for the comparison (default: LOCAL_SPACE)

      Returns boolean

      A boolean indicating whether the two objects intersect

    • Looks at a target vector with the given look vector

      Parameters

      • target: Vector2

        The vector to look at

      • lookVector: Vector2 = Vector2.UP

        The vector used to determine the look direction (defaults to Vector2.UP)

      • coordinateSpace: CoordinateSpace2 = CoordinateSpace2.LOCAL_SPACE

      Returns void

    • Removes the current Node2 from its parent

      Returns boolean

      True if the Node2 was successfully removed, false otherwise

    • Removes the specified child Node2 from the current Node2

      Parameters

      • child: Node2

        The child Node2 to remove

      Returns Node2 | null

      The removed Node2, or null if it was not found

    • Sets the colors of the Line object

      Parameters

      • colors: number[] | Color[]

        An array of Color objects or numbers representing the vertex colors

      • usage: 35044 = ...

        OpenGL flag specifying the expected usage of the buffer (defaults to STATIC_DRAW)

      Returns void

    • Sets the vertices of the Line object

      Parameters

      • vertices: number[] | Vector2[]

        An array of Vector2 objects or numbers representing the vertex positions

      • usage: 35044 = ...

        OpenGL flag specifying the expected usage of the buffer (defaults to STATIC_DRAW)

      Returns void

    • Traverses the scene graph starting from the current Node2 object

      Parameters

      • parentMatrixDirty: boolean = false

      Returns void