Browsing StarfallEx's section
โ† Back to ACE
Back to StarfallEx

SFEX.render.createMaterial

C๐Ÿท๏ธ Render

Part of StarfallEx namespace

๐Ÿ”— External
render.createMaterial(tx, cb, done)
View on GitHub|lua/starfall/libs_cl/render.lua:987
๐Ÿ“‹ Has LDoc๐Ÿ‘๏ธ 0 viewsUpdated 2 months ago

Description

Looks up a texture by file name and creates an UnlitGeneric material with it. Also supports image URLs or image data (These will create a rendertarget for the $basetexture): https://en.wikipedia.org/wiki/Data_URI_scheme Make sure to store the material to use it rather than calling this slow function repeatedly. NOTE: This no longer supports material names. Use texture names instead (Textures are .vtf, material are .vmt)

Parameters

NameTypeDescription
txstringTexture file path, or http URL, or image data: https://en.wikipedia.org/wiki/Data_URI_scheme
cb?functionAn optional callback called when loading is done. Passes nil if it fails or Passes the material, url, width, height, and layout function which can be called with x, y, w, h to reposition the image in the texture.
done?functionAn optional callback called when the image is done loading. Passes the material, url

Returns

TypeDescription
MaterialThe material. Use with render.setMaterial to draw with it.

Examples

No examples available.

Used In

No usages found in the codebase.