raylib/models
src/raylib/models.tur
defn
load-model
(load-model [path :cstr] :int)
load a 3D model from a file (OBJ, GLTF, IQM, ...).
Parameters
| path | filesystem path to the model file |
Returns
Opaque :int handle to a heap-allocated Model struct.
Example
(let [m (load-model "robot.obj")] ...)
Since: P3
defn
unload-model
(unload-model [model :int] :void)
free a model from GPU and CPU memory.
Parameters
| model | Model handle from load-model |
Example
(unload-model m)
Since: P3
defn
draw-model
(draw-model [model :int px :float py :float pz :float scale :float tint :int] :void)
draw a model at a position with uniform scale and tint.
Parameters
| model | Model handle | |
| px py pz -- world-space position | ||
| scale | uniform scale factor | |
| tint | Color handle |
Example
(draw-model robot 0.0 0.0 0.0 1.0 (white))
Since: P3
defn
draw-model-ex
(draw-model-ex [model :int px :float py :float pz :float ax :float ay :float az :float angle :float sx :float sy :float sz :float tint :int] :void)
draw a model with per-axis rotation and non-uniform scale.
Parameters
| model | Model handle | |
| px py pz -- world-space position | ||
| ax ay az -- rotation axis (unit vector) | ||
| angle | rotation angle in degrees | |
| sx sy sz -- scale per axis | ||
| tint | Color handle |
Example
(draw-model-ex robot 0.0 0.0 0.0 0.0 1.0 0.0 45.0 1.0 1.0 1.0 (white))
Since: P3
defn
load-mesh
(load-mesh [w :float h :float d :float] :int)
generate a box mesh with the given dimensions.
Parameters
| w | width (X axis) | |
| h | height (Y axis) | |
| d | depth (Z axis) |
Returns
Opaque :int handle to a heap-allocated Mesh struct. Upload to GPU with UploadMesh before use with draw-mesh.
Example
(let [mesh (load-mesh 1.0 1.0 1.0)] ...)
Since: P3
defn
draw-mesh
(draw-mesh [mesh :int material :int transform :int] :void)
draw a mesh with the given material and transform matrix.
Parameters
| mesh | Mesh handle from load-mesh or model internals | |
| material | Material handle (use load-default-material for a plain white material) | |
| transform | Matrix handle (use identity-transform for no transformation) |
Example
(draw-mesh mesh mat xform)
Since: P3