dreamworkAPI
Ctrl K
GitHub
libraryDocs / gfx3d

gfx3d

libraryclientsource

The library with powerful set of functions that let you control how the world and its contents are rendered.

It can also be used to draw some 3D client-side effects such as beams, boxes and spheres.

Classes & types

Fields

NameTypeDescription
PixelShaders1booleantrue if the current settings and the system allow the usage of pixel shaders 1.4, false otherwise.
PixelShaders2booleantrue if the current settings and the system allow the usage of pixel shaders 2.0, false otherwise.
VertexShadersbooleantrue if the current settings and the system allow the usage of vertex shaders 1.1, false otherwise.
DirectXnumberThe supported DirectX level, 8 for DX8, 9 for DX9, 10 for DX10, 11 for DX11.
HDRbooleantrue if the current settings and the system allow the usage of HDR, false otherwise.

Functions

gfx3d.drawBeamDraws a straight beam.
gfx3d.drawBoxDraws a box, solid or wireframe.
gfx3d.drawComplexBeamDraws a beam made of multiple segments.
gfx3d.drawLineDraws a line between two points.
gfx3d.drawSphereDraws a sphere, solid or wireframe.
gfx3d.drawSpriteDraws a sprite in 3D space.
gfx3d.start
gfx3d.start2d

#gfx3d.drawBeam

clientsource
function gfx3d.drawBeam(start_position: Vector3, end_position: Vector3, width: number, texture_start: number, texture_end: number, color?: Color, alpha?: integer)

Draws a straight beam.

Parameters
NameTypeDescription
start_positionVector3The start of the beam.
end_positionVector3The end of the beam.
widthnumberThe width of the beam.
texture_startnumberThe texture coordinate at the start of the beam.
texture_endnumberThe texture coordinate at the end of the beam.
coloroptionalColorThe color of the beam, white by default.
alphaoptionalintegerThe alpha of the beam, 255 by default.

#gfx3d.drawBox

clientsource
function gfx3d.drawBox(origin: Vector3, angles: Angle3, mins: Vector3, maxs: Vector3, color?: Color, alpha?: integer, wireframe?: boolean, write_z?: boolean)

Draws a box, solid or wireframe.

Parameters
NameTypeDescription
originVector3The origin of the box.
anglesAngle3The orientation of the box.
minsVector3The local minimum bounds.
maxsVector3The local maximum bounds.
coloroptionalColorThe color of the box, white by default.
alphaoptionalintegerThe alpha of the box, 255 by default.
wireframeoptionalbooleanIf true, draws only the edges of the box.
write_zoptionalbooleanIf true, the wireframe writes to the depth buffer (wireframe only).

#gfx3d.drawComplexBeam

clientsource
function gfx3d.drawComplexBeam(segments: gfx3d.ComplexBeamSegment[], segment_count?: integer)

Draws a beam made of multiple segments.

Parameters
NameTypeDescription
segmentsgfx3d.ComplexBeamSegment[]The beam segments.
segment_countoptionalintegerThe number of segments to draw, defaults to the length of segments.

#gfx3d.drawLine

clientsource
function gfx3d.drawLine(start_position: Vector3, end_position: Vector3, color?: Color, alpha?: integer, write_z?: boolean)

Draws a line between two points.

Parameters
NameTypeDescription
start_positionVector3The start of the line.
end_positionVector3The end of the line.
coloroptionalColorThe color of the line, white by default.
alphaoptionalintegerThe alpha of the line, 255 by default.
write_zoptionalbooleanIf true, the line writes to the depth buffer.

#gfx3d.drawSphere

clientsource
function gfx3d.drawSphere(origin: Vector3, radius: number, longitude_steps: integer, latitude_steps: integer, color?: Color, alpha?: integer, wireframe?: boolean, write_z?: boolean)

Draws a sphere, solid or wireframe.

Parameters
NameTypeDescription
originVector3The center of the sphere.
radiusnumberThe radius of the sphere.
longitude_stepsintegerThe number of longitude steps.
latitude_stepsintegerThe number of latitude steps.
coloroptionalColorThe color of the sphere, white by default.
alphaoptionalintegerThe alpha of the sphere, 255 by default.
wireframeoptionalbooleanIf true, draws only the edges of the sphere.
write_zoptionalbooleanIf true, the wireframe writes to the depth buffer (wireframe only).

#gfx3d.drawSprite

clientsource
function gfx3d.drawSprite(origin: Vector3, width: number, height: number, color?: Color, alpha?: integer)

Draws a sprite in 3D space.

Parameters
NameTypeDescription
originVector3The position of the sprite.
widthnumberThe width of the sprite.
heightnumberThe height of the sprite.
coloroptionalColorThe color of the sprite, white by default.
alphaoptionalintegerThe alpha of the sprite, 255 by default.

#gfx3d.start

clientsource
function gfx3d.start(view: gfx3d.RenderView)
Parameters
NameTypeDescription
viewgfx3d.RenderView

#gfx3d.start2d

clientsource
function gfx3d.start2d(origin: Vector3, angles: Angle3, scale: number)
Parameters
NameTypeDescription
originVector3
anglesAngle3
scalenumber
Generated from the dreamwork meta branch.