| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Which also fixes potential bugs when comparing iterators from different
containers in case a detach happens.
Change-Id: I5e91f82177d46a0f06272035af837e8a8b196f81
Reviewed-by: Mike Krus <mike.krus@kdab.com>
|
|
|
|
|
| |
Change-Id: Ibc77241e8d369224eda790b8dcfd900f330bed37
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
|
|
|
|
|
|
|
| |
Use template free function instead.
Change-Id: I1171279423f164b877aaef21926ceda512fcbd2e
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
-renamed QDistanceFieldText to QText2DEntity
-renamed QDistanceFieldMaterial to QText2DMaterial
-removed fontScale property
-replace position property by width/height properties
-adjusted manual test accordingly
Task-number: QTBUG-58883
Change-Id: Ieb1aae2ef8f397e3a6a636ad651cf83a5565daa0
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
| |
-made QDistanceFieldGlyphCache and QTextureAtlas private
-remove dptr on QDistanceFieldGlyphCache
-use a static hash on glyphCaches based on current scene being used
-QTextureAtlas parented by scene root node
Task-number: QTBUG-58881
Change-Id: If51d7dfe75e4233b9e7a36473c71fe530247aef7
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A QDistanceFieldText has a text position (within the x/y-plane),
a color, a text (QString), a QFont, and a QDistanceGlyphCache
that is used to retrieve the glyph textures needed for rendering.
To render a given string, we use a QTextLayout to generate GlyphRuns,
which are associated with a given QRawFont. Now the following may
happen:
1. there may be multiple QRawFonts generated by the QTextLayout.
this is because some glyphs may not be available in one font,
so another font has to be used for these glyphs.
2. for the same QRawFont, multiple QTextureAtlasses may be needed
for all glyphs. This is because the the QDistanceFieldGlyphCache
grows lazily by allocating more QTextureAtlasses on demand.
So, for any given QDistanceFieldText, we might need to use multiple
textures for rendering. Because of this, we might need to create multiple
QEntities, each with a separate QDistanceFieldMaterial.
These QEntities are the DistanceFieldTextRenderers, which encapsulate
all QComponents needed to render the glyphs taken from one texture.
When something changes, QDistanceFieldText::update() uses a QTextLayout
to generate a number of QGlyphRuns, each associated with a QRawFont.
These QGlyphRuns are then given to
QDistanceFieldTextPrivate::setCurrentGlyphRuns(). There, for each distinct
texture, all glyph positions are gathered, and according vertex and index
buffers are built. These index buffers are then given to the
DistanceFieldTextRenderer nodes. We make sure to properly ref-count the
glyphs within the QDistanceFieldGlyphCache.
Change-Id: Icf332b87541a6426abd4fbb12e2968a6d8ec5c4c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One QDistanceFieldMaterial will have to be created for each distinct
texture atlas that is used to store the glyphs of fonts.
The smaller the glyphs are in pixel space (i.e. the more texels per
pixel), the smoother we render the threshold between inside-glyph
and outside-glyph. We measure the size of the glyph by taking
the per-fragment delta of the texture coordinates. This is to reduce
aiasing as much as possible without resorting to screen-space AA
techniques.
The same method is used in the QtQuick renderer, but here in this case
we allow a much smoother threshold for small glyphs.
Change-Id: I6632e7e1da31126c84f5bd2b4a4498377bdad79e
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For text rendering via textures (independent of the technique used)
we want to store font glyphs
1. in a texture atlas, in order to reduce the number of GL textures
by orders of magnitude
2. reference-counted: so that we can delete glyphs that are no
longer needed, i.e. that are no longer rendered by any text
instantiation
The QDistanceFieldGlyph cache is a node that has to be placed somewhere
in the scene, and is then referenced by QDistanceFieldText nodes so
it will be used for text rendering.
It associates with each QRawFont (but independent of the font size) a
DistanceFieldFont, which stores in one or more texture atlasses (one
atlas will hold ~50 entries, so it will be sufficient for most font
instantiations) the glyphs that are currently referenced.
These texture atlasses will be children of the QDistanceFieldGlyphCache.
The QDistanceFieldGlyphCache offers methods to ref and de-ref glyphs for
a given QRawFont, and will return a struct that contains the texture
the glyphs are stored in, and the associated texture coordinates
within that texture.
Change-Id: I3c9557ecad605e912f8ce3b92265b9fc39329f49
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
areallocator is copied from qtdeclarative/src/quick/scenegraph/util.
We could link to QtQuick to use this allocator from the private headers,
but this would introduce a hard dependency on QtQuick that Qt3DExtras
doesn't yet have.
Image data for texture atlasses are stored inside QTextureAtlasData
structures, which are shared between
1. the frontend QTextureAtlas node, and
2. the texture generators that are updated each time something is
added to the atlas
If we didn't share this data, we would have to copy the current QImage
that stores the current state of the texture atlas, each time that a
new sub-image is added. This would result in considerable memory copying
overhead.
By sharing the data, we can just add new sub-images to the shared data
structure, and update the texture generator. This may happen dozens of
times within one frame. When the backend texture loading job is executed,
it will copy all the new sub-images into the overall texture image, and
create the texture data from that image. This way, exactly zero image
copying overhead happens in the frontend thread.
Change-Id: I8c418bf335afd1363ad7cefdf81778e4075038e8
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|