Xors3d Engine
3D Lines

Functions

void xClearLine3D (x3DLine *line3d)
 Deletes all the 3d line's nodes.
x3DLine * xCreateLine3D (float fromX, float fromY, float fromZ, float toX, float toY, float toZ, int red=255, int green=255, int blue=255, int alpha=255, bool useZBuffer=true)
 Creates a 3d line and returns a handle.
void xDeleteLine3DNode (x3DLine *line3d, int index)
 Deletes a specified 3d line's node.
int xGetLine3DUseZBuffer (x3DLine *line3d)
 Returns true if Z-buffering is enabled. Returns false otherwise.
void xLine3DAddNode (x3DLine *line3d, float x, float y, float z, bool isGlobal=false)
 Adds a node to the end of the line.
int xLine3DAlpha (x3DLine *line3d)
 Returns an alpha value of a 3d line.
int xLine3DBlue (x3DLine *line3d)
 Returns a blue value of a 3d line's color.
void xLine3DColor (x3DLine *line3d, int red, int green, int blue, int alpha)
 Sets a new color and alpha of a 3d line.
int xLine3DGreen (x3DLine *line3d)
 Returns a green value of a 3d line's color.
void xLine3DNodePosition (x3DLine *line3d, int index, float x, float y, float z, bool isGlobal=false)
 Sets a new position of a node.
int xLine3DNodesCount (x3DLine *line3d)
 Returns the number of the nodes in a 3d line.
float xLine3DNodeX (x3DLine *line3d, int index, bool isGlobal=false)
 Returns the X coordinate of a 3d line's node.
float xLine3DNodeY (x3DLine *line3d, int index, bool isGlobal=false)
 Returns the Y coordinate of a 3d line's node.
float xLine3DNodeZ (x3DLine *line3d, int index, bool isGlobal=false)
 Returns the Z coordinate of a 3d line's node.
void xLine3DOrigin (x3DLine *line3d, float x, float y, float z, bool isGlobal=false)
 Sets a new origin of the 3d line.
float xLine3DOriginX (x3DLine *line3d, bool isGlobal=false)
 Returns the starting X coordinate of a 3d line.
float xLine3DOriginY (x3DLine *line3d, bool isGlobal=false)
 Returns the starting Y coordinate of a 3d line.
float xLine3DOriginZ (x3DLine *line3d, bool isGlobal=false)
 Returns the starting Z coordinate of a 3d line.
int xLine3DRed (x3DLine *line3d)
 Returns a red value of a 3d line's color.
void xLine3DUseZBuffer (x3DLine *line3d, bool state)
 Changes the use of Z-buffering.

Function Documentation

x3DLine* xCreateLine3D ( float  fromX,
float  fromY,
float  fromZ,
float  toX,
float  toY,
float  toZ,
int  red = 255,
int  green = 255,
int  blue = 255,
int  alpha = 255,
bool  useZBuffer = true 
)

Creates a 3d line and returns a handle.

3d line is an Entity. It can be parented.

Note:
At the beginning a 3d line has 1 node: the line lies between the origin and the node #0.
Parameters:
fromXStarting X coordinate
fromYStarting Y coordinate
fromZStarting Z coordinate
toXEnding X coordinate
toYEnding Y coordinate
toZEnding Z coordinate
redRed value of the color. Default value is 255.
greenGreen value of the color. Default value is 255.
blueBlue value of the color. Default value is 255.
alphaAlpha value. Default value is 255.
useZBufferTrue to use Z-buffering. Default value is True.
void xLine3DOrigin ( x3DLine *  line3d,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Sets a new origin of the 3d line.

Parameters:
line3d3D Line handle.
xX coordinate.
yY coordinate.
zZ coordinate.
isGlobalTrue if the position should be relative to 0, 0, 0. Default value is False.
void xLine3DAddNode ( x3DLine *  line3d,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Adds a node to the end of the line.

This allows to build a polygonal chain.

Parameters:
line3d3d line handle.
xX coordinate.
yY coordinate.
zZ coordinate.
isGlobalTrue if the position should be relative to 0, 0, 0. Default value is False.
void xLine3DColor ( x3DLine *  line3d,
int  red,
int  green,
int  blue,
int  alpha 
)

Sets a new color and alpha of a 3d line.

Parameters:
line3d3d line handle.
redRed value of the color.
greenGreen value of the color.
blueBlue value of the color.
alphaAlpha value.
void xLine3DUseZBuffer ( x3DLine *  line3d,
bool  state 
)

Changes the use of Z-buffering.

If the use of Z-buffering is disabled the 3d lines will be seen through the entities ignoring the depth.

Parameters:
line3d3d line handle.
stateTrue to enable Z-buffering. False to disable Z-buffering.
float xLine3DOriginX ( x3DLine *  line3d,
bool  isGlobal = false 
)

Returns the starting X coordinate of a 3d line.

Parameters:
line3d3d line handle.
isGlobalTrue for global coordinates, false for local ones. Default value is false.
float xLine3DOriginY ( x3DLine *  line3d,
bool  isGlobal = false 
)

Returns the starting Y coordinate of a 3d line.

Parameters:
line3d3d line handle.
isGlobalTrue for global coordinates, false for local ones. Default value is false.
float xLine3DOriginZ ( x3DLine *  line3d,
bool  isGlobal = false 
)

Returns the starting Z coordinate of a 3d line.

Parameters:
line3d3d line handle.
isGlobalTrue for global coordinates, false for local ones. Default value is false.
int xLine3DNodesCount ( x3DLine *  line3d)

Returns the number of the nodes in a 3d line.

At the beginning a 3d line has 1 node.

Parameters:
line3d3d line handle.
void xLine3DNodePosition ( x3DLine *  line3d,
int  index,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Sets a new position of a node.

Parameters:
line3d3d line handle.
indexIndex of a node. Should be in range [0; x3DLineNodesCount()-1]
xX coordinate.
yY coordinate.
zZ coordinate.
isGlobalTrue if the position should be relative to 0, 0, 0. Default value is False.
float xLine3DNodeX ( x3DLine *  line3d,
int  index,
bool  isGlobal = false 
)

Returns the X coordinate of a 3d line's node.

Parameters:
line3d3d line handle.
indexIndex of a node. Should be in range [0; x3DLineNodesCount()-1]
isGlobalTrue for global coordinates, false for local ones. Default value is false.
float xLine3DNodeY ( x3DLine *  line3d,
int  index,
bool  isGlobal = false 
)

Returns the Y coordinate of a 3d line's node.

Parameters:
line3d3d line handle.
indexIndex of a node. Should be in range [0; x3DLineNodesCount()-1]
isGlobalTrue for global coordinates, false for local ones. Default value is false.
float xLine3DNodeZ ( x3DLine *  line3d,
int  index,
bool  isGlobal = false 
)

Returns the Z coordinate of a 3d line's node.

Parameters:
line3d3d line handle.
indexIndex of a node. Should be in range [0; x3DLineNodesCount()-1]
isGlobalTrue for global coordinates, false for local ones. Default value is false.
int xLine3DRed ( x3DLine *  line3d)

Returns a red value of a 3d line's color.

Parameters:
line3d3d line handle.
int xLine3DGreen ( x3DLine *  line3d)

Returns a green value of a 3d line's color.

Parameters:
line3d3d line handle.
int xLine3DBlue ( x3DLine *  line3d)

Returns a blue value of a 3d line's color.

Parameters:
line3d3d line handle.
int xLine3DAlpha ( x3DLine *  line3d)

Returns an alpha value of a 3d line.

Parameters:
line3d3d line handle.
int xGetLine3DUseZBuffer ( x3DLine *  line3d)

Returns true if Z-buffering is enabled. Returns false otherwise.

If the use of Z-buffering is disabled the 3d lines will be seen through the entities ignoring the depth.

Parameters:
line3d3d line handle.
void xDeleteLine3DNode ( x3DLine *  line3d,
int  index 
)

Deletes a specified 3d line's node.

Parameters:
line3d3d line handle.
indexIndex of a node. Should be in range [0; x3DLineNodesCount()-1]
void xClearLine3D ( x3DLine *  line3d)

Deletes all the 3d line's nodes.

If you need to delete the line use xFreeEntity()

Parameters:
line3d3d line handle.