Skip to content

Commit

Permalink
Merge 4cdf7b0 into 8e382c6
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed May 20, 2019
2 parents 8e382c6 + 4cdf7b0 commit 9402440
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 59 deletions.
12 changes: 10 additions & 2 deletions modules/core/src/lib/attribute.js
Expand Up @@ -184,7 +184,15 @@ export default class Attribute extends BaseAttribute {
return false;
}

updateBuffer({numInstances, bufferLayout, data, startRow, endRow, props, context}) {
updateBuffer({
numInstances,
bufferLayout,
data,
startRow = 0,
endRow = Infinity,
props,
context
}) {
if (!this.needsUpdate()) {
return false;
}
Expand Down Expand Up @@ -362,7 +370,7 @@ export default class Attribute extends BaseAttribute {

assert(typeof accessorFunc === 'function', `accessor "${accessor}" is not a function`);

let i = attribute._getVertexOffset(startRow || 0, bufferLayout);
let i = attribute._getVertexOffset(startRow, bufferLayout);
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
Expand Down
16 changes: 8 additions & 8 deletions modules/layers/src/arc-layer/arc-layer.js
Expand Up @@ -173,11 +173,11 @@ export default class ArcLayer extends Layer {
return model;
}

calculateInstancePositions(attribute) {
calculateInstancePositions(attribute, {startRow, endRow}) {
const {data, getSourcePosition, getTargetPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const sourcePosition = getSourcePosition(object, objectInfo);
Expand All @@ -189,7 +189,7 @@ export default class ArcLayer extends Layer {
}
}

calculateInstancePositions64Low(attribute) {
calculateInstancePositions64Low(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -199,9 +199,9 @@ export default class ArcLayer extends Layer {
}

const {data, getSourcePosition, getTargetPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const sourcePosition = getSourcePosition(object, objectInfo);
Expand Down
8 changes: 4 additions & 4 deletions modules/layers/src/column-layer/column-layer.js
Expand Up @@ -249,7 +249,7 @@ export default class ColumnLayer extends Layer {
}
}

calculateInstancePositions64xyLow(attribute) {
calculateInstancePositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -259,9 +259,9 @@ export default class ColumnLayer extends Layer {
}

const {data, getPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const position = getPosition(object, objectInfo);
Expand Down
24 changes: 12 additions & 12 deletions modules/layers/src/icon-layer/icon-layer.js
Expand Up @@ -247,12 +247,12 @@ export default class IconLayer extends Layer {
}
}

calculateInstanceOffsets(attribute) {
calculateInstanceOffsets(attribute, {startRow, endRow}) {
const {data} = this.props;
const {iconManager} = this.state;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const rect = iconManager.getIconMapping(object, objectInfo);
Expand All @@ -261,12 +261,12 @@ export default class IconLayer extends Layer {
}
}

calculateInstanceColorMode(attribute) {
calculateInstanceColorMode(attribute, {startRow, endRow}) {
const {data} = this.props;
const {iconManager} = this.state;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const mapping = iconManager.getIconMapping(object, objectInfo);
Expand All @@ -275,12 +275,12 @@ export default class IconLayer extends Layer {
}
}

calculateInstanceIconFrames(attribute) {
calculateInstanceIconFrames(attribute, {startRow, endRow}) {
const {data} = this.props;
const {iconManager} = this.state;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const rect = iconManager.getIconMapping(object, objectInfo);
Expand Down
8 changes: 4 additions & 4 deletions modules/layers/src/line-layer/line-layer.js
Expand Up @@ -144,7 +144,7 @@ export default class LineLayer extends Layer {
);
}

calculateInstanceSourceTargetPositions64xyLow(attribute) {
calculateInstanceSourceTargetPositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -154,9 +154,9 @@ export default class LineLayer extends Layer {
}

const {data, getSourcePosition, getTargetPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const sourcePosition = getSourcePosition(object, objectInfo);
Expand Down
8 changes: 4 additions & 4 deletions modules/layers/src/point-cloud-layer/point-cloud-layer.js
Expand Up @@ -132,7 +132,7 @@ export default class PointCloudLayer extends Layer {
);
}

calculateInstancePositions64xyLow(attribute) {
calculateInstancePositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -142,9 +142,9 @@ export default class PointCloudLayer extends Layer {
}

const {data, getPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const position = getPosition(object, objectInfo);
Expand Down
8 changes: 4 additions & 4 deletions modules/layers/src/scatterplot-layer/scatterplot-layer.js
Expand Up @@ -167,7 +167,7 @@ export default class ScatterplotLayer extends Layer {
);
}

calculateInstancePositions64xyLow(attribute) {
calculateInstancePositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -177,9 +177,9 @@ export default class ScatterplotLayer extends Layer {
}

const {data, getPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const position = getPosition(object, objectInfo);
Expand Down
21 changes: 13 additions & 8 deletions modules/layers/src/text-layer/multi-icon-layer/multi-icon-layer.js
Expand Up @@ -18,6 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import {createIterable} from '@deck.gl/core';
import IconLayer from '../../icon-layer/icon-layer';

import vs from './multi-icon-layer-vertex.glsl';
Expand Down Expand Up @@ -86,7 +87,7 @@ export default class MultiIconLayer extends IconLayer {
});
}

calculateInstanceOffsets(attribute) {
calculateInstanceOffsets(attribute, {startRow, endRow}) {
const {
data,
iconMapping,
Expand All @@ -96,9 +97,11 @@ export default class MultiIconLayer extends IconLayer {
getLengthOfQueue,
getShiftInQueue
} = this.props;
const {value} = attribute;
let i = 0;
for (const object of data) {
const {value, size} = attribute;
let i = startRow * size;
const {iterable} = createIterable(data, startRow, endRow);

for (const object of iterable) {
const icon = getIcon(object);
const rect = iconMapping[icon] || {};
const len = getLengthOfQueue(object);
Expand All @@ -109,12 +112,14 @@ export default class MultiIconLayer extends IconLayer {
}
}

calculateInstancePickingColors(attribute) {
calculateInstancePickingColors(attribute, {startRow, endRow}) {
const {data, getPickingIndex} = this.props;
const {value} = attribute;
let i = 0;
const {value, size} = attribute;
let i = startRow * size;
const pickingColor = [];
for (const point of data) {
const {iterable} = createIterable(data, startRow, endRow);

for (const point of iterable) {
const index = getPickingIndex(point);
this.encodePickingColor(index, pickingColor);

Expand Down
14 changes: 8 additions & 6 deletions modules/mesh-layers/src/scenegraph-layer/scenegraph-layer.js
Expand Up @@ -20,7 +20,7 @@

/* global fetch */

import {Layer} from '@deck.gl/core';
import {Layer, createIterable} from '@deck.gl/core';
import {fp64, ScenegraphNode, log} from '@luma.gl/core';
import {load} from '@loaders.gl/core';

Expand Down Expand Up @@ -85,7 +85,7 @@ export default class ScenegraphLayer extends Layer {
});
}

calculateInstancePositions64xyLow(attribute) {
calculateInstancePositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -95,10 +95,12 @@ export default class ScenegraphLayer extends Layer {
}

const {data, getPosition} = this.props;
const {value} = attribute;
let i = 0;
for (const point of data) {
const position = getPosition(point);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const point of iterable) {
objectInfo.index++;
const position = getPosition(point, objectInfo);
value[i++] = fp64LowPart(position[0]);
value[i++] = fp64LowPart(position[1]);
}
Expand Down
Expand Up @@ -280,7 +280,7 @@ export default class SimpleMeshLayer extends Layer {
}
}

calculateInstancePositions64xyLow(attribute) {
calculateInstancePositions64xyLow(attribute, {startRow, endRow}) {
const isFP64 = this.use64bitPositions();
attribute.constant = !isFP64;

Expand All @@ -290,9 +290,9 @@ export default class SimpleMeshLayer extends Layer {
}

const {data, getPosition} = this.props;
const {value} = attribute;
let i = 0;
const {iterable, objectInfo} = createIterable(data);
const {value, size} = attribute;
let i = startRow * size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
const position = getPosition(object, objectInfo);
Expand Down
6 changes: 3 additions & 3 deletions modules/mesh-layers/src/utils/matrix.js
Expand Up @@ -76,7 +76,7 @@ export const MATRIX_ATTRIBUTES = {
}
},

update(attribute) {
update(attribute, {startRow, endRow}) {
// NOTE(Tarek): "this" will be bound to a layer!
const {data, getOrientation, getScale, getTranslation, getTransformMatrix} = this.props;

Expand Down Expand Up @@ -114,8 +114,8 @@ export const MATRIX_ATTRIBUTES = {

attribute.value = new Float32Array(matrix);
} else {
let i = 0;
const {iterable, objectInfo} = createIterable(data);
let i = startRow * attribute.size;
const {iterable, objectInfo} = createIterable(data, startRow, endRow);
for (const object of iterable) {
objectInfo.index++;
let matrix;
Expand Down

0 comments on commit 9402440

Please sign in to comment.