diff options
author | Sven Gothel <[email protected]> | 2014-02-24 13:32:34 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-24 13:32:34 +0100 |
commit | c3621221b9a563495b4f54fe60e18e8db8cc57fb (patch) | |
tree | 00aded20f3582e517372c12f58e19d3524582099 /src/jogl/classes/com/jogamp/graph/curve/tess | |
parent | f69df875d0b9f969a816d143ed589b25e50cd9e7 (diff) |
Bug 802: Graph TextRenderer Performance Part-1 (incomplete, rendering artifacts)
Strategy Change:
- Font.Glyph itself holds it's OutlineShape
with it's default scaling.
Triangulation is done only once per glyph!
- A CharSequence produces a Region
by translating and scaling each Glyphs's OutlineShape.
This removes the need for re-triangulate - see above.
See: TextRendererUtil
- The indices of re-added Triangles are
offset to the new vertices (FIXME, seems not be be accurate yet).
- OutlineShape's vertices and triangles are reused if 'clean'.
- Simplified code
- Reduced copies
API Changes:
- OutlineShape, Region, ...: See above
- Removed TextRenderer, GlyphShape and GlyphString: Redundant
- Added TextRendererUtil to produce the Region from CharSequence
Result:
- Over 600 fps while changing text for each frame.
Previously only ~60fps max.
TODO:
- Region shall not hold the triangles itself,
but the indices instead.
This will remove the need to swizzle w/ vertices in the Region Renderer impl
and easies reusage of OutlineShapes.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/tess')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java index 4e8c400e0..39e84171b 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java +++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java @@ -28,7 +28,7 @@ package com.jogamp.graph.curve.tess; -import java.util.ArrayList; +import java.util.List; import com.jogamp.graph.geom.Outline; import com.jogamp.graph.geom.Triangle; @@ -49,18 +49,19 @@ import com.jogamp.graph.geom.Triangle; */ public interface Triangulator { - /** Add a curve to the list of Outlines + /** + * Add a curve to the list of Outlines * describing the shape + * @param sink list where the generated triangles will be added * @param outline a bounding {@link Outline} */ - public void addCurve(Outline outline); + public void addCurve(List<Triangle> sink, Outline outline); /** Generate the triangulation of the provided * List of {@link Outline}s - * @return an arraylist of {@link Triangle}s resembling the - * final shape. + * @param sink list where the generated triangles will be added */ - public ArrayList<Triangle> generate(); + public void generate(List<Triangle> sink); /** Reset the triangulation to initial state * Clearing cached data |