shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$utils$buildContextBatches = function(global, require, module, exports) { function addShapePathToGeometryData(shapePath, style, isStroke, batches, geometryData) { const {vertices, uvs, indices} = geometryData; shapePath.shapePrimitives.forEach(({shape, transform:matrix, holes}) => { var points = []; const build = shapeBuilders[shape.type]; if (build.build(shape, points)) { var indexOffset = indices.length, vertOffset = vertices.length / 2, topology = "triangle-list"; matrix && transformVertices.transformVertices(points, matrix); if (isStroke) { holes = shape.closePath ?? !0, style.pixelLine ? (buildPixelLine.buildPixelLine(points, holes, vertices, indices), topology = "line-list") : buildLine.buildLine(points, style, !1, holes, vertices, indices); } else { if (holes) { const holeIndices = [], otherPoints = points.slice(); getHoleArrays(holes).forEach(holePoints => { holeIndices.push(otherPoints.length / 2); otherPoints.push(...holePoints); }); triangulateWithHoles.triangulateWithHoles(otherPoints, holeIndices, vertices, 2, vertOffset, indices, indexOffset); } else { build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset); } } holes = uvs.length / 2; points = style.texture; points !== Texture.Texture.WHITE ? (shape = generateTextureFillMatrix.generateTextureMatrix(tempTextureMatrix, style, shape, matrix), buildUvs.buildUvs(vertices, 2, vertOffset, uvs, holes, 2, vertices.length / 2 - vertOffset, shape)) : buildUvs.buildSimpleUvs(uvs, holes, 2, vertices.length / 2 - vertOffset); shape = PoolGroup.BigPool.get(BatchableGraphics.BatchableGraphics); shape.indexOffset = indexOffset; shape.indexSize = indices.length - indexOffset; shape.attributeOffset = vertOffset; shape.attributeSize = vertices.length / 2 - vertOffset; shape.baseColor = style.color; shape.alpha = style.alpha; shape.texture = points; shape.geometryData = geometryData; shape.topology = topology; batches.push(shape); } }); } function getHoleArrays(holePrimitives) { const holeArrays = []; for (let k = 0; k < holePrimitives.length; k++) { const holePrimitive = holePrimitives[k].shape, holePoints = []; shapeBuilders[holePrimitive.type].build(holePrimitive, holePoints) && holeArrays.push(holePoints); } return holeArrays; } global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions"); module = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$Matrix"); var Rectangle = require("module$node_modules$pixi_DOT_js$lib$maths$shapes$Rectangle"), buildUvs = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$geometry$utils$buildUvs"), transformVertices = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$geometry$utils$transformVertices"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture"), PoolGroup = require("module$node_modules$pixi_DOT_js$lib$utils$pool$PoolGroup"), BatchableGraphics = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$BatchableGraphics"), buildCircle = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildCircle"), buildLine = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildLine"), buildPixelLine = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildPixelLine"), buildPolygon = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildPolygon"), buildRectangle = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildRectangle"), buildTriangle = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$buildCommands$buildTriangle"), generateTextureFillMatrix = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$utils$generateTextureFillMatrix"), triangulateWithHoles = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$utils$triangulateWithHoles"); "use strict"; const shapeBuilders = {}; global.extensions.handleByMap(global.ExtensionType.ShapeBuilder, shapeBuilders); global.extensions.add(buildRectangle.buildRectangle, buildPolygon.buildPolygon, buildTriangle.buildTriangle, buildCircle.buildCircle, buildCircle.buildEllipse, buildCircle.buildRoundedRectangle); const tempRect = new Rectangle.Rectangle(), tempTextureMatrix = new module.Matrix(); exports.buildContextBatches = function(context, gpuContext) { const {geometryData, batches} = gpuContext; batches.length = 0; geometryData.indices.length = 0; geometryData.vertices.length = 0; geometryData.uvs.length = 0; for (gpuContext = 0; gpuContext < context.instructions.length; gpuContext++) { var instruction = context.instructions[gpuContext]; if ("texture" === instruction.action) { a: { var data = instruction.data; instruction = []; var build = shapeBuilders.rectangle, rect = tempRect; rect.x = data.dx; rect.y = data.dy; rect.width = data.dw; rect.height = data.dh; const matrix = data.transform; if (!build.build(rect, instruction)) { break a; } const {vertices, uvs, indices} = geometryData; rect = indices.length; var vertOffset = vertices.length / 2; matrix && transformVertices.transformVertices(instruction, matrix); build.triangulate(instruction, vertices, 2, vertOffset, indices, rect); instruction = data.image; build = instruction.uvs; uvs.push(build.x0, build.y0, build.x1, build.y1, build.x3, build.y3, build.x2, build.y2); build = PoolGroup.BigPool.get(BatchableGraphics.BatchableGraphics); build.indexOffset = rect; build.indexSize = indices.length - rect; build.attributeOffset = vertOffset; build.attributeSize = vertices.length / 2 - vertOffset; build.baseColor = data.style; build.alpha = data.alpha; build.texture = instruction; build.geometryData = geometryData; batches.push(build); } } else if ("fill" === instruction.action || "stroke" === instruction.action) { data = "stroke" === instruction.action, rect = instruction.data.path.shapePath, vertOffset = instruction.data.style, instruction = instruction.data.hole, data && instruction && addShapePathToGeometryData(instruction.shapePath, vertOffset, !0, batches, geometryData), instruction && (rect.shapePrimitives[rect.shapePrimitives.length - 1].holes = instruction.shapePath.shapePrimitives), addShapePathToGeometryData(rect, vertOffset, data, batches, geometryData); } } }; exports.shapeBuilders = shapeBuilders; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$utils$buildContextBatches.js.map