- Documentation
- Client functions
- dxDrawMaterialLine3D
Function
dxDrawMaterialLine3D
Draws a material (an image, a texture, a browser, a camera or a shader) as a strip in the 3D world: from the start point (top of the image) to the end, with a given width. The strip faces the camera or the faceX, faceY, faceZ point. The drawing is part of the world: buildings hide it and it glows (a screen is visible at night). This is how you make a billboard, a cinema screen or a sign above a building.
Syntax
bool dxDrawMaterialLine3D(float startX, startY, startZ, float endX, endY, endZ, string|element material, float width [, bool flipUV = false, int color = tocolor(255, 255, 255), bool postGUI = false, float faceX, faceY, faceZ])Arguments
startX, startY, startZfloat- Start (top of the image).
endX, endY, endZfloat- End (bottom of the image).
flipUVbool, optional = false- Flips the image (optional argument before the material).
materialstring|element- The material.
widthfloat- Strip width in metres.
colorint, optional = tocolor(255, 255, 255)- Tint.
postGUIbool, optional = false- Accepted for compatibility.Different default in MTA:SA: bool/string stage = "postfx"
faceX, faceY, faceZfloat, optional- The point the front faces.
Differences from MTA:SA
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
dxDrawMaterialLine3D(float startX, float startY, float startZ, float endX, float endY, float endZ, bool flipUV = false, texture material, float width, int color = tocolor(255,255,255,255), bool/string stage = "postfx", float faceTowardX = nil, float faceTowardY = nil, float faceTowardZ = nil)Returns
true if drawn.
Example
An 8x4 m vertical billboard facing south.
addEventHandler("onClientRender", root, function()
dxDrawMaterialLine3D(2500, -1660, 24, 2500, -1660, 20, "img/reklama.png", 8, tocolor(255, 255, 255), false, 2500, -1700, 22)
end)
Notes
A screen in the world. The material can be a browser or a camera, and getBrowserPositionFromScreen lets you click on such a screen.
See also
dxDrawMaterialSectionLine3DLikedxDrawMaterialLine3D, but draws only a section of the material (u, v, section width and height in pixels).dxDrawMaterialPrimitive3DDraws a triangle shape in the 3D world covered with a material. Vertices are{x, y, z, color, u, v}, where u and v (0-1) tell which image point lands on the vertex. The colour of the whole shape comes from the first vertex.createBrowserCreates a browser: an HTML page rendered into a texture. Draw it withdxDrawImageand load the address only in theonClientBrowserCreatedevent.