Model.load(file_name: String) -> Model
Load .obj / .gltf / .glb / .iqm / .vox / .m3d. Check with Model.is_valid; pair with unload.
val model = Model.load("tests/assets/models/cube.obj")
Model loading, mesh generation, material setup, skeletal animation, billboards, bounding boxes.
Model loading, mesh generation, material setup, skeletal animation, billboards, bounding boxes. Every raylib rmodels.c binding (46 total).
Model.load(file_name: String) -> ModelLoad .obj / .gltf / .glb / .iqm / .vox / .m3d. Check with Model.is_valid; pair with unload.
val model = Model.load("tests/assets/models/cube.obj")
Model.from_mesh(mesh: Mesh) -> ModelWrap a procedurally generated Mesh in a Model. Useful as a fallback when Model.load fails.
val fallback = Model.from_mesh(Mesh.cube(Float32(2.0), Float32(2.0), Float32(2.0)))
Model.is_valid(model) -> Bool / Model.unload(model)Validity guard + release meshes + materials.
if Model.is_valid(model) { Model.unload(model) }
Model.bounding_box(model: Model) -> BoundingBoxAxis-aligned bounding box covering all meshes.
val bbox = Model.bounding_box(model)
Draw.bounding_box(bbox, GREEN)
Model.draw(model, position, scale, tint) / draw_ex(model, position, rotation_axis, rotation_angle, scale: Vector3, tint)Render filled model. _ex takes axis-angle rotation + per-axis scale.
Model.draw(model, origin, Float32(1.0), WHITE)
Model.draw_wires / draw_wires_exWireframe renders with matching _ex rotation/scale variants.
Model.draw_wires(model, origin, Float32(1.0), BLACK)
Mesh.upload(mesh, dynamic: Bool) -> Mesh / update_buffer(mesh, index, data: [UInt8], offset, size)Create GPU VBO/VAO; update buffer contents (dynamic meshes).
var m = Mesh.upload(mesh, false)
Mesh.unload(mesh) / export(mesh, file_name) -> Bool / export_as_code(mesh, file_name) -> BoolRelease + write mesh to .obj or embed as C source.
Mesh.export(cube, "cube.obj")
Mesh.bounding_box(mesh) -> BoundingBox / gen_tangents(mesh) -> MeshCompute AABB; generate tangent vectors (required for normal-mapped materials).
var m = Mesh.gen_tangents(mesh)
Mesh.draw(mesh, material, transform: Matrix)Draw a single mesh with explicit material + world transform. Low-level alternative to Model.draw.
Mesh.draw(cube_mesh, mat, Matrix.identity())
Mesh.draw_instanced(mesh, material, transforms: [Matrix], instances: Int32)Instanced draw — one mesh, many transforms per drawcall.
Mesh.draw_instanced(mesh, mat, transforms, Int32(transforms.length))
Mesh.cube(width, height, length: Float32) -> MeshProcedural box mesh.
val cube = Mesh.cube(Float32(2.0), Float32(2.0), Float32(2.0))
Mesh.poly(sides: Int32, radius: Float32) / plane(width, length, res_x, res_z) / sphere(radius, rings, slices) / hemi_sphere(...)Flat polygons, planes, full + half spheres.
val sphere = Mesh.sphere(Float32(1.0), Int32(16), Int32(32))
Mesh.cylinder(radius, height, slices) / cone(...) / torus(radius, size, rad_seg, sides) / knot(...)Tube, conic, torus, trefoil knot generators.
val torus = Mesh.torus(Float32(1.0), Float32(0.3), Int32(16), Int32(32))
Mesh.heightmap(heightmap: Image, size: Vector3) / cubicmap(cubicmap: Image, cube_size: Vector3)Height-field terrain from a grayscale image; Minecraft-style voxel map from a color image.
val terrain = Mesh.heightmap(heightmap_img, Vector3.of(16.0, 4.0, 16.0))
Material.load(file_name: String) -> [Material]Load materials from .mtl. Returns a list (.obj can reference multiple).
val mats = Material.load("scene.mtl")
Material.default() -> Material / is_valid(material) / unload(material)Default passthrough material + validity + release.
val mat = Material.default()
Material.set_texture(material, map_type: MaterialMapIndex, texture: Texture) -> MaterialAssign texture to a material channel (albedo, normal, roughness, ...).
var mat = Material.set_texture(mat, MaterialMapIndex.ALBEDO, tex)
Model.set_mesh_material(model, mesh_id, material_id: Int32) -> ModelAssociate a loaded material with one of the model's meshes.
var m = Model.set_mesh_material(model, Int32(0), Int32(0))
ModelAnimation.load(file_name: String) -> [ModelAnimation]Load skeletal animation clips from .iqm / .gltf / .m3d.
val anims = ModelAnimation.load("character.iqm")
Model.animation_valid(model, anim) -> BoolCheck that animation's bone structure is compatible with this model.
if Model.animation_valid(model, anims[0]) { }
Model.update_animation(model, anim, frame: Float32) / update_animation_ex(model, anim_a, frame_a, anim_b, frame_b, blend)Apply a single animation at a fractional frame or blend two animations directly using the raylib 6 extended update path.
Model.update_animation(model, anim, Float32(frame))
ModelAnimation.unload(anim) / unload_all(anims: [ModelAnimation])Release single anim or full list.
ModelAnimation.unload_all(anims)
Draw.billboard(camera, texture, position: Vector3, size: Float32, tint: Color)Screen-facing textured quad. Classic particle / tree-imposter primitive.
Draw.billboard(cam, tex, pos, Float32(2.0), WHITE)
Draw.billboard_rec(camera, texture, source: Rectangle, position, size, tint) / billboard_pro(...)Source-rect crop (_rec); explicit up/origin/rotation (_pro) for oriented-particle effects.
Draw.billboard_rec(cam, tex, src, pos, size, WHITE)
Draw.bounding_box(box: BoundingBox, color: Color)Wireframe box draw. Pair with Model.bounding_box / Mesh.bounding_box.
Draw.bounding_box(Model.bounding_box(model), GREEN)
Ray.hit_mesh / hit_box.