Skip to content

Commit

Permalink
feat: add material setters
Browse files Browse the repository at this point in the history
  • Loading branch information
claby2 committed Jan 20, 2025
1 parent 836f942 commit 13f082e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/graphics/material.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type t = {
ambient : Math.Vec3.t;
diffuse : Math.Vec3.t;
specular : Math.Vec3.t;
mutable ambient : Math.Vec3.t;
mutable diffuse : Math.Vec3.t;
mutable specular : Math.Vec3.t;
mutable shininess : float;
}

Expand All @@ -13,6 +13,9 @@ let ambient t = t.ambient
let diffuse t = t.diffuse
let specular t = t.specular
let shininess t = t.shininess
let set_ambient t ambient = t.ambient <- ambient
let set_diffuse t diffuse = t.diffuse <- diffuse
let set_specular t specular = t.specular <- specular
let set_shininess t shininess = t.shininess <- shininess

module C = Ecs.Component.Make (struct
Expand Down
3 changes: 3 additions & 0 deletions lib/graphics/material.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ val ambient : t -> Math.Vec3.t
val diffuse : t -> Math.Vec3.t
val specular : t -> Math.Vec3.t
val shininess : t -> float
val set_ambient : t -> Math.Vec3.t -> unit
val set_diffuse : t -> Math.Vec3.t -> unit
val set_specular : t -> Math.Vec3.t -> unit
val set_shininess : t -> float -> unit

module C : Ecs.Component.S with type t = t

0 comments on commit 13f082e

Please sign in to comment.