Commit graph

685 commits

Author SHA1 Message Date
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
Olivier Goffart
ed842b3ae6 String: add comparison and simple test 2020-05-18 18:03:47 +02:00
Olivier Goffart
25bf149e13 Add a shared string that can be used in properties 2020-05-18 17:09:40 +02:00
Simon Hausmann
e6be2c91b8 Fix translation of children of images
Propagate the x/y of images also to the children.
2020-05-18 16:01:53 +02:00
Simon Hausmann
a7d5bd9f59 Minor rendering cleanup
Remove the x/y parameters from the rectangle primitive. They're always zero
since we always render with a transformation
matrix.
2020-05-18 16:01:53 +02:00
Olivier Goffart
f4714f2f5b Add missing file 2020-05-18 16:00:18 +02:00
Olivier Goffart
68cea2aeec Fix soundness hole in FieldOffset
This was cause by the change to allow to create FieldOffset in const constext
because a Fn(T)->U  is not allowed in a const constext.
But we need to be contravariant in T.
2020-05-18 11:06:44 +02:00
Olivier Goffart
07942da4bb vtable: introduce VOffset 2020-05-18 11:06:44 +02:00
Olivier Goffart
1addcad615 vtable: Fix the repr 2020-05-18 11:06:44 +02:00
Olivier Goffart
5a9cbaae66 vtable add support for field offset in the vtable 2020-05-18 11:06:44 +02:00
Olivier Goffart
751a3fbe59 Work on const field offset crate to give type safe offsets 2020-05-18 11:06:44 +02:00
Olivier Goffart
aff3d7e14b vtable: add safe way to construct references 2020-05-18 11:06:44 +02:00
Olivier Goffart
810a3905a7 Add VBox::new 2020-05-18 11:06:44 +02:00
Olivier Goffart
b745c616f7 Add a trait to get the vtable for a type 2020-05-18 11:06:44 +02:00
Olivier Goffart
4ca45ca4da vtable crate: Some refactoring and simplifications 2020-05-18 11:06:44 +02:00
Olivier Goffart
903fc513de vtable: make sure one cannot call the function with the wrong type 2020-05-18 11:06:44 +02:00
Olivier Goffart
0a973f65d5 vtable: Some more safety fix 2020-05-18 11:06:44 +02:00
Olivier Goffart
f74cfe73cd Use the vtable crate for the ItemVTable 2020-05-18 11:06:44 +02:00
Olivier Goffart
49fc23224e vtable: Remove the TraitType wrapper, and allow Option<fn> 2020-05-18 11:06:44 +02:00
Olivier Goffart
8d9a64d249 vtable: add a macro to create a static vtable 2020-05-18 11:06:44 +02:00
Olivier Goffart
62010be72e vtable: support associated consts 2020-05-18 11:06:44 +02:00