xhookLua
Game

Mesh

A mesh from mesh.create. Draw it inside on_draw_3d.

Methods

m:draw

m:draw([transform]) -> boolean
NameTypeDescription
transformoptionalVector | Matrix3x4 | number[12] | tablenil = world space; 12 numbers like ent:bone_matrix(i); or {origin, angles, scale}.

Draws once; true when drawn.

m:draw_skinned

m:draw_skinned(bones) -> boolean
NameTypeDescription
bonestableArray of matrices (index 1 = bone 0, or start at [0]) or one flat table of 12 numbers per bone.

Draws with one 3x4 matrix per bone.

m:texture

m:texture(image)

Image from draw.load_image / load_image_bytes; nil removes it.

m:color

m:color(r, g, b [, a])

Tint, 0 to 255. Also takes draw.color() or a table.

m:blend

m:blend(mode)

"auto" (default), "opaque", "alpha", "additive".

Opaque writes depth, texture alpha under 50% is cut out. Blended does not write depth.

m:cull

m:cull(mode)

"none" (default), "back", "front". Front faces wind counter-clockwise.

m:fullbright

m:fullbright(on)

Ignore world light.

m:light_at

m:light_at(point)

Reads world light at this point; nil resets to the mesh middle.

Use it when the mesh's middle is inside a wall or floor and it draws black.

m:info

m:info() -> table

{vertices, triangles, bones, bytes, skinned}.

m:free

m:free()

Frees it now instead of at garbage collection.

Mesh ยท Lua API ยท xhook