Webgl / linting & test fixes
This commit is contained in:
@@ -22,16 +22,17 @@ texture.src = 'data/ufo_shapes.png';
|
||||
|
||||
// This describes the content of the associated sprite sheet
|
||||
// coords are u0, v0, u1, v1 for a given shape
|
||||
const shapeTextureCoords = {
|
||||
'light': [0, 0.5, 0.25, 0],
|
||||
'sphere': [0.25, 0.5, 0.5, 0],
|
||||
'circle': [0.25, 0.5, 0.5, 0],
|
||||
'disc': [0.5, 0.5, 0.75, 0],
|
||||
'oval': [0.5, 0.5, 0.75, 0],
|
||||
'triangle': [0.75, 0.5, 1, 0],
|
||||
'fireball': [0, 1, 0.25, 0.5],
|
||||
'default': [0.75, 1, 1, 0.5]
|
||||
};
|
||||
// FIXME: re enable this
|
||||
// const shapeTextureCoords = {
|
||||
// 'light': [0, 0.5, 0.25, 0],
|
||||
// 'sphere': [0.25, 0.5, 0.5, 0],
|
||||
// 'circle': [0.25, 0.5, 0.5, 0],
|
||||
// 'disc': [0.5, 0.5, 0.75, 0],
|
||||
// 'oval': [0.5, 0.5, 0.75, 0],
|
||||
// 'triangle': [0.75, 0.5, 1, 0],
|
||||
// 'fireball': [0, 1, 0.25, 0.5],
|
||||
// 'default': [0.75, 1, 1, 0.5]
|
||||
// };
|
||||
|
||||
const oldColor = [255, 160, 110];
|
||||
const newColor = [180, 255, 200];
|
||||
|
||||
@@ -2,28 +2,23 @@ import Map from '../../../src/ol/Map.js';
|
||||
import View from '../../../src/ol/View.js';
|
||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
||||
import {Vector as VectorLayer} from '../../../src/ol/layer.js';
|
||||
import VectorSource from '../../../src/ol/source/Vector.js';
|
||||
import KML from '../../../src/ol/format/KML.js';
|
||||
import WebGLPointsLayerRenderer from '../../../src/ol/renderer/webgl/PointsLayer.js';
|
||||
import WebGLPointsLayer from '../../../src/ol/layer/WebGLPoints.js';
|
||||
|
||||
class CustomLayer extends VectorLayer {
|
||||
createRenderer() {
|
||||
return new WebGLPointsLayerRenderer(this, {
|
||||
sizeCallback: function() {
|
||||
return 4;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const vector = new CustomLayer({
|
||||
const vector = new WebGLPointsLayer({
|
||||
source: new VectorSource({
|
||||
url: '/data/2012_Earthquakes_Mag5.kml',
|
||||
format: new KML({
|
||||
extractStyles: false
|
||||
})
|
||||
})
|
||||
}),
|
||||
literalStyle: {
|
||||
symbol: {
|
||||
size: 4,
|
||||
color: 'white'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const raster = new TileLayer({
|
||||
|
||||
@@ -5,7 +5,7 @@ import WebGLArrayBuffer from '../../webgl/Buffer.js';
|
||||
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
||||
import {AttributeType, DefaultUniform} from '../../webgl/Helper.js';
|
||||
import GeometryType from '../../geom/GeometryType.js';
|
||||
import WebGLLayerRenderer, {colorDecodeId, colorEncodeId, getBlankImageData, WebGLWorkerMessageType} from './Layer.js';
|
||||
import WebGLLayerRenderer, {colorDecodeId, colorEncodeId, WebGLWorkerMessageType} from './Layer.js';
|
||||
import ViewHint from '../../ViewHint.js';
|
||||
import {createEmpty, equals} from '../../extent.js';
|
||||
import {
|
||||
|
||||
@@ -23,7 +23,7 @@ export function formatNumber(v) {
|
||||
* @returns {string} The color components concatenated in `1.0, 1.0, 1.0, 1.0` form.
|
||||
*/
|
||||
export function formatColor(colorArray) {
|
||||
return colorArray.map(function (c, i) {
|
||||
return colorArray.map(function(c, i) {
|
||||
return i < 3 ? c / 255 : c;
|
||||
}).map(formatNumber).join(', ');
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('ol.renderer.webgl.Layer', function() {
|
||||
});
|
||||
|
||||
describe('writePointFeatureToBuffers', function() {
|
||||
let vertexBuffer, indexBuffer, instructions, elementIndex;
|
||||
let vertexBuffer, indexBuffer, instructions;
|
||||
|
||||
beforeEach(function() {
|
||||
vertexBuffer = new Float32Array(100);
|
||||
|
||||
@@ -108,7 +108,9 @@ describe('ol.renderer.webgl.PointsLayer', function() {
|
||||
});
|
||||
renderer = new WebGLPointsLayerRenderer(layer, {
|
||||
vertexShader: simpleVertexShader,
|
||||
fragmentShader: simpleFragmentShader
|
||||
fragmentShader: simpleFragmentShader,
|
||||
hitVertexShader: hitVertexShader,
|
||||
hitFragmentShader: hitFragmentShader
|
||||
});
|
||||
frameState = Object.assign({
|
||||
size: [2, 2],
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import WebGLHelper, {AttributeType, computeAttributesStride} from '../../../../src/ol/webgl/Helper.js';
|
||||
import WebGLHelper from '../../../../src/ol/webgl/Helper.js';
|
||||
import {
|
||||
create as createTransform,
|
||||
rotate as rotateTransform,
|
||||
scale as scaleTransform, translate as translateTransform
|
||||
scale as scaleTransform,
|
||||
translate as translateTransform
|
||||
} from '../../../../src/ol/transform.js';
|
||||
import {FLOAT} from '../../../../src/ol/webgl.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {create} from '../../../../src/ol/worker/webgl.js';
|
||||
import {
|
||||
POINT_INSTRUCTIONS_COUNT,
|
||||
WebGLWorkerMessageType
|
||||
} from '../../../../src/ol/renderer/webgl/Layer.js';
|
||||
|
||||
@@ -22,7 +21,9 @@ describe('ol/worker/webgl', function() {
|
||||
describe('messaging', function() {
|
||||
describe('GENERATE_BUFFERS', function() {
|
||||
it('responds with buffer data', function(done) {
|
||||
worker.addEventListener('error', done);
|
||||
worker.addEventListener('error', function(error) {
|
||||
expect().fail(error.message);
|
||||
});
|
||||
|
||||
worker.addEventListener('message', function(event) {
|
||||
expect(event.data.type).to.eql(WebGLWorkerMessageType.GENERATE_BUFFERS);
|
||||
@@ -34,11 +35,12 @@ describe('ol/worker/webgl', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
const instructions = new Float32Array(POINT_INSTRUCTIONS_COUNT);
|
||||
const instructions = new Float32Array(10);
|
||||
|
||||
const message = {
|
||||
type: WebGLWorkerMessageType.GENERATE_BUFFERS,
|
||||
renderInstructions: instructions,
|
||||
customAttributesCount: 0,
|
||||
testInt: 101,
|
||||
testString: 'abcd'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user