Commit graph

5126 commits

Author SHA1 Message Date
Simon Hausmann
18a2b7748f Silence VS code warning
... when not targeting wasm.
2020-05-13 13:27:15 +02:00
Simon Hausmann
6f98e2ea56 Fix cargo warning
For now, always depend on console_error_panic_hook. It's useful :-)
2020-05-13 12:08:00 +02:00
Simon Hausmann
3d604b1a0c Ignore the dist directory 2020-05-13 12:07:38 +02:00
Simon Hausmann
e313f39490 Add simple rust wasm test
Needs an initial "npm install" and then "npm start" will build and launch it in the browser.
2020-05-13 11:24:51 +02:00
Simon Hausmann
6110e4952d Move item rendering related code into a separate module
.. and keep less code in the central lib.rs.
2020-05-13 10:55:13 +02:00
Simon Hausmann
3142883ca8 Render the contents of image elements
The source property is a path relative to the path of the executable.
That is still rather inconvenient. It would be more convenient to make
it relative to the source file, but the corresponding proc-macro span
source_file() accessor is not public/stable.

Perhaps there's a way of doing this also through the generated code and
std::file!().
2020-05-13 10:27:09 +02:00
Simon Hausmann
3aac8282a8 Allow passing string literals to string properties in Rust
In the Rust code generator, convert to a null terminated byte literal.
2020-05-13 10:01:19 +02:00
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
0b807190c7 GL Renderer cleanup
Get rid of the vertex array object that's not really used. We do bind the binding
manually right now anyway and this can be reintroduced later.
2020-05-12 19:22:01 +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
Olivier Goffart
7d1394e349 Add a viewer tool 2020-05-12 19:19:25 +02:00
Olivier Goffart
f88d856990 Put the diagnostic printing in the compiler lib
(with an option so we don't drag the codemap dependencies for the proc_macro case)
2020-05-12 17:42:25 +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
93bb21f082 Fix dead code warning when targeting wasm 2020-05-12 16:24:56 +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
Olivier Goffart
6e794bec18 Have a small Expression AST 2020-05-12 14:54:32 +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
Olivier Goffart
3936272384 Move the build_array_helper in the generator module 2020-05-12 09:47:54 +02:00
Olivier Goffart
89f6e3529c Revert one of the previous change
The goal was to ensure that the libraries are up-to-date
2020-05-12 08:29:53 +02:00
Olivier Goffart
8bcd4b1115 CI: build with all features 2020-05-12 08:23:51 +02:00
Olivier Goffart
dbada7977e Fix C++ build 2020-05-12 08:03:18 +02:00
Olivier Goffart
b9cd725f78 Allow to use proc_macro tokens
And report errors
2020-05-11 22:24:28 +02:00
Olivier Goffart
dc33cbbcda Dummy structure for the rust example 2020-05-11 20:39:16 +02:00
Olivier Goffart
f3deea066b Make the C++ output a feature 2020-05-11 20:21:12 +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
802c8d1add Reformat public header with Qt's clang-format 2020-05-11 15:20:17 +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
5b4966f652 Re-format public C++ header with clang-format 2020-05-11 14:53:25 +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
Simon Hausmann
fbc9505425 Don't require web-sys when not targeting wasm
Not that this caused any harm, but it's pointless.
2020-05-11 11:56:10 +02:00
Simon Hausmann
fb6267649b Fix the event loop usage to only redraw when requested
This avoids spinning the CPU.
2020-05-11 11:53:51 +02:00
Simon Hausmann
4556d24eb4 Prospective fix for more effective cargo caching on GH actions 2020-05-11 11:26:32 +02:00
Olivier Goffart
6cf327166e Parser: add support for parentheses in expressions 2020-05-11 11:19:57 +02:00
Simon Hausmann
d24437055d Prospective build fix for GH actions build
Make sure to call cargo from within the source tree
2020-05-11 11:02:43 +02:00
Simon Hausmann
5b313af9aa Use winit also when targeting wasm
This allows unifying the code paths more.
2020-05-11 10:56:33 +02:00
Simon Hausmann
9be4c88b13 Fix wasm build
Make sure that glow selects the web-sys feature when targeting wasm.
2020-05-11 10:56:33 +02:00