Current section
Files
Jump to
Current section
Files
src/fluo@mesh.erl
-module(fluo@mesh).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/fluo/mesh.gleam").
-export([load_obj/1, create_mesh/2]).
-export_type([vec2/0, vec3/0, vertex/0, mesh/0]).
-type vec2() :: {vec2, float(), float()}.
-type vec3() :: {vec3, float(), float(), float()}.
-type vertex() :: {vertex, vec3(), vec3(), vec2()}.
-opaque mesh() :: {mesh, integer(), integer(), gleam@dynamic:dynamic_()}.
-file("src/fluo/mesh.gleam", 24).
-spec load_obj(binary()) -> mesh().
load_obj(_path) ->
fluo_nif:load_mesh_from_obj(_path).
-file("src/fluo/mesh.gleam", 26).
-spec create_mesh(list(vertex()), list(integer())) -> mesh().
create_mesh(Vertices, Indices) ->
Handle = fluo_nif:create_mesh(Vertices, Indices),
{mesh, erlang:length(Vertices), erlang:length(Indices), Handle}.