Interface PrimitiveManagerLineInterface

The PrimitiveManagerLineInterface is used to display 3D lines on top of the DMU.

The PrimitiveManagerLineInterface is accessed through the getLineManager function (the PrimitiveManagerInterface is accessed through getPrimitiveManager).

A 3D line is defined as a segment, thus with two 3D points. Rendered 3D lines are manipulated through their ids (and not a dedicated object), indeed each line is assigned a strictly positive integer id that will represent it. 0 is an invalid line id.

The color of the 3D line is handled by the PrimitiveManagerMaterialInterface, accessed through getMaterialManager. Materials are accessed by their ids, and modified by their ids. 3D primitives are rendered colored with their primitive material id, and not directly from a color.
WARNING : do not confuse the PrimitiveManagerMaterialInterface and the MaterialManagerInterface, these two interfaces are separated, do not use MaterialManagerInterface ids to draw lines !!!

line display

Creating a 3D line may be done with the following :

/** 
* Sample to explain how to create 3d lines on top of the rendering (PrimitiveManagerLineInterface).
*/
import { InfiniteEngineInterface, PrimitiveManagerMaterialInterface, PrimitiveManagerLineInterface, Vector4, Vector3 } from 'generated/documentation/appinfiniteapi';

// created previously
let lInfiniteEngine : InfiniteEngineInterface;
// created previously, the segment point position 1
let lLinePosition1 : Vector3;
// created previously, the segment point position 2
let lLinePosition2 : Vector3;

// the material for the line color
let lLineColorMaterial : number = -1;
// the primitive material manager
const lPrimitiveMaterialManager : PrimitiveManagerMaterialInterface = lInfiniteEngine.getPrimitiveManager().getMaterialManager();
// the line manager
const lLineManager : PrimitiveManagerLineInterface = lInfiniteEngine.getPrimitiveManager().getLineManager();
// line color is white opaque (1 as last parameter)
const lLineColor : Vector4 = new Vector4(1, 1, 1, 1);

// create material
lLineColorMaterial = lPrimitiveMaterialManager.createMaterial(lLineColor);

// and create the line
const lLineId : number = lLineManager.createLine(
// segment extents
lLinePosition1,
lLinePosition2,
lLineColorMaterial,
// line width
5
);

console.log('Line id is ' + lLineId);

You may create also boxes, points, etc with [PrimitiveManagerBoxInterface](PrimitiveManagerBoxInterface.html), [PrimitiveManagerPointInterface](PrimitiveManagerPointInterface.html), etc.
3D Primitives

See

Hierarchy

  • PrimitiveManagerLineInterface

Methods

  • Creates a new line given two points positions (extents of the segment), A and B, with a given width in pixels.

    The width in pixels and the color of the line are set by the user.
    The line is assigned a strictly positive id that will represent this line from now on. 0 is an invalid line id. Please note that this id will be reused if the line is removed and another created again.
    Before creating a line, materials to render this line must be created in the PrimitiveManagerMaterialInterface.

    Returns

    The id of the created line.

    Parameters

    • pPointA: Vector3
      in
      The 3D position of the A point of the line.
    • pPointB: Vector3
      in
      The 3D position of the B point of the line.
    • pLineMaterialId: number
      in
      The material that will be used to draw the line (primitive material id).
    • pLineWidth: number
      in
      The width of the line in pixels.

    Returns number

  • Gets the primitive material id used to render the given line.

    Returns 0 if a line with the given id does not exist.

    Returns

    The primitive material id used to render the line.

    Parameters

    • pLineId: number
      in
      The id of the line to query.

    Returns number

  • Gets the A point (origin) of the given line.

    If found, pPointAOut is updated. Returns true if the line is found and therefore pPointAOut is updated.

    Returns

    true if pPointAOut was updated.

    Parameters

    • pLineId: number
      in
      The id of the line to query.
    • pPointAOut: Vector3
      out
      The A point of the line.

    Returns boolean

  • Gets the B point (other end) of the given line.

    If found, pPointBOut is updated. Returns true if the line is found and therefore pPointBOut is updated.

    Returns

    true if pPointBOut was updated.

    Parameters

    • pLineId: number
      in
      The id of the line to query.
    • pPointBOut: Vector3
      out
      The B point of the line.

    Returns boolean

  • Gets the line width in pixels used to render the given line.

    Returns 0 if a line with the given id does not exist.

    Returns

    The line width in pixels used to render the line.

    Parameters

    • pLineId: number
      in
      The id of the line to query.

    Returns number

  • Gets the actual number of rendered lines.

    Returns

    The number of lines drawn.

    Returns number

  • Tells if the given line is visible.

    Returns false if the line does not exists or is setLineVisible with false has been called.

    Returns

    true if the line exists and is visible.

    Parameters

    • pLineId: number
      in
      The id of the line to query.

    Returns boolean

  • Removes the line with the given id.

    Returns

    true if the line exists and therefore is removed.

    Parameters

    • pLineId: number
      in
      The id of the line to remove.

    Returns boolean

  • Updates the shape of the given line, by changing the extents and the line width.

    Returns true if the line was updated.

    Returns

    true if the line was found and therefore the line rendering is updated.

    Parameters

    • pLineId: number
      in
      The id of the line to change.
    • pPointA: Vector3
      in
      The new 3D position of the A point (origin).
    • pPointB: Vector3
      in
      The new 3D position of the B point (other end).
    • pLineWidth: number
      in
      The new line width in pixels.

    Returns boolean

  • Updates the rendering of the given line, by changing the color of the line.

    Returns true if the line was updated.

    Returns

    true if the line was found, if the materials exist and therefore the line rendering is updated.

    Parameters

    • pLineId: number
      in
      The id of the line to change.
    • pLineMaterialId: number
      in
      The primitive material id to be used to draw the line.

    Returns boolean

  • Updates the rendering of the given line, by changing its visibility.

    Returns true if the line was updated.

    Returns

    true if the line exists.

    Parameters

    • pLineId: number
      in
      The id of the line to change.
    • pVisible: boolean
      in
      The new visibility state of the line.

    Returns boolean