Commit graph

253 commits

Author SHA1 Message Date
Simon Hausmann
e144e885e1 Generalize the offset state in the rendering loop
Using a transform allows for additional properties such as scale and rotation
later.
2020-05-13 08:17:30 +02:00
Simon Hausmann
6ba90975b8 Further cleanup of the internal run_event_loop
Let the callback take a frame and that's it. Then the caller can take
care of presenting it, etc.
2020-05-12 22:16:04 +02:00
Simon Hausmann
5117452e94 Remove TODO comment fixed by previous commit 2020-05-12 22:12:11 +02:00
Simon Hausmann
c26a2a1562 Fix GL context state handling
Make our GL context not current when done with the initialization
and make it current for the duration fo primitive creation and frame
rendering.

Fixes #4
2020-05-12 21:42:34 +02:00
Simon Hausmann
ea03e08306 Clean up rectangle creation
Use a simple shared convenience method in the GraphicsBackend trait
2020-05-12 19:22:01 +02:00
Simon Hausmann
5986d5f2b8 More visitor cleanups
Provide a non-mutable visitor as well, as the actual rendering loop doesn't need
to change the items fortunately.
2020-05-12 16:33:50 +02:00
Simon Hausmann
f22b18584e Remove the cells in CachedRenderingData
Since we have a mutable accessor to this structure, we can skip the cells and make the code easier to read.
2020-05-12 16:26:58 +02:00
Simon Hausmann
93de9cf90c Change visit_items to take a mutable ref
This is safer, Olivier says :-)
2020-05-12 16:17:39 +02:00
Simon Hausmann
573a2bb0a9 Minor cleanup
Rename dirty_bit to cache_ok -- that makes the code slightly more readable.
2020-05-12 16:05:26 +02:00
Simon Hausmann
c5bcba2c3c Added basic rendering of cache primitives to the Items 2020-05-12 16:00:41 +02:00
Simon Hausmann
1791469390 Allow the item visitor to mutate items 2020-05-12 15:45:14 +02:00
Simon Hausmann
85e2ac36ef Prepare for caching rendering info for Items
Replace the RenderTree with a RenderingCache that is just the free-list vector
of rendering primitives.
2020-05-12 15:44:08 +02:00
Olivier Goffart
638c445cf9 Support for rendering sub-elements with proper offset 2020-05-12 15:38:50 +02:00
Simon Hausmann
743ad34099 Renaming RenderNode to CachedRenderingData
The name node suggests some kind of connected (tree) data structure, which
isn't quite what it is. It really is meant just
to be a way of storing cached rendering data for this item.
2020-05-12 13:55:57 +02:00
Olivier Goffart
7c2f40da90 Generator for the rust API 2020-05-12 11:43:29 +02:00
Simon Hausmann
7efcbd5816 Simplify geometry handing
Replace the use of kurbo's primitives with lyon/euclid. This means less data copying,
conversion and also no annoying precision
casts.
2020-05-11 19:23:03 +02:00
Olivier Goffart
471dd0f778 Make run_component safe 2020-05-11 15:35:17 +02:00
Olivier Goffart
88e904d228 Draft of the layouting runtime code 2020-05-11 15:33:38 +02:00
Simon Hausmann
c966f6e546 Add primitive rectangle rendering
This is still uncached, but gets something onto the screen.
2020-05-11 15:33:14 +02:00
Simon Hausmann
83eb00b080 Run the C++ generated component through the GL backend
... which in turn forward to the corelib, but with the GL renderer attached.
2020-05-11 15:05:33 +02:00
Simon Hausmann
63d3f5125e Move the main loop implementation into the core library 2020-05-11 14:30:41 +02:00
Simon Hausmann
3a954e4cea Move window system creation and other GL related code into the GL backend 2020-05-11 13:11:55 +02:00
Olivier Goffart
bd039be10c Introduce the datastructure to allow models and repeater 2020-05-11 10:10:25 +02:00
Olivier Goffart
cc170d1d76 More comments 2020-05-11 09:00:21 +02:00
Simon Hausmann
8843f655eb Reduce the binary size
Only use the png loader from image
2020-05-07 21:02:46 +02:00
Simon Hausmann
12626472c4 Fix wasm build
Get rid of the glutin dependency in the GL renderer -- the caller is now responsible for swapping buffers.
2020-05-07 15:07:29 +02:00
Simon Hausmann
e0b024d2cf Some work towards implementing the gl renderer
... in plain GL(ow). swapbuffers and clearing the color buffer is working.
2020-05-07 15:07:29 +02:00
Olivier Goffart
0398a221d2 Add a visitor to visit the items of a component 2020-05-07 12:11:01 +02:00
Olivier Goffart
e01de2e0ff Add a item visitor 2020-05-07 11:44:17 +02:00
Olivier Goffart
2f16517291 Put the CompoentType inside the class in the generated code
and start working on safe wrapper
2020-05-07 10:36:23 +02:00
Olivier Goffart
bdaf14ae23 Parse numbers 2020-05-07 09:06:58 +02:00
Olivier Goffart
a0d9369336 Add a crate to compute the field offsets as const fn 2020-05-06 20:58:10 +02:00
Olivier Goffart
b128a848e2 Parse quoted string 2020-05-06 18:24:30 +02:00
Olivier Goffart
05624c68ee Add some properties in the Rectangle 2020-05-06 17:53:42 +02:00
Olivier Goffart
3a541ec1eb Handle children elements 2020-05-06 16:43:04 +02:00
Olivier Goffart
b2b57887e2 add sixtyfps-cpp draft 2020-05-06 12:52:31 +02:00
Olivier Goffart
74b3c9147e Fix build 2020-05-06 11:56:08 +02:00
Olivier Goffart
9ad39d835e move the abi in its own module 2020-05-06 10:27:09 +02:00
Olivier Goffart
35fde11515 Use cbindgen to generate the internal abi 2020-05-06 10:11:32 +02:00
Simon Hausmann
17d3d49a83 Use cgmath throughout
And remove usage of kurbo::Affine. That avoids extra translations.
2020-05-05 23:00:03 +02:00
Olivier Goffart
acccb33c8c Lower and generate some C++ 2020-05-05 18:31:00 +02:00
Simon Hausmann
bfac827ec7 Start with image rendering
These are the basics. Still to do are fixing the alpha channel blending, the rect handling,
a texture type to avoid consuming  the image over and over again. And more :-)
2020-05-05 18:20:21 +02:00
Simon Hausmann
61dc3d9dc9 Sketching out some more data structure bits
Co-authored-by: Olivier Goffart <olivier@sixtyfps.io>
2020-05-05 16:12:35 +02:00
Olivier Goffart
86011528f1 Draft of data structures 2020-05-05 14:06:52 +02:00
Simon Hausmann
f3a4f75e17 Allow specifying a clear color for the frame
... and default it to white.
2020-05-05 13:51:48 +02:00
Simon Hausmann
5d07a6bd5b Support specifying the color for path filling 2020-05-05 13:24:41 +02:00
Simon Hausmann
7a129d66d3 Split graphics::RenderNode into RenderNodeMut and RenderNode
This allows a read-only tree traversal and thus rendering.
2020-05-05 11:38:29 +02:00
Simon Hausmann
fc5f93fab2 First implementation of a tree of rendering nodes
The idea is that they can be recursively rendered and propagate at least
the transform but also clip in the future.

One thing that's left is to split RenderNode into RenderNode and
RenderNodeMut, so that the rendering itself can be done on a non-mutable
tree reference.
2020-05-05 11:25:03 +02:00
Olivier Goffart
a83413aabc Do not put the frame on the heap.
But this forced to make GLFrame public.
2020-05-04 18:40:09 +02:00
Simon Hausmann
4edf2291d6 Simplfy new_frame trait signature
The life time specifier wasn't needed, it seems.
2020-05-04 15:29:04 +02:00