aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph
Commit message (Collapse)AuthorAgeFilesLines
* Bug 1501: Apply intersection tests for non-convex shapes to reject new CCW ↵Sven Göthel2024-02-133-26/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and non-circulcircle triangulation candidates in our Delaunay tessellator <https://jogamp.org/bugzilla//show_bug.cgi?id=1501#c6> The used Delaunay tessellation works well with (almost) convex shapes. In case e.g. a glyph gets to the extremes like 'M' in FreeMono or any other complex Chinese symbol - it may just simply happen that the new non-circumcircle triangle point crosses the inner (hope) or outer boundaries of the given polygon. Applying further constraint at Loop.cut() resolves most cases by rejecting the proposed CCW and non-circumcircle triangle candidate if its new two line-segments intersects with the original polygon. This results in mostly proper rendered Chinese fonts and also FreeMono is now readable - overal remaining bugs in Glyphs is low. +++ Of course, this intersection test is costly around >= O(log(n)*n) costs, practically adding a measured ~65% processing time. E.g. for FontView01 using FreeSerif.ttf - orig total took 1430.817638ms, per-glyph 0.2236ms, glyphs 6399 - fix total took 2377.337359ms, per-glyph 0.371517ms, glyphs 6399 Pure Glyph/Shape instantiation shows > 2x costs: 750 ms 100% convex (fake) 1875 ms 0% convex (fake) 1870 ms 13% convex 824/6399 +++ Hence it is desired to either (1) Manually mark a polygon non-convex to add described intersection test for accuracy. Also may be used to just drop the additional costs despite the lack of correctness. PROVIDED (2) Determine non-convex nature of a polygon with a and overall less expensive algorithm. If considerably cheaper, this could reduce O(log(n) * n) -> O(n) or even O(log n). Added convex/non-convex classification while ignoring off-curve points, but only ~13% of FreeSerif is pure convex, hence there is no benefit with this classification type. It might be desired to attempt other classes, i.e. being rendered in non-convex mode w/o intersection tests. See - GENERALIZED DELAUNAY TRIANGULATIONS OF NON-CONVEX DOMAINS https://deepblue.lib.umich.edu/bitstream/handle/2027.42/28782/0000614.pdf;sequence=1 - https://en.wikipedia.org/wiki/List_of_self-intersecting_polygons - https://en.wikipedia.org/wiki/Complex_polygon
* VectorUtil: Consolidate names, remove unused float prevision variants (if any)Sven Göthel2024-02-132-40/+7
|
* Bug 1501: Graph RenderState add debug-bits, i.e. DEBUG_LINESTRIP used in ↵Sven Göthel2024-02-131-0/+15
| | | | VBORegionSPES2 to just render lines instead of the filled area -> Used in UIShapeDemo02a
* Graph RenderState/RegionRenderer: Rename isHintMaskSet()->hintBitsSet(), ↵Sven Göthel2024-02-132-24/+24
| | | | setHintMask()->setHintBits(), clearHintMask()->clearHintBits()
* Bug 1501: Graph Delaunay: Use default winding outer-boundary:=CCW and ↵Sven Göthel2024-02-122-9/+10
| | | | | | | | | | | inner-hole:=CW w/o using winding determination (might be incorrect) This simplifies our code further and it has been validated that our polygon shoelace-algo for area >= 0 ? CCW doesn't produce correct results with all curves. Hence rely on given winding depending on outer-boundary and inner-hole if CDTriangulator2D.FixedWindingRule == true (default and fixed). This also removes the more costly winding shoelace calculus, hence Outline ctor only sets dirtyWinding:=true w/o calculating the winding.
* Graph: Outline[Shape]: Add print()Sven Göthel2024-02-112-0/+26
|
* Graph Font: Pull up static functionSven Göthel2024-02-041-16/+16
|
* Use new com.jogamp.common.util.StringUtil (GlueGen)Sven Göthel2024-02-041-11/+0
|
* Graph/GraphUI: Move getDefault*() to FontFactory and add ↵Sven Göthel2024-02-032-0/+47
| | | | {get,set}FallbackFont() + Font.getBestCoverage(..); Use fallback-font in MediaButton in case chosen font doesn't match (foreign languages, e.g. 'zho' Chinese .. )
* OutlineShape: Earmark coloring task when triangulating ..Sven Göthel2024-02-021-0/+10
|
* Remove Clonable and clone() in favor of explicit determined copy() and ↵Sven Göthel2024-02-024-22/+22
| | | | copy-ctor in com.jogamp.graph.* and com.jogamp.math.*
* Bug 805: Graph/GraphUI TextureSequence Scale: Move ↵Sven Göthel2024-02-011-31/+4
| | | | | | | | | Region.COLORTEXTURE_LETTERBOX_RENDERING_BIT to TextureSequence and add enabling/disabling of aratio adjustment + letter-box back-color TextureSequence color-texture params fetched from Graph VBORegion* and fed into shader. This allows more flexibility in aspect-ratio adjustment as well as setting a clipping background color for the added letter-box space.
* Bug 1488: Complete/Fix producing the 64-bit shaderKey: Use long values in ↵Sven Göthel2024-01-251-36/+28
| | | | | | | | | | bit-shift expressions and simplify it commit 1dcfdf71c09c6d774ac47012c05e09da4a085d7b - still used the 'hash code' bit shift pattern, not necessary -> simplified - the value as not ensured to be long, hence conversion occured This caused Graph's MSAA not being picked up properly using the shaderKey.
* Graph: Drop non-existing 'JAVA' font from FontFactorySven Göthel2024-01-251-7/+1
|
* Bug 1488 - Graph RegionRenderer: Use a more deterministic 64-bit shaderKey: ↵Sven Göthel2024-01-221-31/+62
| | | | | | | | | | | | | | | | | | | | | | | [0-31] bit values and state, [32-63] colorTexSeqHash This leaves only room for a key collision on the 32-bit colorTexSeqHash value and hence should be save within our shader-code environment. + // # | s | + // 0 | 1 | isTwoPass + // 1 | 1 | pass1 + // 2 | 5 | ShaderModeSelector1 + // 7 | 1 | hasFrustumClipping + // 8 | 1 | hasColorChannel + // 9 | 1 | hasColorTexture + // 32 | 32 | colorTexSeqHash + long hash = ( isTwoPass ? 1 : 0 ); + hash = ( hash << 1 ) | ( pass1 ? 1 : 0 ) ; + hash = ( hash << 1 ) | sms.ordinal(); // incl. pass2Quality + sampleCount + hash = ( hash << 5 ) | ( hasFrustumClipping ? 1 : 0 ); + hash = ( hash << 1 ) | ( hasColorChannel ? 1 : 0 ); + hash = ( hash << 1 ) | ( hasColorTexture ? 1 : 0 ); + hash = ( hash << 1 ) | ( ( colorTexSeqHash & 0xFFFFFFL ) << 32 );
* Bug 1488 - Graph RegionRenderer: Ensure shaderPrograms1 path is disabled ↵Sven Göthel2024-01-221-6/+8
| | | | | | using 'static final boolean useShaderPrograms0 = true' For now, let's leave the dead shaderPrograms1 code path inside the class for further consideration.
* Bug 1488 - Graph RegionRenderer Shader Mapping: Revert to IntObjectHashMap ↵Sven Göthel2024-01-221-64/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and throw exception on shaderKey collision Commit 6363ae5fb6975a6f2e7c1093ce81f25b699e3e61 changed RegionRenderer.useShaderProgram()'s shader mapping using a new ShaderKey instance. Such ShaderKey instance is created every time @ RegionRenderer.useShaderProgram() to retrieve the ShaderProgram from the HashMap<ShaderKey, Shader Program>. While this is most correct, creating the ShaderKey instance causes a lot of temp objects. ShaderKey also uses the optional colorTexSeq shader code for equality test in case of hash-collisions. Previous code simply ignored hash-collisions and used a 1:1 hashCode -> ShaderProgram mapping using our IntObjectHashMap. However, there was no test whether collision occur. +++ Solution would be either 1- Revert fully to the previous code just using an IntObjectHashMap, but throwing a RuntimeException in case of hashCode collisions. In case of a collisions, we would need to produce a better hashCode. This is possible, as the underlying data is fully internal .. etc. 2- Use the IntObjectHashMap as long there is no hashCode collision, then revert back to HashMap<ShaderKey, Shader Program>. +++ This patch implements variant (1), so far no exception has been thrown on multiple demos w/ and w/o diff color-textures.
* Graph Clipping: Use Frustum Clipping using AABBox -> Mv transformed Cube -> ↵Sven Göthel2024-01-202-27/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | Frustum mapping + GraphUI Support AABBox clipping naturally couldn't be transformed into 3D Model-View (Mv) Space, as it is axis aligned and only provided 2 points (min/max). Therefor we map the Group's AABBox to a 8-point Cube, perform the Mv-transformation and then produce the 6-plane Frustum. As before, we cull fully outside shapes within the Group's draw method and perform fragment clipping with same Frustum planes in the shader. With clipping enabled, the 3D z-axis getBounds() depth will be slightly increased for functional Frustum operation. This is also done for setFixedSize(Vec2f). The Frustum planes are copied to the Graph shader via float[4*6] -> uniform vec4 gcu_ClipFrustum[6]; // L, R, B, T, N, F each {n.x, n.y, n.z, d} +++ Concludes related work of below commits - 1040bed4ecc6f4598ea459f1073a9240583fc3c3 - 5cca51e32999a882e2a5f00cb45ecafc824ffd86
* Frustum: Revise code and its Plane definition to support Cube->Frustum as ↵Sven Göthel2024-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | well as to extract planes for float[] vec4-shader uniforms. commit 1040bed4ecc6f4598ea459f1073a9240583fc3c3 added AABBox -> Cube -> Frustum mapping (incomplete) and requires Frustum.Plane.set(..) by normal and point-on-plane for distance. Frustum.isOutside(Cube) has been added, testing all its 8-points similar to AABBox. Further all 6 Frustum.Plane shall be extracted to Vec4f and float[], the latter to pass the whole float[4*6] as a vec4[6] uniform array to the shader. +++ Constructor, setter and getter have been adjusted accordingly. Most of the loops have been unrolled. +++ Method names to query Frustum, i.e. 'is*Outside(<Type>)' have been reduced to 'isOutside(<Type>)' where <Type> uniquely indenticates the purpose. Hence only 'isSphereOutside()' is left over.
* Graph/GraphUI AA-Quality + SampleCount (shader): Push params down to ↵Sven Göthel2024-01-165-52/+89
| | | | | | | | | | | | | | | | | | RegionRenderer's RenderState usually rarely set from top of user API, reducing complexity. Discussion: Alternative was to pass AA-Quality same as SampleCount from the top (e.g. GraphUI Scene), however, this convolutes the API even more. Both parameter modify the resulting shader code in pass2 rendering (only). The used 'renderMode' is still maintained within the Region, since it contains more dynamic states individual to each Region instance (color-texture, ..). This despite 'renderMode' also changes the RenderState's shader program. In the end, it really doesn't matter and is a choice of frequency - the pipeline is usually rendering from on OpenGL rendering thread sequentially. AA-Quality and SampleCount simply usually don't change that often and are set only once.
* Graph/GraphUI AA-Quality (shader): Region: Add DEFAULT_AA_QUALITY and ↵Sven Göthel2024-01-153-20/+34
| | | | | | | | | | | | | | | | | | | | | | | | clipping funs for aaQuality/sampleCount; TextRegionUtil: Pass quality parameter in draw-functions Region.DEFAULT_AA_QUALITY defaults to MAX_AA_QUALITY still - TODO: AA shader is subject to change .. Region.draw(..) clips the quality param (save) TextRegionUtil: Pass quality parameter in draw-functions - Allowing to select the AA shader GraphUI Scene and some demos add the AA-quality param to the status line or screenshot-filename. - See Region.getRenderModeString(..) +++ TestTextRendererNEWT20 and TestTextRendererNEWT21 now iterate through all fonts, AA-quality shader and sample-sizes. Most demos and some more tests take AA-quality into acount, demos via CommandlineOptions.graphAAQuality
* Bump (c) -2024 for edited files + LICENSE.txtSven Göthel2024-01-145-7/+7
|
* Graph/GraphUI: Revise Graph Region ShaderMapping, fix AABBox-Clipping for ↵Sven Göthel2024-01-145-93/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass2-AA, revise Pass2 AA Quality parameter .. Misc: - Graph VBORegion2PVBAAES2: Drop unused FBO rescale - Move MIN/MAX QUALITY/SAMPLE from GraphUI Scene -> Graph Region +++ Quality -> Pass2 AA Quality - Drop quality field in region - Pass quality to GLRegion.draw(..) similar to sampleCount for dynamic shader and switch - TODO: Pass quality parameter in TextRegionUtil's functions Fix RegionRenderer Shader Mapping - Use ShaderKey class to properly implement the hash value and equals method - For this, TextureSequence.getTextureFragmentShaderHashID() has been added to provide actual shader-snippet for the equals function - All required criterias are included in the hash value and equals method Fix AABBox Clipping for Pass-2 AA - Clipping in pass2-AA must happen in pass2 on actual gcu_PMVMatrix01 (not ortho) +++ GraphUI GraphShape - Rename: [get,set]{->AA}Quality() GraphUI Scene - Rename: mark{All->}ShapesDirty(), set{AllShapes->}Sharpness(), set{AllShapes->AA}Quality() - Fix setSampleCount(..), i.e. markStatesDirty() not markShapesDirty() - Fix setAAQuality(), markShapesDirty() and markStatesDirty(): Use forAll(..) to traverse through all shapes and groups. GraphUI Group - Add setFixedSize() - Add setClipOnBox() - Document setRelayoutOnDirtyShapes(), isShapeDirty()
* Graph Clipping: Add missing Modelview-Matrix (Mv) Multiplication / ConsiderationSven Göthel2024-01-092-0/+5
| | | | | | - GLSL vertex shader sets smooth varying 'gcv_ClipBBoxCoord' w/ Mv multiplied vertex-coord - RegionRenderer.setClipBBox(AABBox) expects a pre-multiplied Mv AABBox covering an independent area, not per Shape/Region. - This works as expected with moving/scaling of each Shape/Region etc
* Graph Clipping: Initial Region impl of AABBox clipping using GLSL shader ↵Sven Göthel2024-01-093-11/+37
| | | | | | | | | | | | (Convenient using Graph/GraphUI produced AABBox) Simple demo, setting clip-bbox manually: - src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java TODO: - GLSL: Add missing Mv-multiplication of vertex-position -> gcv_ClipBBoxCoord -- AABBox min/max should be set pre-multiplied w/ Mv covering an independent area, not per Shape/Region. -- This to properly work with moving/scaling of each Shape/Region etc
* Graph Region: Edit API doc for AA_RENDERING_MASKSven Gothel2023-12-181-1/+1
|
* Bug 1465 - Graph / GraphUI: Render a Region's ColorTexture in proper ↵Sven Gothel2023-09-302-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aspect-ratio, letter-boxed or zoomed (config) + Bug 1466 Fix color mixing Bug 1465: Region currently simply bloats a given texture to its region AABBox, which renders textures with the wrong aspect ratio. Add facility to program the texture-coordinates to either letter-box or scaled-up (and cut) true aspect-ratio. Default shall be zoom (scale-up and cut), but user shall be able to set a flag in the Region for letter-box. Have the shader clip texture coordinates properly, best w/o branching to soothe performance. See functions.glsl +++ Bug 1466: Current color mix: texture * color_channel * color_static is useless in GraphUI. color_static shall modulate the texture, which works. But in case of color_channel (attribute/varying) we want it to be mixed so it can become the more dominant color for e.g. a border. Desired is: color = vec4( mix( tex.rgb * gcu_ColorStatic.rgb, gcv_Color.rgb, gcv_Color.a ), mix( tex.a * gcu_ColorStatic.a, 1, gcv_Color.a) );
* Graph Font: API doc: Fix typos 'Return ' .. to 'Returns `.Sven Gothel2023-09-241-17/+20
|
* Bug 1462 - Graph Font: Add name + codepoint to ID and Glyph mapping plus ↵Sven Gothel2023-09-243-24/+78
| | | | | | | | | traversing through all Glyphs See UISceneDemo03 new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("pause")+" ", buttonWidth, buttonHeight); // pause Unicode codepoint symbol is also contained in FontGlyph
* Graph Fonts: Add 'Material Icons Round-Regular' (APL-2 license) and use it ↵Sven Gothel2023-09-241-0/+6
| | | | in UISceneDemo03 via hard coded unicode symbol numbers
* Bug 1452 - Decouple math functionality to 'com.jogamp.math' to be toolkit ↵Sven Gothel2023-09-2018-2302/+62
| | | | | | | | | | | | | | | | | | | | agnostic (PMVMatrix, Matrix4f, Vec4f, ..) Math functionality (PMVMatrix, Matrix4f, Vec4f, ..) - shall be used toolkit agnostic, e.g. independent from OpenGL - shall be reused within our upcoming Vulkan implementation - may also move outside of JOGL, i.e. GlueGen or within its own package to be reused for other purposed. The 'com.jogamp.opengl.util.PMVMatrix' currently also used to feed in GLUniformData via the toolkit agnostic SyncAction and SyncBuffer shall also be split to a toolkit agnostic variant. An OpenGL PMVMatrix specialization implementing GLMatrixFunc can still exist, being derived from the toolkit agnostic base implementation. +++ Initial commit .. compile clean, passing most unit tests.
* Debug.debugExplicit(): Define and use explicit symbol debug flag; Use it for ↵Sven Gothel2023-09-162-3/+6
| | | | certain debug output to keep most silence for debugAll()
* FloatUtil.abs(a): Mark as deprecated, use Math.abs(a) directly. We assume it ↵Sven Gothel2023-09-042-6/+6
| | | | | | | | | | | | | | | | is an intrinsic + branch-less implementation Expected implementation is - return Float.intBitsToFloat(Float.floatToRawIntBits(a) & 0x7fffffff); replacing old implementation - return (a <= 0.0F) ? 0.0F - a : a; .. also market as @IntrinsicCandidate Hence we shall leave it to the JRE core-lib implementation...
* FloatUtil.isEqual(..): Rename raw {isEqual->isEqualRaw}(a,b) varianr w/o ↵Sven Gothel2023-09-032-2/+2
| | | | | | EPSILON; Add isEqual(a,b) w/ default EPSILON; Use it where applicable Also add isEqual2(a,b) w/o corner cases (NaN, Inf) used for comparison in Graph Outline, OutlineShape and later GraphUI Shape.
* GraphUI Scene: Pass sampleCount in ctor variant and refine API doc, clip to ↵Sven Gothel2023-09-031-1/+12
| | | | [1..8]; Add clarity in Region; Demos CommandlineOptions adds actual graphAASamples set and utilized
* PMVMatrix.gluPerspective(): Redfine angle in radians instead of degrees ** ↵Sven Gothel2023-09-021-3/+15
| | | | | | | | API Change ** Since this is an extra implementation of PMVMatrix and not of GLMatrixFunc, we shall use the default ISO dimension avoiding conversion. This alsi redefined Graph's RegionRenderer.reshapePerspective() angle definition from degrees to radians
* Graph Font + Glyph: Fix whitespace definition: Include 'no original ↵Sven Gothel2023-09-011-13/+17
| | | | | | | | | | | | | | underlying shape' and add API doc Regression was introduced with commit 920e529516bb264f04138ed1caca80d4925e3773 'Robust detetection and API definition of non-contour/whitespace Glyphs'. Issue was mistaken a glyph as undefined if not having an underlying shape, which is true for some fonts (e.g. 'space'). +++ Also Use post table's name if no underlying shape exists.
* Graph Font + Glyph: More robust detetection and API definition of ↵Sven Gothel2023-08-283-8/+42
| | | | | | non-contour/whitespace Glyphs (detect and allow to skip 'em) We also drop shapes for both, but for id 0 (unknown).
* Graph Loop: Make initFromPolyline() and locateClosestVertex() more robust, ↵Sven Gothel2023-08-281-1/+1
| | | | | | report error but do not crash. This behavior has been evaluated with a few fonts and the WIP FontView01 demo application.
* Graph TextRegionUtil.drawString3D(..): Allow null `rgbaColor` w/o ↵Sven Gothel2023-08-121-6/+12
| | | | color-channel again, was enforced to be set in commit bb6ee81bc5514663bb7b22224fcdd5ba34a51ac6
* Graph TextRegionUtil.drawString3D(..): Redefine 'rgbaColor' semantics: ↵Sven Gothel2023-08-021-3/+24
| | | | | | | | | | Either fill color-channel with value if used and set static-color to white - or just set static color channel with value. Have the given rgbaColor to definitely setting the text color regardless whether a color channel is used or not. Note: Using a color-channel is more expensive (color value per vertex) and should only be required if mixing colors within one region! Also removes potential side-effects if color-channel is used but user forgets to set the static value properly.
* Graph RenderState: Initialize colorStatic w/ all white (1,1,1,1) if ↵Sven Gothel2023-08-021-1/+1
| | | | | | | | | | | | color-channel is used and no static-color set Commit a973324a75b55b722caa755a7a573be849d997e4 was setting the alpha to 1, which avoids the 'discard' in the shader. This at least gave us a black color ;-) However, the shader modulates the color, i.e. color-channel * color-static, therefor we need an all-white color-static as default if user only sets the color-channel.
* Graph RegionRenderer.destroy(): Detach RenderState from GL instanceSven Gothel2023-08-021-0/+1
| | | | Remove potential leak
* Graph: Simplify RegionRenderer API by exposing common RenderState methods ↵Sven Gothel2023-08-021-16/+34
| | | | (and fwd 'em to RenderState aggregate)
* Graph Add {GLRegion, GraphShape}.setTextureUnit(int): Allowing to set ↵Sven Gothel2023-08-011-0/+3
| | | | texture unit after ctor
* Graph RegionRendered.init(..): Disable renderer (and shader programs etc) to ↵Sven Gothel2023-08-011-5/+3
| | | | avoid side-effects. Usually called @ GLEventListener.init(..)
* Graph RenderState: Initialize colorStatic w/ alpha=1 to avoid invisible ↵Sven Gothel2023-08-011-1/+1
| | | | | | rendering if no static color has been set Shader either uses just colorStatic or multiplies it w/ the color-stream value
* Graph GLRegion.create(..): Expose variant with custom pass2TexUnit for VBAA ↵Sven Gothel2023-08-011-5/+23
| | | | (default texture unit is 0)
* Graph: Minor cleanup: TextRegionUtil: Fix API doc references; ↵Sven Gothel2023-08-012-7/+6
| | | | RegionRenderer.enable(..) merge '!enable' branch, fix API doc
* Graph GLRegion: DEBUG_BUFFER (growth) 'jogl.debug.graph.curve.Buffer'Sven Gothel2023-05-051-19/+35
|