提交 0385e47d 编写于 作者: C Charles Nicholson 提交者: TensorFlower Gardener

Fix picking bug in fragment shader. Since we're not doing a camera-relative

depth sort, we can't do 1-bit alpha correctly. Revert to using discard in the
picking shader until we do a global camera-space z sort (if ever).

Aggregate [PointAccessor, PointAccessor, PointAccessor] as a new type,
PointAccessors3D.
Change: 137823236
上级 ca83167f
......@@ -23,6 +23,7 @@ import {SpriteMetadata} from './data-provider';
export type DistanceFunction = (a: number[], b: number[]) => number;
export type PointAccessor = (index: number) => number;
export type PointAccessors3D = [PointAccessor, PointAccessor, PointAccessor];
export interface PointMetadata {
[key: string]: number | string;
......
......@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {PointAccessor, DataSet} from './data';
import {DataSet, PointAccessors3D} from './data';
import {HoverContext} from './hoverContext';
import {LabelRenderParams, RenderContext} from './renderContext';
import {ScatterPlotVisualizer} from './scatterPlotVisualizer';
......@@ -103,7 +103,7 @@ export class ScatterPlot {
private onCameraMoveListeners: OnCameraMoveListener[] = [];
// Accessors for rendering and labeling the points.
private pointAccessors: [PointAccessor, PointAccessor, PointAccessor];
private pointAccessors: PointAccessors3D;
// Scaling functions for each axis.
private xScale: d3.scale.Linear<number, number>;
......@@ -718,8 +718,7 @@ export class ScatterPlot {
this.renderer.render(this.scene, this.camera);
}
setPointAccessors(pointAccessors:
[PointAccessor, PointAccessor, PointAccessor]) {
setPointAccessors(pointAccessors: PointAccessors3D) {
this.pointAccessors = pointAccessors;
}
......
......@@ -122,8 +122,11 @@ const FRAGMENT_SHADER_PICKING = `
if (isImage) {
gl_FragColor = vec4(vColor, 1);
} else {
float a = float(point_in_unit_circle(gl_PointCoord));
gl_FragColor = vec4(vColor, a);
bool inside = point_in_unit_circle(gl_PointCoord);
if (!inside) {
discard;
}
gl_FragColor = vec4(vColor, 1);
}
}`;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册