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