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); expandedPathID);
// Copy over B-quads. // Copy over B-quads.
let firstBQuadIndex = const originalBQuadRange = originalRanges.bQuadPathRanges[originalPathID - 1];
findFirstBQuadIndex(originalBuffers.bQuads as Uint32Array, const firstExpandedBQuadIndex = expandedArrays.bQuads.length / B_QUAD_FIELD_COUNT;
originalBuffers.bVertexPathIDs as Uint16Array, expandedRanges.bQuadPathRanges[expandedPathID - 1] =
originalPathID); new Range(firstExpandedBQuadIndex,
if (firstBQuadIndex == null) firstExpandedBQuadIndex + originalBQuadRange.length);
firstBQuadIndex = originalBuffers.bQuads.length;
const indexDelta = firstExpandedBVertexIndex - firstBVertexIndex; const indexDelta = firstExpandedBVertexIndex - firstBVertexIndex;
for (let bQuadIndex = firstBQuadIndex; for (let bQuadIndex = originalBQuadRange.start;
bQuadIndex < originalBuffers.bQuads.length / B_QUAD_FIELD_COUNT; bQuadIndex < originalBQuadRange.end;
bQuadIndex++) { bQuadIndex++) {
const bQuad = originalBuffers.bQuads[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++) { for (let indexIndex = 0; indexIndex < B_QUAD_FIELD_COUNT; indexIndex++) {
const srcIndex = originalBuffers.bQuads[bQuadIndex * B_QUAD_FIELD_COUNT + const srcIndex = originalBuffers.bQuads[bQuadIndex * B_QUAD_FIELD_COUNT +
indexIndex]; 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 { function toFourCC(buffer: ArrayBuffer, position: number): string {
let result = ""; let result = "";
const bytes = new Uint8Array(buffer, position, 4); const bytes = new Uint8Array(buffer, position, 4);

View File

@ -487,7 +487,7 @@ export abstract class MCAAStrategy extends XCAAStrategy {
false, false,
FLOAT32_SIZE * 4, FLOAT32_SIZE * 4,
FLOAT32_SIZE * 4 * offset + FLOAT32_SIZE * 2); 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, gl.vertexAttribPointer(attributes.aPathID,
1, 1,
gl.UNSIGNED_SHORT, gl.UNSIGNED_SHORT,