dxDrawMaterialSectionLine3D
Client-side
Server-side
Shared
This function draws a textured 3D line between two points in the 3D world - rendered for one frame. This should be used in conjunction with onClientRender/onClientPreRender in order to display continuously.
Tip
- The 3D line with a large width value effectively becomes a rectangle, so it it possible to construct basic shapes such as boxes with several large width lines and the appropriate values for 'faceToward'.
- 3D lines are drawn at a particular place in the game processing order, so use onClientPreRender for drawing if you are attaching them to world elements.
Syntax
bool dxDrawMaterialSectionLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, float u, float v, float usize, float vsize, [ bool flipUV = false ], texture material, float width, [ int color = tocolor(255,255,255,255), string stage = "postfx", float faceTowardX = nil, float faceTowardY = nil, float faceTowardZ = nil ] )Required arguments
- startX: The start X position of the 3D line, representing a coordinate in the GTA world.
- startY: The start Y position of the 3D line, representing a coordinate in the GTA world.
- startZ: The start Z position of the 3D line, representing a coordinate in the GTA world.
- endX: The end X position of the 3D line, representing a coordinate in the GTA world.
- endY: The end Y position of the 3D line, representing a coordinate in the GTA world.
- endZ: The end Z position of the 3D line, representing a coordinate in the GTA world.
- u: The absolute X coordinate of the top left corner of the section.
- v: The absolute Y coordinate of the top left corner of the section.
- usize: The absolute width of the section.
- vsize: The absolute height of the section.
- material: A texture to draw the line with.
- width: The width/thickness of the line in GTA world units. (This is 1/75th of the width used in dxDrawLine3D).
Optional arguments
Note: when using optional arguments, you might need to supply all arguments before the one you wish to use.
- flipUV (default: false): A bool representing whether a UV orientation should be flipped.
- color (default: tocolor(255,255,255,255)): An integer of the hex color, produced using tocolor or 0xAARRGGBB.
- stage (default: "postfx"): A string representing a stage at which the actual drawcall should happen.
- prefx: Lines are rendered before the color correction. This stage makes lines look natural to SA but colors could be distorted.
- postfx: Lines are rendered after the color correction. This stage conveys a color from the function to a screen without distortions.
- postgui: Lines are rendered after GUI. The line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).
- faceTowardX (default: nil): The X position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.
- faceTowardY (default: nil): The Y position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.
- faceTowardZ (default: nil): The Z position the front of the line should face towards. If this is not set, the camera position is used, so the front of the line faces toward the camera.
Returns
Returns a true if the operation was successful, false otherwise.
- bool: result
Code Examples
client
This example draws corona like effects near the player.
local coronaTexture = dxCreateTexture("corona.png")local red = tocolor(255, 0, 0)local green = tocolor(0, 255, 0)local blue = tocolor(0, 0, 255)
addEventHandler("onClientPreRender", root, function() if (not coronaTexture) then return end
local x, y, z = getElementPosition(localPlayer)
dxSetBlendMode("add") -- Add blend mode looks best for corona effects drawCorona(x + 2, y + 2, z + 1, 1, red) drawCorona(x + 1, y + 3, z + 2, 1, green) drawCorona(x - 1, y + 2, z + 3, 1, blue) dxSetBlendMode("blend") -- Restore defaultend)
-- Draw the corona texturefunction drawCorona(x, y, z, size, color) dxDrawMaterialSectionLine3D(x, y, z + size, x, y, z - size, 0, 0, 1, 1, coronaTexture, size, color)endChangelog
See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTargetUpdated
- dxCreateScreenSource
- dxCreateShader
- dxCreateTextureUpdated
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3DNew
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatusUpdated
- dxGetTextSize
- dxGetTexturePixelsUpdated
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource