forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebGL rendering of Ngon glyph (bokeh#14044)
* WebGL rendering of Ngon glyph * Linting
- Loading branch information
1 parent
c7368dc
commit a28073d
Showing
13 changed files
with
180 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type {ReglWrapper} from "./regl_wrap" | ||
import {RadialGL} from "./radial" | ||
import type {GLMarkerType} from "./types" | ||
import type {NgonView} from "../ngon" | ||
|
||
export class NgonGL extends RadialGL { | ||
constructor(regl_wrapper: ReglWrapper, override readonly glyph: NgonView) { | ||
super(regl_wrapper, glyph) | ||
} | ||
|
||
get marker_type(): GLMarkerType { | ||
return "ngon" | ||
} | ||
|
||
protected override _set_data(): void { | ||
super._set_data() | ||
this._angles.set_from_prop(this.glyph.angle) | ||
this._auxs.set_from_prop(this.glyph.n) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type {ReglWrapper} from "./regl_wrap" | ||
import type {Float32Buffer} from "./buffer" | ||
import type {SXSYGlyphView} from "./sxsy" | ||
import {SXSYGlyphGL} from "./sxsy" | ||
import type {Arrayable} from "core/types" | ||
import {mul} from "core/util/arrayable" | ||
|
||
type RadialLikeGlyphView = SXSYGlyphView & { | ||
sradius: Arrayable<number> | ||
} | ||
|
||
export abstract class RadialGL extends SXSYGlyphGL { | ||
constructor(regl_wrapper: ReglWrapper, override readonly glyph: RadialLikeGlyphView) { | ||
super(regl_wrapper, glyph) | ||
} | ||
|
||
// TODO: should be 'radius' | ||
get size(): Float32Buffer { | ||
return this._widths | ||
} | ||
|
||
protected override _set_data(): void { | ||
super._set_data() | ||
|
||
// Ideally we wouldn't multiply here, but currently handling of | ||
// circle glyph and scatter with circle marker is handled with | ||
// a single code path. | ||
this.size.set_from_array(mul(this.glyph.sradius, 2.0)) | ||
} | ||
|
||
protected override _set_once(): void { | ||
super._set_once() | ||
this._heights.set_from_scalar(0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
bokehjs/test/baselines/linux/Glyph_models__should_support_Ngon.blf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Row bbox=[0, 0, 900, 300] | ||
Figure bbox=[0, 0, 300, 300] | ||
Canvas bbox=[0, 0, 300, 300] | ||
CartesianFrame bbox=[29, 27, 266, 251] | ||
GlyphRenderer bbox=[29, 27, 177, 251] | ||
Ngon bbox=[29, 27, 177, 251] | ||
GlyphRenderer bbox=[118, 33, 173, 245] | ||
Ngon bbox=[118, 33, 173, 245] | ||
LinearAxis bbox=[29, 278, 266, 22] | ||
LinearAxis bbox=[0, 27, 29, 251] | ||
Title bbox=[29, 0, 266, 27] | ||
Figure bbox=[300, 0, 300, 300] | ||
Canvas bbox=[0, 0, 300, 300] | ||
CartesianFrame bbox=[29, 27, 266, 251] | ||
GlyphRenderer bbox=[29, 27, 177, 251] | ||
Ngon bbox=[29, 27, 177, 251] | ||
GlyphRenderer bbox=[118, 33, 173, 245] | ||
Ngon bbox=[118, 33, 173, 245] | ||
LinearAxis bbox=[29, 278, 266, 22] | ||
LinearAxis bbox=[0, 27, 29, 251] | ||
Title bbox=[29, 0, 266, 27] | ||
Figure bbox=[600, 0, 300, 300] | ||
Canvas bbox=[0, 0, 300, 300] | ||
CartesianFrame bbox=[29, 27, 266, 251] | ||
GlyphRenderer bbox=[29, 27, 177, 251] | ||
Ngon bbox=[29, 27, 177, 251] | ||
GlyphRenderer bbox=[118, 33, 173, 245] | ||
Ngon bbox=[118, 33, 173, 245] | ||
LinearAxis bbox=[29, 278, 266, 22] | ||
LinearAxis bbox=[0, 27, 29, 251] | ||
Title bbox=[29, 0, 266, 27] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters