Part of StarfallEx namespace
๐ External
render.createMaterial(tx, cb, done)๐ 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
| Name | Type | Description |
|---|---|---|
tx | string | Texture file path, or http URL, or image data: https://en.wikipedia.org/wiki/Data_URI_scheme |
cb? | function | An 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? | function | An optional callback called when the image is done loading. Passes the material, url |
Returns
| Type | Description |
|---|---|
Material | The material. Use with render.setMaterial to draw with it. |
Examples
No examples available.
Used In
No usages found in the codebase.