Skip to content

Commit

Permalink
Add voxel data interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrimpyCat committed Jul 9, 2020
1 parent 26965b1 commit f68b971
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/vox/data.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defprotocol Vox.Data do
@type no_impl :: nil

@type faces :: :left | :right | :bottom | :top | :front | :back
@type origin :: { faces, faces, faces }

@spec origin(t) :: origin
def origin(data)

@spec models(t) :: [Vox.Model.t]
def models(data)

@spec impl(t, :model) :: ((t, Vox.Model.id) -> Vox.Model.t | nil) | no_impl
@spec impl(t, :model_count) :: (t -> non_neg_integer) | no_impl
@spec impl(t, :voxel) :: ((t, Vox.Model.id, Vox.Model.axis, Vox.Model.axis, Vox.Model.axis) -> { :ok, Vox.Voxel.t | nil } | Vox.Model.error(Vox.Model.bounds_error | Vox.Model.unknown_error)) | no_impl
def impl(data, op)
end

0 comments on commit f68b971

Please sign in to comment.