Skip to content

Commit

Permalink
Add Rect3D and Rect2D and change Color to RGBA (#30)
Browse files Browse the repository at this point in the history
* Add Rect2D and Rect3D

* Fix typo

* Use screen-space coordinates and sizes

* Fix Rect RenderMessage to what is possible

* Change color argument order to RGBA

* Change Color.a default to 255
  • Loading branch information
NicEastvillage authored Oct 22, 2024
1 parent 15d09b4 commit 89c82c6
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions rendering.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ enum TextVAlign: ubyte {
}

struct Color {
a:ubyte;
r:ubyte;
g:ubyte;
b:ubyte;
a:ubyte = 255;
}

table BallAnchor {
Expand Down Expand Up @@ -52,11 +52,9 @@ table PolyLine3D {

table String2D {
text:string (required);
/// 0 = Left
/// 1 = Right
/// Screen-space coordinates such that x=0 is left edge and x=1 is right edge of window.
x:float;
/// 0 = Top
/// 1 = Bottom
/// Screen-space coordinates such that y=0 is top edge and y=1 is bottom edge of window.
y:float;
scale:float;
foreground:Color (required);
Expand All @@ -75,11 +73,35 @@ table String3D {
v_align:TextVAlign;
}

table Rect2D {
/// Screen-space coordinates such that x=0 is left edge and x=1 is right edge of window.
x:float;
/// Screen-space coordinates such that y=0 is top edge and y=1 is bottom edge of window.
y:float;
/// Screen-space size such that width=0.1 is 10% of window width.
width:float;
/// Screen-space size such that height=0.1 is 10% of window height.
height:float;
color:Color (required);
centered:bool;
}

table Rect3D {
anchor:RenderAnchor (required);
/// Screen-space size such that width=0.1 is 10% of window width.
width:float;
/// Screen-space size such that height=0.1 is 10% of window height.
height:float;
color:Color (required);
}

union RenderType {
Line3D,
PolyLine3D,
String2D,
String3D,
Rect2D,
Rect3D,
}

table RenderMessage {
Expand Down

0 comments on commit 89c82c6

Please sign in to comment.