Commit graph

5155 commits

Author SHA1 Message Date
Simon Hausmann
e7fd69bad1 Rename internal types
Rename the backend specific RenderingPrimitive to LowLevelRenderingPrimitive,
in order to make room for a high-level RenderingPrimitive enum that's public.
2020-05-22 16:07:06 +02:00
Simon Hausmann
f2662f0884 Simplify image primitives graphics API
Don't require a dest rect for now. Rendering is always at (0, 0) but
with the transformation applied. And the size shall for now not be a
parameter.
2020-05-22 16:07:06 +02:00
Simon Hausmann
bbc4c508f9 Minor cleanup
Replace lyon's rect import, which is a re-export of euclid's Rect<f32>,
with our own. Only the Path is
lyon specific, for now.
2020-05-22 16:07:06 +02:00
Olivier Goffart
270c626c6c Make the Parser a trait
Because the rowan::GreenNode is read-only but i want to use the parser
to generate something that can be mutated
2020-05-22 15:31:27 +02:00
Olivier Goffart
0f977cbb25 Some documentation fixes for item generated with #[vtable] 2020-05-22 12:38:55 +02:00
Olivier Goffart
bf3a0878b5 Add documentation for the vtable crate 2020-05-22 11:17:45 +02:00
Simon Hausmann
33dd2d765d Minor cleanup in item transform calculation
We can use the new geometry() getter to simplify the transform update by origin.
2020-05-22 09:33:08 +02:00
Simon Hausmann
8b854c32c3 Add Text::font_family and font_pixel_size properties
We can fine-tune the API, this works for now to change :-)
2020-05-21 21:04:07 +02:00
Simon Hausmann
4d26fe6674 Implement support for selecting the font family and pixel size in the GL renderer
The public API in the properties is still missing.
2020-05-21 20:55:34 +02:00
Simon Hausmann
8e8943b8fe Clean up texture atlas allocation code
Let each atlas texture know its index, so that it can return the final
allocation result right away.
2020-05-21 18:54:46 +02:00
Simon Hausmann
86eaf027d4 Implement glyph runs grouped by texture
In order to support multiple font sizes, etc. we have to deal with the
fact that the glyphs for a string may not end up all in the same atlas
texture. Therefore splitting of glyph runs by texture is necessary.

This works but could be improved further by sharing the vertex arrays
and just re-binding to a different texture and drawing the run's
triangles by index.
2020-05-21 15:51:09 +02:00
Simon Hausmann
66c91ef658 Prepare for supporting multiple glyph runs
A glyphs primitive may end up requiring multiple draw commands in the future,
so prepare for that.
2020-05-21 15:51:09 +02:00
Olivier Goffart
c03c2e2e7e Attempt to do Plus / Minus 2020-05-21 13:24:45 +02:00
Olivier Goffart
54eb0f831b Fix the children allocation array
The offsets was not computed properly
2020-05-21 13:14:28 +02:00
Olivier Goffart
4575011293 More work on signal: the C++ part is working 2020-05-20 19:28:58 +02:00
Olivier Goffart
83d206ea39 runtime: Add a Signal class
Not very functional yet
2020-05-20 16:13:04 +02:00
Olivier Goffart
4f22e2c341 Add a bool property type 2020-05-20 13:36:47 +02:00
Olivier Goffart
0e85886301 Only allow to connect to existing signals 2020-05-20 13:36:47 +02:00
Simon Hausmann
de923131ee Remove dummy test code
It's not testing anything :-)
2020-05-20 13:27:07 +02:00
Simon Hausmann
994d47a529 Shader module cleanup
Move the specific shaders into the shaders module and then hide the Shader
type. It's not necessary to export it anymore.
2020-05-20 13:27:07 +02:00
Simon Hausmann
f7dfb030a0 Improve shader setup code
Determine the locations of the uniforms and attributes once instead of on every use.
This makes the code easier to read and faster.
2020-05-20 13:27:07 +02:00
Simon Hausmann
b7fd9658d3 More shader code cleanup
Move the uniform and attribute binding into the shader encapsulating types.
2020-05-20 13:27:07 +02:00
Simon Hausmann
036c1aae38 Begin shader code cleanup
Start by a bit of encapsulation of the specific shaders we use.
2020-05-20 13:27:07 +02:00
Olivier Goffart
efe0ccfb3f Add support for signal in the parser
(currently not doing anything else than parsing)
2020-05-20 12:53:08 +02:00
Olivier Goffart
300cd9653a Move the expression parse funciton in their own module 2020-05-20 12:30:30 +02:00
Olivier Goffart
94c58dc1c4 Add an mouse handler for the TouchArea 2020-05-20 12:03:36 +02:00
Simon Hausmann
5acb8e7bdd Minor glyph handling cleanup
When laying out glyphs, don't require a slice, just an iterator.
2020-05-20 11:02:48 +02:00
Simon Hausmann
9b9a29e03d Clean up glyph handling
Avoid calling glyph_for_char twice for each character.
Instead do the conversion once explicitly. That needs to be done anyway for shaping.
2020-05-20 10:50:49 +02:00
Simon Hausmann
e0cc9aef2a Cleanup text rendering code a bit
Move the text related code into a separate file.
2020-05-20 10:50:49 +02:00
Simon Hausmann
f29aa0a302 GL buffer handling cleanup
Move the buffer handling code into a separate file.
2020-05-20 10:50:49 +02:00
Simon Hausmann
4834de04f9 Shader code cleanup
Move the shader code into a separate file
2020-05-20 10:50:49 +02:00
Olivier Goffart
bf64e40476 Format 2020-05-20 09:34:14 +02:00
Olivier Goffart
6b3765857a Add a TouchArea builtin item (currently does nothing) 2020-05-20 09:32:01 +02:00
Simon Hausmann
f27a715b30 GL texture handling cleanup
Move the gl texture handling code into a separate file/module.
2020-05-20 08:52:20 +02:00
Simon Hausmann
527525f733 Another issue created for tracking 2020-05-19 22:16:08 +02:00
Simon Hausmann
d7b742d082 Created issue for comment 2020-05-19 22:14:27 +02:00
Simon Hausmann
3f813808f1 Small comment fix 2020-05-19 22:13:11 +02:00
Simon Hausmann
81b5f70718 Implement colored text rendering 2020-05-19 21:58:01 +02:00
Simon Hausmann
ddf137221a Implement glyph rendering using atlas texturing
This means duplicate glyphs are rendered only once and we store glyphs
in the atlas texture globally instead of a texture per text primitive.
2020-05-19 21:47:47 +02:00
Simon Hausmann
3c2ad7b275 Add support for atlas textures in the GL renderer
... and place images in there by default. This improves locality.

The atlasing is also needed for individual glyph rendering, which is
coming soon.
2020-05-19 20:38:28 +02:00
Simon Hausmann
cbd28bf745 Simplify image primitives API
Removed the source rectangle as that can also be done on the source image side,
if necessary.
2020-05-19 20:37:36 +02:00
Olivier Goffart
260f17a3e0 Support for inline components within a .60 file 2020-05-19 17:43:56 +02:00
Simon Hausmann
f9cafcdbea Disable the WASM build
... until I get around fixing it properly with regards to text support.
2020-05-19 16:35:19 +02:00
Olivier Goffart
ab28828351 Support for img!("foo.png") to make string absolute
This is a temporary solution until we get better ressource handling
2020-05-19 16:30:48 +02:00
Olivier Goffart
a4569ddca3 BangExpression allow for finding relative paths 2020-05-19 15:36:56 +02:00
Olivier Goffart
f4bfc3a5b4 Use the property system for our components 2020-05-19 15:15:23 +02:00
Olivier Goffart
8ec6fd5237 Change the representation of the Property to be more FFI friendly 2020-05-19 15:09:45 +02:00
Olivier Goffart
cdeb3a4312 Import of a basic property system 2020-05-19 12:47:52 +02:00
Simon Hausmann
23d3964a0d Add boilerplate for text items
Forward the text and color properties to the rendering backend, where
right now we just rendering all the glyphs into a dedicated texture.

Next steps are a glyph atlas texture, blending the specified color with
the alpha of the glyphs, configurable size and family, shaping with
Harfbuzz and may more things.
2020-05-18 19:04:12 +02:00
Olivier Goffart
b78f708786 Add SharedString::push_str 2020-05-18 18:45:33 +02:00