Revert "rename ~bb argument(s) to ~rect"
This reverts commit 827c5eb0a6
.
This commit is contained in:
parent
3714ecb88d
commit
a691757921
16
src/n2/n2.ml
16
src/n2/n2.ml
|
@ -82,7 +82,7 @@ module Sprite_graph = struct
|
|||
|
||||
and node = {
|
||||
tf : mat2a;
|
||||
rect : aabb;
|
||||
bb : aabb;
|
||||
fill : color;
|
||||
(* mutable remove : bool; *)
|
||||
}
|
||||
|
@ -98,15 +98,15 @@ module Sprite_graph = struct
|
|||
t.list <- [];
|
||||
end
|
||||
|
||||
let add t ~tf ~rect ~fill =
|
||||
let node = { tf; rect; fill } in
|
||||
let add_rect t ~tf ~bb ~fill =
|
||||
let node = { tf; bb; fill } in
|
||||
push t node;
|
||||
node
|
||||
|
||||
let rec render_rec ren = function
|
||||
| [] -> ()
|
||||
| { tf; rect; fill } :: nodes ->
|
||||
S2.Renderer.draw_rect ren ~tf ~rect ~fill;
|
||||
| { tf; bb; fill } :: nodes ->
|
||||
S2.Renderer.draw_rect ren ~tf ~bb ~fill;
|
||||
render_rec ren nodes
|
||||
|
||||
let render t ~ren =
|
||||
|
@ -192,7 +192,7 @@ module Scene = struct
|
|||
let rect = aabb 0.0 0.0 0.0 0.0 in
|
||||
let fill = Color.white () in
|
||||
List.iter (parse_sprite_arg ~rect ~fill) args;
|
||||
Sprite_graph.add sg ~tf ~rect ~fill
|
||||
Sprite_graph.add_rect sg ~tf ~bb:rect ~fill
|
||||
| sexp ->
|
||||
Sexplib.Conv.of_sexp_error "invalid sprite" sexp
|
||||
|
||||
|
@ -229,7 +229,7 @@ module Scene = struct
|
|||
let obj = { obj with sprites = spr :: obj.sprites } in
|
||||
trace (fun m -> m "parse_obj_args: sprite %a %a"
|
||||
Color.pp spr.fill
|
||||
AABB.pp spr.rect);
|
||||
AABB.pp spr.bb);
|
||||
parse_obj_args t obj args ~tg ~sg
|
||||
| Sexp.List (Atom "object" :: _) ->
|
||||
trace (fun m -> m "parse_obj_args: begin object");
|
||||
|
@ -269,4 +269,6 @@ module Scene = struct
|
|||
let get t name =
|
||||
try Hashtbl.find t.objs name
|
||||
with Not_found -> Format.ksprintf failwith "no node %S in scene" name
|
||||
|
||||
let transform obj = obj.transform
|
||||
end
|
||||
|
|
|
@ -286,13 +286,13 @@ let clear _t (bg : color) =
|
|||
Gl.clear Gl.color_buffer_bit;
|
||||
end
|
||||
|
||||
let draw_rect t ~(tf : mat2a) ~(rect : aabb) ~(fill : color) =
|
||||
let draw_rect t ~(tf : mat2a) ~(bb : aabb) ~(fill : color) =
|
||||
let sh = t.polygon in
|
||||
begin
|
||||
(* TODO: cache/store uniform locations in some way *)
|
||||
use sh;
|
||||
set_mat2a (uniform sh "Transform") tf;
|
||||
set_aabb (uniform sh "BoundingBox") rect;
|
||||
set_aabb (uniform sh "BoundingBox") bb;
|
||||
set_int (uniform sh "Border") 0;
|
||||
set_color (uniform sh "Fill") fill;
|
||||
draw_geometry t.rect;
|
||||
|
|
Loading…
Reference in New Issue