Time CPU side work
This commit is contained in:
parent
aa08cd1499
commit
b05e5d5281
|
@ -355,7 +355,7 @@ class App {
|
||||||
// Populate the cover VBO.
|
// Populate the cover VBO.
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, this.coverVertexBuffer);
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.coverVertexBuffer);
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, new Int16Array(coverVertexData), gl.DYNAMIC_DRAW);
|
gl.bufferData(gl.ARRAY_BUFFER, new Int16Array(coverVertexData), gl.DYNAMIC_DRAW);
|
||||||
console.log(coverVertexData);
|
//console.log(coverVertexData);
|
||||||
|
|
||||||
this.primitiveCount = primitiveCount;
|
this.primitiveCount = primitiveCount;
|
||||||
console.log(primitiveCount + " primitives");
|
console.log(primitiveCount + " primitives");
|
||||||
|
@ -381,7 +381,8 @@ class Scene {
|
||||||
|
|
||||||
//const tileDebugger = new TileDebugger(document);
|
//const tileDebugger = new TileDebugger(document);
|
||||||
|
|
||||||
for (let pathElementIndex = 0, realPathIndex = 0;
|
const paths = [];
|
||||||
|
for (let pathElementIndex = 0;
|
||||||
pathElementIndex < pathElements.length;
|
pathElementIndex < pathElements.length;
|
||||||
pathElementIndex++) {
|
pathElementIndex++) {
|
||||||
const pathElement = pathElements[pathElementIndex];
|
const pathElement = pathElements[pathElementIndex];
|
||||||
|
@ -393,9 +394,9 @@ class Scene {
|
||||||
/*} else if (style.stroke != null && style.stroke !== 'none') {
|
/*} else if (style.stroke != null && style.stroke !== 'none') {
|
||||||
paint = style.stroke;*/
|
paint = style.stroke;*/
|
||||||
} else {
|
} else {
|
||||||
//pathColors.push({r: 0, g: 0, b: 0, a: 0});
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const color = parseColor(paint).rgba;
|
const color = parseColor(paint).rgba;
|
||||||
pathColors.push({
|
pathColors.push({
|
||||||
r: color[0],
|
r: color[0],
|
||||||
|
@ -413,18 +414,24 @@ class Scene {
|
||||||
|
|
||||||
path = flattenPath(path);
|
path = flattenPath(path);
|
||||||
path = canonicalizePath(path);
|
path = canonicalizePath(path);
|
||||||
|
paths.push(path);
|
||||||
|
}
|
||||||
|
|
||||||
realPathIndex++;
|
const startTime = window.performance.now();
|
||||||
|
|
||||||
|
for (const path of paths) {
|
||||||
const tiler = new Tiler(path);
|
const tiler = new Tiler(path);
|
||||||
tiler.tile();
|
tiler.tile();
|
||||||
//tileDebugger.addTiler(tiler, paint, "" + realPathIndex);
|
//tileDebugger.addTiler(tiler, paint, "" + realPathIndex);
|
||||||
console.log("path", pathElementIndex, "tiles", tiler.getStrips());
|
//console.log("path", pathElementIndex, "tiles", tiler.getStrips());
|
||||||
|
|
||||||
const pathTileStrips = tiler.getTileStrips();
|
const pathTileStrips = tiler.getTileStrips();
|
||||||
this.pathTileStrips.push(pathTileStrips);
|
this.pathTileStrips.push(pathTileStrips);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const endTime = window.performance.now();
|
||||||
|
console.log("elapsed time for tiling: " + (endTime - startTime) + "ms");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (const tile of tiles) {
|
for (const tile of tiles) {
|
||||||
const newSVG = staticCast(document.createElementNS(SVG_NS, 'svg'), SVGElement);
|
const newSVG = staticCast(document.createElementNS(SVG_NS, 'svg'), SVGElement);
|
||||||
|
|
Loading…
Reference in New Issue