fix(shader): confict

This commit is contained in:
thinkinggis 2019-02-26 16:58:56 +08:00
commit 619fe5c890
4 changed files with 5 additions and 26 deletions

View File

@ -34,7 +34,7 @@ class Picking {
window.addEventListener('resize', this._resizeHandler, false);
}
pickdata(event) {
const point = { x: event.pixel.x, y: event.pixel.y, type: event.type };
const point = { x: event.offsetX, y: event.offsetY, type: event.type };
const normalisedPoint = { x: 0, y: 0 };
normalisedPoint.x = (point.x / this._width) * 2 - 1;
normalisedPoint.y = -(point.y / this._height) * 2 + 1;

View File

@ -101,7 +101,8 @@ export default class Scene extends Base {
'dblclick'
];
events.forEach(event => {
this.map.on(event, e => {
this._container.addEventListener(event, e => {
// 要素拾取
this._engine._picking.pickdata(e);
}, false);

View File

@ -1,28 +1,5 @@
import Material from './material';
import { getModule } from '../../util/shaderModule';
// export default function PolygonMaterial(options) {
// const material = new Material({
// uniforms: {
// u_opacity: { value: options.u_opacity || 1.0 },
// u_texture: { value: options.u_texture },
// u_time: { value: options.u_time || 0 },
// u_zoom: { value: options.u_zoom || 0 },
// u_baseColor: { value: options.u_baseColor || [ 1.0, 0, 0, 1.0 ] },
// u_brightColor: { value: options.u_brightColor || [ 1.0, 0, 0, 1.0 ] },
// u_windowColor: { value: options.u_windowColor || [ 1.0, 0, 0, 1.0 ] },
// u_near: { value: options.u_near || 0.0 },
// u_far: { value: options.u_far || 1.0 }
// },
// vertexShader: polygon_vert,
// fragmentShader: polygon_frag,
// transparent: true,
// defines: {
// TEXCOORD_0: !!options.u_texture
// }
// });
// return material;
// }
export default class PolygonMaterial extends Material {
getDefaultParameters() {
return {

View File

@ -1,7 +1,8 @@
precision highp float;
#pragma import "common"
#define PI 3.14159265359
#define TWO_PI 6.28318530718
uniform float u_strokeWidth;
uniform vec4 u_stroke;