Fix MCAA in the text demo.

The B-quad ranges were not being expanded properly.
This commit is contained in:
Patrick Walton 2017-11-08 20:58:22 -08:00
parent 9a5728aab6
commit 35e59b1a05
2 changed files with 8 additions and 27 deletions

View File

@ -456,23 +456,16 @@ export class PathfinderMeshData implements Meshes<ArrayBuffer>, MeshDataCounts,
expandedPathID);
// Copy over B-quads.
let firstBQuadIndex =
findFirstBQuadIndex(originalBuffers.bQuads as Uint32Array,
originalBuffers.bVertexPathIDs as Uint16Array,
originalPathID);
if (firstBQuadIndex == null)
firstBQuadIndex = originalBuffers.bQuads.length;
const originalBQuadRange = originalRanges.bQuadPathRanges[originalPathID - 1];
const firstExpandedBQuadIndex = expandedArrays.bQuads.length / B_QUAD_FIELD_COUNT;
expandedRanges.bQuadPathRanges[expandedPathID - 1] =
new Range(firstExpandedBQuadIndex,
firstExpandedBQuadIndex + originalBQuadRange.length);
const indexDelta = firstExpandedBVertexIndex - firstBVertexIndex;
for (let bQuadIndex = firstBQuadIndex;
bQuadIndex < originalBuffers.bQuads.length / B_QUAD_FIELD_COUNT;
for (let bQuadIndex = originalBQuadRange.start;
bQuadIndex < originalBQuadRange.end;
bQuadIndex++) {
const bQuad = originalBuffers.bQuads[bQuadIndex];
if (originalBuffers.bVertexPathIDs[originalBuffers.bQuads[bQuadIndex *
B_QUAD_FIELD_COUNT]] !==
originalPathID) {
break;
}
for (let indexIndex = 0; indexIndex < B_QUAD_FIELD_COUNT; indexIndex++) {
const srcIndex = originalBuffers.bQuads[bQuadIndex * B_QUAD_FIELD_COUNT +
indexIndex];
@ -730,18 +723,6 @@ function sizeOfPrimitive(primitiveType: PrimitiveType): number {
}
}
function findFirstBQuadIndex(bQuads: Uint32Array,
bVertexPathIDs: Uint16Array,
queryPathID: number):
number | null {
for (let bQuadIndex = 0; bQuadIndex < bQuads.length / B_QUAD_FIELD_COUNT; bQuadIndex++) {
const thisPathID = bVertexPathIDs[bQuads[bQuadIndex * B_QUAD_FIELD_COUNT]];
if (thisPathID === queryPathID)
return bQuadIndex;
}
return null;
}
function toFourCC(buffer: ArrayBuffer, position: number): string {
let result = "";
const bytes = new Uint8Array(buffer, position, 4);

View File

@ -487,7 +487,7 @@ export abstract class MCAAStrategy extends XCAAStrategy {
false,
FLOAT32_SIZE * 4,
FLOAT32_SIZE * 4 * offset + FLOAT32_SIZE * 2);
gl.bindBuffer(gl.ARRAY_BUFFER, renderer.meshes[0].edgeBoundingBoxPathIDs);
gl.bindBuffer(gl.ARRAY_BUFFER, renderer.meshes[meshIndex].edgeBoundingBoxPathIDs);
gl.vertexAttribPointer(attributes.aPathID,
1,
gl.UNSIGNED_SHORT,