sdfsdfs
This commit is contained in:
5
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.d.ts
generated
vendored
Normal file
5
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ShapeBuildCommand } from '../buildCommands/ShapeBuildCommand';
|
||||
import type { GraphicsContext } from '../GraphicsContext';
|
||||
import type { GpuGraphicsContext } from '../GraphicsContextSystem';
|
||||
export declare const shapeBuilders: Record<string, ShapeBuildCommand>;
|
||||
export declare function buildContextBatches(context: GraphicsContext, gpuContext: GpuGraphicsContext): void;
|
159
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.js
generated
vendored
Normal file
159
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
var Rectangle = require('../../../../maths/shapes/Rectangle.js');
|
||||
var buildUvs = require('../../../../rendering/renderers/shared/geometry/utils/buildUvs.js');
|
||||
var transformVertices = require('../../../../rendering/renderers/shared/geometry/utils/transformVertices.js');
|
||||
var Texture = require('../../../../rendering/renderers/shared/texture/Texture.js');
|
||||
var PoolGroup = require('../../../../utils/pool/PoolGroup.js');
|
||||
var BatchableGraphics = require('../BatchableGraphics.js');
|
||||
var buildCircle = require('../buildCommands/buildCircle.js');
|
||||
var buildLine = require('../buildCommands/buildLine.js');
|
||||
var buildPolygon = require('../buildCommands/buildPolygon.js');
|
||||
var buildRectangle = require('../buildCommands/buildRectangle.js');
|
||||
var buildTriangle = require('../buildCommands/buildTriangle.js');
|
||||
var triangulateWithHoles = require('./triangulateWithHoles.js');
|
||||
|
||||
"use strict";
|
||||
const shapeBuilders = {};
|
||||
Extensions.extensions.handleByMap(Extensions.ExtensionType.ShapeBuilder, shapeBuilders);
|
||||
Extensions.extensions.add(buildRectangle.buildRectangle, buildPolygon.buildPolygon, buildTriangle.buildTriangle, buildCircle.buildCircle, buildCircle.buildEllipse, buildCircle.buildRoundedRectangle);
|
||||
const tempRect = new Rectangle.Rectangle();
|
||||
function buildContextBatches(context, gpuContext) {
|
||||
const { geometryData, batches } = gpuContext;
|
||||
batches.length = 0;
|
||||
geometryData.indices.length = 0;
|
||||
geometryData.vertices.length = 0;
|
||||
geometryData.uvs.length = 0;
|
||||
for (let i = 0; i < context.instructions.length; i++) {
|
||||
const instruction = context.instructions[i];
|
||||
if (instruction.action === "texture") {
|
||||
addTextureToGeometryData(instruction.data, batches, geometryData);
|
||||
} else if (instruction.action === "fill" || instruction.action === "stroke") {
|
||||
const isStroke = instruction.action === "stroke";
|
||||
const shapePath = instruction.data.path.shapePath;
|
||||
const style = instruction.data.style;
|
||||
const hole = instruction.data.hole;
|
||||
if (isStroke && hole) {
|
||||
addShapePathToGeometryData(hole.shapePath, style, null, true, batches, geometryData);
|
||||
}
|
||||
addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData);
|
||||
}
|
||||
}
|
||||
}
|
||||
function addTextureToGeometryData(data, batches, geometryData) {
|
||||
const { vertices, uvs, indices } = geometryData;
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = shapeBuilders.rectangle;
|
||||
const rect = tempRect;
|
||||
const texture = data.image;
|
||||
rect.x = data.dx;
|
||||
rect.y = data.dy;
|
||||
rect.width = data.dw;
|
||||
rect.height = data.dh;
|
||||
const matrix = data.transform;
|
||||
build.build(rect, points);
|
||||
if (matrix) {
|
||||
transformVertices.transformVertices(points, matrix);
|
||||
}
|
||||
build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);
|
||||
const textureUvs = texture.uvs;
|
||||
uvs.push(
|
||||
textureUvs.x0,
|
||||
textureUvs.y0,
|
||||
textureUvs.x1,
|
||||
textureUvs.y1,
|
||||
textureUvs.x3,
|
||||
textureUvs.y3,
|
||||
textureUvs.x2,
|
||||
textureUvs.y2
|
||||
);
|
||||
const graphicsBatch = PoolGroup.BigPool.get(BatchableGraphics.BatchableGraphics);
|
||||
graphicsBatch.indexOffset = indexOffset;
|
||||
graphicsBatch.indexSize = indices.length - indexOffset;
|
||||
graphicsBatch.attributeOffset = vertOffset;
|
||||
graphicsBatch.attributeSize = vertices.length / 2 - vertOffset;
|
||||
graphicsBatch.baseColor = data.style;
|
||||
graphicsBatch.alpha = data.alpha;
|
||||
graphicsBatch.texture = texture;
|
||||
graphicsBatch.geometryData = geometryData;
|
||||
batches.push(graphicsBatch);
|
||||
}
|
||||
function addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData) {
|
||||
const { vertices, uvs, indices } = geometryData;
|
||||
const lastIndex = shapePath.shapePrimitives.length - 1;
|
||||
shapePath.shapePrimitives.forEach(({ shape, transform: matrix }, i) => {
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = shapeBuilders[shape.type];
|
||||
build.build(shape, points);
|
||||
if (matrix) {
|
||||
transformVertices.transformVertices(points, matrix);
|
||||
}
|
||||
if (!isStroke) {
|
||||
if (hole && lastIndex === i) {
|
||||
if (lastIndex !== 0) {
|
||||
console.warn("[Pixi Graphics] only the last shape have be cut out");
|
||||
}
|
||||
const holeIndices = [];
|
||||
const otherPoints = points.slice();
|
||||
const holeArrays = getHoleArrays(hole.shapePath);
|
||||
holeArrays.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);
|
||||
}
|
||||
} else {
|
||||
const close = shape.closePath ?? true;
|
||||
const lineStyle = style;
|
||||
buildLine.buildLine(points, lineStyle, false, close, vertices, 2, vertOffset, indices, indexOffset);
|
||||
}
|
||||
const uvsOffset = uvs.length / 2;
|
||||
const texture = style.texture;
|
||||
if (texture !== Texture.Texture.WHITE) {
|
||||
const textureMatrix = style.matrix;
|
||||
if (textureMatrix) {
|
||||
if (matrix) {
|
||||
textureMatrix.append(matrix.clone().invert());
|
||||
}
|
||||
buildUvs.buildUvs(vertices, 2, vertOffset, uvs, uvsOffset, 2, vertices.length / 2 - vertOffset, textureMatrix);
|
||||
}
|
||||
} else {
|
||||
buildUvs.buildSimpleUvs(uvs, uvsOffset, 2, vertices.length / 2 - vertOffset);
|
||||
}
|
||||
const graphicsBatch = PoolGroup.BigPool.get(BatchableGraphics.BatchableGraphics);
|
||||
graphicsBatch.indexOffset = indexOffset;
|
||||
graphicsBatch.indexSize = indices.length - indexOffset;
|
||||
graphicsBatch.attributeOffset = vertOffset;
|
||||
graphicsBatch.attributeSize = vertices.length / 2 - vertOffset;
|
||||
graphicsBatch.baseColor = style.color;
|
||||
graphicsBatch.alpha = style.alpha;
|
||||
graphicsBatch.texture = texture;
|
||||
graphicsBatch.geometryData = geometryData;
|
||||
batches.push(graphicsBatch);
|
||||
});
|
||||
}
|
||||
function getHoleArrays(shape) {
|
||||
if (!shape)
|
||||
return [];
|
||||
const holePrimitives = shape.shapePrimitives;
|
||||
const holeArrays = [];
|
||||
for (let k = 0; k < holePrimitives.length; k++) {
|
||||
const holePrimitive = holePrimitives[k].shape;
|
||||
const holePoints = [];
|
||||
const holeBuilder = shapeBuilders[holePrimitive.type];
|
||||
holeBuilder.build(holePrimitive, holePoints);
|
||||
holeArrays.push(holePoints);
|
||||
}
|
||||
return holeArrays;
|
||||
}
|
||||
|
||||
exports.buildContextBatches = buildContextBatches;
|
||||
exports.shapeBuilders = shapeBuilders;
|
||||
//# sourceMappingURL=buildContextBatches.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
156
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs
generated
vendored
Normal file
156
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
import { extensions, ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
import { Rectangle } from '../../../../maths/shapes/Rectangle.mjs';
|
||||
import { buildUvs, buildSimpleUvs } from '../../../../rendering/renderers/shared/geometry/utils/buildUvs.mjs';
|
||||
import { transformVertices } from '../../../../rendering/renderers/shared/geometry/utils/transformVertices.mjs';
|
||||
import { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';
|
||||
import { BigPool } from '../../../../utils/pool/PoolGroup.mjs';
|
||||
import { BatchableGraphics } from '../BatchableGraphics.mjs';
|
||||
import { buildCircle, buildEllipse, buildRoundedRectangle } from '../buildCommands/buildCircle.mjs';
|
||||
import { buildLine } from '../buildCommands/buildLine.mjs';
|
||||
import { buildPolygon } from '../buildCommands/buildPolygon.mjs';
|
||||
import { buildRectangle } from '../buildCommands/buildRectangle.mjs';
|
||||
import { buildTriangle } from '../buildCommands/buildTriangle.mjs';
|
||||
import { triangulateWithHoles } from './triangulateWithHoles.mjs';
|
||||
|
||||
"use strict";
|
||||
const shapeBuilders = {};
|
||||
extensions.handleByMap(ExtensionType.ShapeBuilder, shapeBuilders);
|
||||
extensions.add(buildRectangle, buildPolygon, buildTriangle, buildCircle, buildEllipse, buildRoundedRectangle);
|
||||
const tempRect = new Rectangle();
|
||||
function buildContextBatches(context, gpuContext) {
|
||||
const { geometryData, batches } = gpuContext;
|
||||
batches.length = 0;
|
||||
geometryData.indices.length = 0;
|
||||
geometryData.vertices.length = 0;
|
||||
geometryData.uvs.length = 0;
|
||||
for (let i = 0; i < context.instructions.length; i++) {
|
||||
const instruction = context.instructions[i];
|
||||
if (instruction.action === "texture") {
|
||||
addTextureToGeometryData(instruction.data, batches, geometryData);
|
||||
} else if (instruction.action === "fill" || instruction.action === "stroke") {
|
||||
const isStroke = instruction.action === "stroke";
|
||||
const shapePath = instruction.data.path.shapePath;
|
||||
const style = instruction.data.style;
|
||||
const hole = instruction.data.hole;
|
||||
if (isStroke && hole) {
|
||||
addShapePathToGeometryData(hole.shapePath, style, null, true, batches, geometryData);
|
||||
}
|
||||
addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData);
|
||||
}
|
||||
}
|
||||
}
|
||||
function addTextureToGeometryData(data, batches, geometryData) {
|
||||
const { vertices, uvs, indices } = geometryData;
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = shapeBuilders.rectangle;
|
||||
const rect = tempRect;
|
||||
const texture = data.image;
|
||||
rect.x = data.dx;
|
||||
rect.y = data.dy;
|
||||
rect.width = data.dw;
|
||||
rect.height = data.dh;
|
||||
const matrix = data.transform;
|
||||
build.build(rect, points);
|
||||
if (matrix) {
|
||||
transformVertices(points, matrix);
|
||||
}
|
||||
build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);
|
||||
const textureUvs = texture.uvs;
|
||||
uvs.push(
|
||||
textureUvs.x0,
|
||||
textureUvs.y0,
|
||||
textureUvs.x1,
|
||||
textureUvs.y1,
|
||||
textureUvs.x3,
|
||||
textureUvs.y3,
|
||||
textureUvs.x2,
|
||||
textureUvs.y2
|
||||
);
|
||||
const graphicsBatch = BigPool.get(BatchableGraphics);
|
||||
graphicsBatch.indexOffset = indexOffset;
|
||||
graphicsBatch.indexSize = indices.length - indexOffset;
|
||||
graphicsBatch.attributeOffset = vertOffset;
|
||||
graphicsBatch.attributeSize = vertices.length / 2 - vertOffset;
|
||||
graphicsBatch.baseColor = data.style;
|
||||
graphicsBatch.alpha = data.alpha;
|
||||
graphicsBatch.texture = texture;
|
||||
graphicsBatch.geometryData = geometryData;
|
||||
batches.push(graphicsBatch);
|
||||
}
|
||||
function addShapePathToGeometryData(shapePath, style, hole, isStroke, batches, geometryData) {
|
||||
const { vertices, uvs, indices } = geometryData;
|
||||
const lastIndex = shapePath.shapePrimitives.length - 1;
|
||||
shapePath.shapePrimitives.forEach(({ shape, transform: matrix }, i) => {
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = shapeBuilders[shape.type];
|
||||
build.build(shape, points);
|
||||
if (matrix) {
|
||||
transformVertices(points, matrix);
|
||||
}
|
||||
if (!isStroke) {
|
||||
if (hole && lastIndex === i) {
|
||||
if (lastIndex !== 0) {
|
||||
console.warn("[Pixi Graphics] only the last shape have be cut out");
|
||||
}
|
||||
const holeIndices = [];
|
||||
const otherPoints = points.slice();
|
||||
const holeArrays = getHoleArrays(hole.shapePath);
|
||||
holeArrays.forEach((holePoints) => {
|
||||
holeIndices.push(otherPoints.length / 2);
|
||||
otherPoints.push(...holePoints);
|
||||
});
|
||||
triangulateWithHoles(otherPoints, holeIndices, vertices, 2, vertOffset, indices, indexOffset);
|
||||
} else {
|
||||
build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);
|
||||
}
|
||||
} else {
|
||||
const close = shape.closePath ?? true;
|
||||
const lineStyle = style;
|
||||
buildLine(points, lineStyle, false, close, vertices, 2, vertOffset, indices, indexOffset);
|
||||
}
|
||||
const uvsOffset = uvs.length / 2;
|
||||
const texture = style.texture;
|
||||
if (texture !== Texture.WHITE) {
|
||||
const textureMatrix = style.matrix;
|
||||
if (textureMatrix) {
|
||||
if (matrix) {
|
||||
textureMatrix.append(matrix.clone().invert());
|
||||
}
|
||||
buildUvs(vertices, 2, vertOffset, uvs, uvsOffset, 2, vertices.length / 2 - vertOffset, textureMatrix);
|
||||
}
|
||||
} else {
|
||||
buildSimpleUvs(uvs, uvsOffset, 2, vertices.length / 2 - vertOffset);
|
||||
}
|
||||
const graphicsBatch = BigPool.get(BatchableGraphics);
|
||||
graphicsBatch.indexOffset = indexOffset;
|
||||
graphicsBatch.indexSize = indices.length - indexOffset;
|
||||
graphicsBatch.attributeOffset = vertOffset;
|
||||
graphicsBatch.attributeSize = vertices.length / 2 - vertOffset;
|
||||
graphicsBatch.baseColor = style.color;
|
||||
graphicsBatch.alpha = style.alpha;
|
||||
graphicsBatch.texture = texture;
|
||||
graphicsBatch.geometryData = geometryData;
|
||||
batches.push(graphicsBatch);
|
||||
});
|
||||
}
|
||||
function getHoleArrays(shape) {
|
||||
if (!shape)
|
||||
return [];
|
||||
const holePrimitives = shape.shapePrimitives;
|
||||
const holeArrays = [];
|
||||
for (let k = 0; k < holePrimitives.length; k++) {
|
||||
const holePrimitive = holePrimitives[k].shape;
|
||||
const holePoints = [];
|
||||
const holeBuilder = shapeBuilders[holePrimitive.type];
|
||||
holeBuilder.build(holePrimitive, holePoints);
|
||||
holeArrays.push(holePoints);
|
||||
}
|
||||
return holeArrays;
|
||||
}
|
||||
|
||||
export { buildContextBatches, shapeBuilders };
|
||||
//# sourceMappingURL=buildContextBatches.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
30
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.d.ts
generated
vendored
Normal file
30
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { MeshGeometry } from '../../../mesh/shared/MeshGeometry';
|
||||
import { GraphicsPath } from '../path/GraphicsPath';
|
||||
import type { Matrix } from '../../../../maths/matrix/Matrix';
|
||||
export interface GeometryPathOptions {
|
||||
/** the path to build the geometry from */
|
||||
path: GraphicsPath;
|
||||
/** a `Matrix` that can be used to modify the the texture UVs of the the path being built */
|
||||
textureMatrix?: Matrix;
|
||||
/** an optional `MeshGeometry` to write too instead of creating a new one*/
|
||||
out?: MeshGeometry;
|
||||
}
|
||||
/**
|
||||
* When building a mesh, it helps to leverage the simple API we have in `GraphicsPath` as it can often be easier to
|
||||
* to define the geometry in a more human readable way. This function takes a `GraphicsPath` and returns a `MeshGeometry`.
|
||||
* @example
|
||||
* ```ts
|
||||
*
|
||||
* const path = new GraphicsPath()
|
||||
* .drawRect(0, 0, 100, 100)
|
||||
*
|
||||
* const geometry:MeshGeometry = buildGeometryFromPath(path);
|
||||
*
|
||||
* const mesh = new Mesh({geometry});
|
||||
*
|
||||
* ```
|
||||
* You can also pass in a Matrix to transform the uvs as by default you may want to control how they are set up.
|
||||
* @param options - either a `GraphicsPath` or `GeometryPathOptions`
|
||||
* @returns a new `MeshGeometry` instance build from the path
|
||||
*/
|
||||
export declare function buildGeometryFromPath(options: GraphicsPath | GeometryPathOptions): MeshGeometry;
|
70
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.js
generated
vendored
Normal file
70
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
'use strict';
|
||||
|
||||
var buildUvs = require('../../../../rendering/renderers/shared/geometry/utils/buildUvs.js');
|
||||
var transformVertices = require('../../../../rendering/renderers/shared/geometry/utils/transformVertices.js');
|
||||
var MeshGeometry = require('../../../mesh/shared/MeshGeometry.js');
|
||||
var buildCircle = require('../buildCommands/buildCircle.js');
|
||||
var buildPolygon = require('../buildCommands/buildPolygon.js');
|
||||
var buildRectangle = require('../buildCommands/buildRectangle.js');
|
||||
var buildTriangle = require('../buildCommands/buildTriangle.js');
|
||||
var GraphicsPath = require('../path/GraphicsPath.js');
|
||||
|
||||
"use strict";
|
||||
const buildMap = {
|
||||
rectangle: buildRectangle.buildRectangle,
|
||||
polygon: buildPolygon.buildPolygon,
|
||||
triangle: buildTriangle.buildTriangle,
|
||||
circle: buildCircle.buildCircle,
|
||||
ellipse: buildCircle.buildCircle,
|
||||
roundedRectangle: buildCircle.buildCircle
|
||||
};
|
||||
function buildGeometryFromPath(options) {
|
||||
if (options instanceof GraphicsPath.GraphicsPath) {
|
||||
options = {
|
||||
path: options,
|
||||
textureMatrix: null,
|
||||
out: null
|
||||
};
|
||||
}
|
||||
const vertices = [];
|
||||
const uvs = [];
|
||||
const indices = [];
|
||||
const shapePath = options.path.shapePath;
|
||||
const textureMatrix = options.textureMatrix;
|
||||
shapePath.shapePrimitives.forEach(({ shape, transform: matrix }) => {
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = buildMap[shape.type];
|
||||
build.build(shape, points);
|
||||
if (matrix) {
|
||||
transformVertices.transformVertices(points, matrix);
|
||||
}
|
||||
build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);
|
||||
const uvsOffset = uvs.length / 2;
|
||||
if (textureMatrix) {
|
||||
if (matrix) {
|
||||
textureMatrix.append(matrix.clone().invert());
|
||||
}
|
||||
buildUvs.buildUvs(vertices, 2, vertOffset, uvs, uvsOffset, 2, vertices.length / 2 - vertOffset, textureMatrix);
|
||||
} else {
|
||||
buildUvs.buildSimpleUvs(uvs, uvsOffset, 2, vertices.length / 2 - vertOffset);
|
||||
}
|
||||
});
|
||||
const out = options.out;
|
||||
if (out) {
|
||||
out.positions = new Float32Array(vertices);
|
||||
out.uvs = new Float32Array(uvs);
|
||||
out.indices = new Uint32Array(indices);
|
||||
return out;
|
||||
}
|
||||
const geometry = new MeshGeometry.MeshGeometry({
|
||||
positions: new Float32Array(vertices),
|
||||
uvs: new Float32Array(uvs),
|
||||
indices: new Uint32Array(indices)
|
||||
});
|
||||
return geometry;
|
||||
}
|
||||
|
||||
exports.buildGeometryFromPath = buildGeometryFromPath;
|
||||
//# sourceMappingURL=buildGeometryFromPath.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
68
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.mjs
generated
vendored
Normal file
68
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.mjs
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import { buildUvs, buildSimpleUvs } from '../../../../rendering/renderers/shared/geometry/utils/buildUvs.mjs';
|
||||
import { transformVertices } from '../../../../rendering/renderers/shared/geometry/utils/transformVertices.mjs';
|
||||
import { MeshGeometry } from '../../../mesh/shared/MeshGeometry.mjs';
|
||||
import { buildCircle } from '../buildCommands/buildCircle.mjs';
|
||||
import { buildPolygon } from '../buildCommands/buildPolygon.mjs';
|
||||
import { buildRectangle } from '../buildCommands/buildRectangle.mjs';
|
||||
import { buildTriangle } from '../buildCommands/buildTriangle.mjs';
|
||||
import { GraphicsPath } from '../path/GraphicsPath.mjs';
|
||||
|
||||
"use strict";
|
||||
const buildMap = {
|
||||
rectangle: buildRectangle,
|
||||
polygon: buildPolygon,
|
||||
triangle: buildTriangle,
|
||||
circle: buildCircle,
|
||||
ellipse: buildCircle,
|
||||
roundedRectangle: buildCircle
|
||||
};
|
||||
function buildGeometryFromPath(options) {
|
||||
if (options instanceof GraphicsPath) {
|
||||
options = {
|
||||
path: options,
|
||||
textureMatrix: null,
|
||||
out: null
|
||||
};
|
||||
}
|
||||
const vertices = [];
|
||||
const uvs = [];
|
||||
const indices = [];
|
||||
const shapePath = options.path.shapePath;
|
||||
const textureMatrix = options.textureMatrix;
|
||||
shapePath.shapePrimitives.forEach(({ shape, transform: matrix }) => {
|
||||
const indexOffset = indices.length;
|
||||
const vertOffset = vertices.length / 2;
|
||||
const points = [];
|
||||
const build = buildMap[shape.type];
|
||||
build.build(shape, points);
|
||||
if (matrix) {
|
||||
transformVertices(points, matrix);
|
||||
}
|
||||
build.triangulate(points, vertices, 2, vertOffset, indices, indexOffset);
|
||||
const uvsOffset = uvs.length / 2;
|
||||
if (textureMatrix) {
|
||||
if (matrix) {
|
||||
textureMatrix.append(matrix.clone().invert());
|
||||
}
|
||||
buildUvs(vertices, 2, vertOffset, uvs, uvsOffset, 2, vertices.length / 2 - vertOffset, textureMatrix);
|
||||
} else {
|
||||
buildSimpleUvs(uvs, uvsOffset, 2, vertices.length / 2 - vertOffset);
|
||||
}
|
||||
});
|
||||
const out = options.out;
|
||||
if (out) {
|
||||
out.positions = new Float32Array(vertices);
|
||||
out.uvs = new Float32Array(uvs);
|
||||
out.indices = new Uint32Array(indices);
|
||||
return out;
|
||||
}
|
||||
const geometry = new MeshGeometry({
|
||||
positions: new Float32Array(vertices),
|
||||
uvs: new Float32Array(uvs),
|
||||
indices: new Uint32Array(indices)
|
||||
});
|
||||
return geometry;
|
||||
}
|
||||
|
||||
export { buildGeometryFromPath };
|
||||
//# sourceMappingURL=buildGeometryFromPath.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.d.ts
generated
vendored
Normal file
18
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { ConvertedFillStyle, ConvertedStrokeStyle, FillInput, StrokeInput } from '../FillTypes';
|
||||
/**
|
||||
* Converts a value to a fill style, we do this as PixiJS has a number of ways to define a fill style
|
||||
* They can be a direct color, a texture, a gradient, or an object with these values in them
|
||||
* This function will take any of these input types and convert them into a single object
|
||||
* that PixiJS can understand and use internally.
|
||||
* @param value - The value to convert to a fill style
|
||||
* @param defaultStyle - The default fill style to use
|
||||
* @private
|
||||
*/
|
||||
export declare function toFillStyle<T extends FillInput>(value: T, defaultStyle: ConvertedFillStyle): ConvertedFillStyle;
|
||||
/**
|
||||
* Converts a value to a stroke style, similar to `toFillStyle` but for strokes
|
||||
* @param value - The value to convert to a stroke style
|
||||
* @param defaultStyle - The default stroke style to use
|
||||
* @private
|
||||
*/
|
||||
export declare function toStrokeStyle(value: StrokeInput, defaultStyle: ConvertedStrokeStyle): ConvertedStrokeStyle;
|
99
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.js
generated
vendored
Normal file
99
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
var Color = require('../../../../color/Color.js');
|
||||
var Matrix = require('../../../../maths/matrix/Matrix.js');
|
||||
var Texture = require('../../../../rendering/renderers/shared/texture/Texture.js');
|
||||
var FillGradient = require('../fill/FillGradient.js');
|
||||
var FillPattern = require('../fill/FillPattern.js');
|
||||
|
||||
"use strict";
|
||||
function isColorLike(value) {
|
||||
return Color.Color.isColorLike(value);
|
||||
}
|
||||
function isFillPattern(value) {
|
||||
return value instanceof FillPattern.FillPattern;
|
||||
}
|
||||
function isFillGradient(value) {
|
||||
return value instanceof FillGradient.FillGradient;
|
||||
}
|
||||
function handleColorLike(fill, value, defaultStyle) {
|
||||
const temp = Color.Color.shared.setValue(value ?? 0);
|
||||
fill.color = temp.toNumber();
|
||||
fill.alpha = temp.alpha === 1 ? defaultStyle.alpha : temp.alpha;
|
||||
fill.texture = Texture.Texture.WHITE;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillPattern(fill, value, defaultStyle) {
|
||||
fill.fill = value;
|
||||
fill.color = 16777215;
|
||||
fill.texture = value.texture;
|
||||
fill.matrix = value.transform;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillGradient(fill, value, defaultStyle) {
|
||||
value.buildLinearGradient();
|
||||
fill.fill = value;
|
||||
fill.color = 16777215;
|
||||
fill.texture = value.texture;
|
||||
fill.matrix = value.transform;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillObject(value, defaultStyle) {
|
||||
const style = { ...defaultStyle, ...value };
|
||||
if (style.texture) {
|
||||
if (style.texture !== Texture.Texture.WHITE) {
|
||||
const m = style.matrix?.invert() || new Matrix.Matrix();
|
||||
m.translate(style.texture.frame.x, style.texture.frame.y);
|
||||
m.scale(1 / style.texture.source.width, 1 / style.texture.source.height);
|
||||
style.matrix = m;
|
||||
}
|
||||
const sourceStyle = style.texture.source.style;
|
||||
if (sourceStyle.addressMode === "clamp-to-edge") {
|
||||
sourceStyle.addressMode = "repeat";
|
||||
sourceStyle.update();
|
||||
}
|
||||
}
|
||||
const color = Color.Color.shared.setValue(style.color);
|
||||
style.alpha *= color.alpha;
|
||||
style.color = color.toNumber();
|
||||
style.matrix = style.matrix ? style.matrix.clone() : null;
|
||||
return style;
|
||||
}
|
||||
function toFillStyle(value, defaultStyle) {
|
||||
if (value === void 0 || value === null) {
|
||||
return null;
|
||||
}
|
||||
const fill = {};
|
||||
const objectStyle = value;
|
||||
if (isColorLike(value)) {
|
||||
return handleColorLike(fill, value, defaultStyle);
|
||||
} else if (isFillPattern(value)) {
|
||||
return handleFillPattern(fill, value, defaultStyle);
|
||||
} else if (isFillGradient(value)) {
|
||||
return handleFillGradient(fill, value, defaultStyle);
|
||||
} else if (objectStyle.fill && isFillPattern(objectStyle.fill)) {
|
||||
return handleFillPattern(objectStyle, objectStyle.fill, defaultStyle);
|
||||
} else if (objectStyle.fill && isFillGradient(objectStyle.fill)) {
|
||||
return handleFillGradient(objectStyle, objectStyle.fill, defaultStyle);
|
||||
}
|
||||
return handleFillObject(objectStyle, defaultStyle);
|
||||
}
|
||||
function toStrokeStyle(value, defaultStyle) {
|
||||
const { width, alignment, miterLimit, cap, join, ...rest } = defaultStyle;
|
||||
const fill = toFillStyle(value, rest);
|
||||
if (!fill) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
alignment,
|
||||
miterLimit,
|
||||
cap,
|
||||
join,
|
||||
...fill
|
||||
};
|
||||
}
|
||||
|
||||
exports.toFillStyle = toFillStyle;
|
||||
exports.toStrokeStyle = toStrokeStyle;
|
||||
//# sourceMappingURL=convertFillInputToFillStyle.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
96
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.mjs
generated
vendored
Normal file
96
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.mjs
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { Color } from '../../../../color/Color.mjs';
|
||||
import { Matrix } from '../../../../maths/matrix/Matrix.mjs';
|
||||
import { Texture } from '../../../../rendering/renderers/shared/texture/Texture.mjs';
|
||||
import { FillGradient } from '../fill/FillGradient.mjs';
|
||||
import { FillPattern } from '../fill/FillPattern.mjs';
|
||||
|
||||
"use strict";
|
||||
function isColorLike(value) {
|
||||
return Color.isColorLike(value);
|
||||
}
|
||||
function isFillPattern(value) {
|
||||
return value instanceof FillPattern;
|
||||
}
|
||||
function isFillGradient(value) {
|
||||
return value instanceof FillGradient;
|
||||
}
|
||||
function handleColorLike(fill, value, defaultStyle) {
|
||||
const temp = Color.shared.setValue(value ?? 0);
|
||||
fill.color = temp.toNumber();
|
||||
fill.alpha = temp.alpha === 1 ? defaultStyle.alpha : temp.alpha;
|
||||
fill.texture = Texture.WHITE;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillPattern(fill, value, defaultStyle) {
|
||||
fill.fill = value;
|
||||
fill.color = 16777215;
|
||||
fill.texture = value.texture;
|
||||
fill.matrix = value.transform;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillGradient(fill, value, defaultStyle) {
|
||||
value.buildLinearGradient();
|
||||
fill.fill = value;
|
||||
fill.color = 16777215;
|
||||
fill.texture = value.texture;
|
||||
fill.matrix = value.transform;
|
||||
return { ...defaultStyle, ...fill };
|
||||
}
|
||||
function handleFillObject(value, defaultStyle) {
|
||||
const style = { ...defaultStyle, ...value };
|
||||
if (style.texture) {
|
||||
if (style.texture !== Texture.WHITE) {
|
||||
const m = style.matrix?.invert() || new Matrix();
|
||||
m.translate(style.texture.frame.x, style.texture.frame.y);
|
||||
m.scale(1 / style.texture.source.width, 1 / style.texture.source.height);
|
||||
style.matrix = m;
|
||||
}
|
||||
const sourceStyle = style.texture.source.style;
|
||||
if (sourceStyle.addressMode === "clamp-to-edge") {
|
||||
sourceStyle.addressMode = "repeat";
|
||||
sourceStyle.update();
|
||||
}
|
||||
}
|
||||
const color = Color.shared.setValue(style.color);
|
||||
style.alpha *= color.alpha;
|
||||
style.color = color.toNumber();
|
||||
style.matrix = style.matrix ? style.matrix.clone() : null;
|
||||
return style;
|
||||
}
|
||||
function toFillStyle(value, defaultStyle) {
|
||||
if (value === void 0 || value === null) {
|
||||
return null;
|
||||
}
|
||||
const fill = {};
|
||||
const objectStyle = value;
|
||||
if (isColorLike(value)) {
|
||||
return handleColorLike(fill, value, defaultStyle);
|
||||
} else if (isFillPattern(value)) {
|
||||
return handleFillPattern(fill, value, defaultStyle);
|
||||
} else if (isFillGradient(value)) {
|
||||
return handleFillGradient(fill, value, defaultStyle);
|
||||
} else if (objectStyle.fill && isFillPattern(objectStyle.fill)) {
|
||||
return handleFillPattern(objectStyle, objectStyle.fill, defaultStyle);
|
||||
} else if (objectStyle.fill && isFillGradient(objectStyle.fill)) {
|
||||
return handleFillGradient(objectStyle, objectStyle.fill, defaultStyle);
|
||||
}
|
||||
return handleFillObject(objectStyle, defaultStyle);
|
||||
}
|
||||
function toStrokeStyle(value, defaultStyle) {
|
||||
const { width, alignment, miterLimit, cap, join, ...rest } = defaultStyle;
|
||||
const fill = toFillStyle(value, rest);
|
||||
if (!fill) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
width,
|
||||
alignment,
|
||||
miterLimit,
|
||||
cap,
|
||||
join,
|
||||
...fill
|
||||
};
|
||||
}
|
||||
|
||||
export { toFillStyle, toStrokeStyle };
|
||||
//# sourceMappingURL=convertFillInputToFillStyle.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/convertFillInputToFillStyle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function getOrientationOfPoints(points: number[]): number;
|
24
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.js
generated
vendored
Normal file
24
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function getOrientationOfPoints(points) {
|
||||
const m = points.length;
|
||||
if (m < 6) {
|
||||
return 1;
|
||||
}
|
||||
let area = 0;
|
||||
for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
|
||||
const x2 = points[i];
|
||||
const y2 = points[i + 1];
|
||||
area += (x2 - x1) * (y2 + y1);
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
if (area < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
exports.getOrientationOfPoints = getOrientationOfPoints;
|
||||
//# sourceMappingURL=getOrientationOfPoints.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getOrientationOfPoints.js","sources":["../../../../../src/scene/graphics/shared/utils/getOrientationOfPoints.ts"],"sourcesContent":["export function getOrientationOfPoints(points: number[]): number\n{\n const m = points.length;\n\n if (m < 6)\n {\n return 1;\n }\n\n let area = 0;\n\n for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2)\n {\n const x2 = points[i];\n const y2 = points[i + 1];\n\n area += (x2 - x1) * (y2 + y1);\n\n x1 = x2;\n y1 = y2;\n }\n\n if (area < 0)\n {\n return -1;\n }\n\n return 1;\n}\n"],"names":[],"mappings":";;;AAAO,SAAS,uBAAuB,MACvC,EAAA;AACI,EAAA,MAAM,IAAI,MAAO,CAAA,MAAA,CAAA;AAEjB,EAAA,IAAI,IAAI,CACR,EAAA;AACI,IAAO,OAAA,CAAA,CAAA;AAAA,GACX;AAEA,EAAA,IAAI,IAAO,GAAA,CAAA,CAAA;AAEX,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,EAAK,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG,EAAK,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG,CAAI,GAAA,CAAA,EAAG,KAAK,CACpE,EAAA;AACI,IAAM,MAAA,EAAA,GAAK,OAAO,CAAC,CAAA,CAAA;AACnB,IAAM,MAAA,EAAA,GAAK,MAAO,CAAA,CAAA,GAAI,CAAC,CAAA,CAAA;AAEvB,IAAS,IAAA,IAAA,CAAA,EAAA,GAAK,OAAO,EAAK,GAAA,EAAA,CAAA,CAAA;AAE1B,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,OAAO,CACX,EAAA;AACI,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACX;AAEA,EAAO,OAAA,CAAA,CAAA;AACX;;;;"}
|
22
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.mjs
generated
vendored
Normal file
22
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.mjs
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
function getOrientationOfPoints(points) {
|
||||
const m = points.length;
|
||||
if (m < 6) {
|
||||
return 1;
|
||||
}
|
||||
let area = 0;
|
||||
for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
|
||||
const x2 = points[i];
|
||||
const y2 = points[i + 1];
|
||||
area += (x2 - x1) * (y2 + y1);
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
if (area < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
export { getOrientationOfPoints };
|
||||
//# sourceMappingURL=getOrientationOfPoints.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/getOrientationOfPoints.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getOrientationOfPoints.mjs","sources":["../../../../../src/scene/graphics/shared/utils/getOrientationOfPoints.ts"],"sourcesContent":["export function getOrientationOfPoints(points: number[]): number\n{\n const m = points.length;\n\n if (m < 6)\n {\n return 1;\n }\n\n let area = 0;\n\n for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2)\n {\n const x2 = points[i];\n const y2 = points[i + 1];\n\n area += (x2 - x1) * (y2 + y1);\n\n x1 = x2;\n y1 = y2;\n }\n\n if (area < 0)\n {\n return -1;\n }\n\n return 1;\n}\n"],"names":[],"mappings":";AAAO,SAAS,uBAAuB,MACvC,EAAA;AACI,EAAA,MAAM,IAAI,MAAO,CAAA,MAAA,CAAA;AAEjB,EAAA,IAAI,IAAI,CACR,EAAA;AACI,IAAO,OAAA,CAAA,CAAA;AAAA,GACX;AAEA,EAAA,IAAI,IAAO,GAAA,CAAA,CAAA;AAEX,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,EAAK,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG,EAAK,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG,CAAI,GAAA,CAAA,EAAG,KAAK,CACpE,EAAA;AACI,IAAM,MAAA,EAAA,GAAK,OAAO,CAAC,CAAA,CAAA;AACnB,IAAM,MAAA,EAAA,GAAK,MAAO,CAAA,CAAA,GAAI,CAAC,CAAA,CAAA;AAEvB,IAAS,IAAA,IAAA,CAAA,EAAA,GAAK,OAAO,EAAK,GAAA,EAAA,CAAA,CAAA;AAE1B,IAAK,EAAA,GAAA,EAAA,CAAA;AACL,IAAK,EAAA,GAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,OAAO,CACX,EAAA;AACI,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACX;AAEA,EAAO,OAAA,CAAA,CAAA;AACX;;;;"}
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function triangulateWithHoles(points: number[], holes: number[], vertices: number[], verticesStride: number, verticesOffset: number, indices: number[], indicesOffset: number): void;
|
25
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.js
generated
vendored
Normal file
25
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var earcut = require('earcut');
|
||||
|
||||
"use strict";
|
||||
function triangulateWithHoles(points, holes, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
const triangles = earcut(points, holes, 2);
|
||||
if (!triangles) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < triangles.length; i += 3) {
|
||||
indices[indicesOffset++] = triangles[i] + verticesOffset;
|
||||
indices[indicesOffset++] = triangles[i + 1] + verticesOffset;
|
||||
indices[indicesOffset++] = triangles[i + 2] + verticesOffset;
|
||||
}
|
||||
let index = verticesOffset * verticesStride;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
vertices[index] = points[i];
|
||||
vertices[index + 1] = points[i + 1];
|
||||
index += verticesStride;
|
||||
}
|
||||
}
|
||||
|
||||
exports.triangulateWithHoles = triangulateWithHoles;
|
||||
//# sourceMappingURL=triangulateWithHoles.js.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"triangulateWithHoles.js","sources":["../../../../../src/scene/graphics/shared/utils/triangulateWithHoles.ts"],"sourcesContent":["import { default as earcut } from 'earcut';\n\nexport function triangulateWithHoles(\n points: number[],\n holes: number[],\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n)\n{\n const triangles = earcut(points, holes, 2);\n\n if (!triangles)\n {\n return;\n }\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices[indicesOffset++] = (triangles[i] + verticesOffset);\n indices[indicesOffset++] = (triangles[i + 1] + verticesOffset);\n indices[indicesOffset++] = (triangles[i + 2] + verticesOffset);\n }\n\n let index = verticesOffset * verticesStride;\n\n for (let i = 0; i < points.length; i += 2)\n {\n vertices[index] = points[i];\n vertices[index + 1] = points[i + 1];\n\n index += verticesStride;\n }\n}\n\n"],"names":[],"mappings":";;;;;AAEO,SAAS,qBACZ,MACA,EAAA,KAAA,EACA,UACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,EAAA,MAAM,SAAY,GAAA,MAAA,CAAO,MAAQ,EAAA,KAAA,EAAO,CAAC,CAAA,CAAA;AAEzC,EAAA,IAAI,CAAC,SACL,EAAA;AACI,IAAA,OAAA;AAAA,GACJ;AAEA,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,SAAU,CAAA,MAAA,EAAQ,KAAK,CAC3C,EAAA;AACI,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAC,CAAI,GAAA,cAAA,CAAA;AAC3C,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,cAAA,CAAA;AAC/C,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,cAAA,CAAA;AAAA,GACnD;AAEA,EAAA,IAAI,QAAQ,cAAiB,GAAA,cAAA,CAAA;AAE7B,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,MAAO,CAAA,MAAA,EAAQ,KAAK,CACxC,EAAA;AACI,IAAS,QAAA,CAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC1B,IAAA,QAAA,CAAS,KAAQ,GAAA,CAAC,CAAI,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,CAAA;AAElC,IAAS,KAAA,IAAA,cAAA,CAAA;AAAA,GACb;AACJ;;;;"}
|
23
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.mjs
generated
vendored
Normal file
23
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.mjs
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import earcut from 'earcut';
|
||||
|
||||
"use strict";
|
||||
function triangulateWithHoles(points, holes, vertices, verticesStride, verticesOffset, indices, indicesOffset) {
|
||||
const triangles = earcut(points, holes, 2);
|
||||
if (!triangles) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < triangles.length; i += 3) {
|
||||
indices[indicesOffset++] = triangles[i] + verticesOffset;
|
||||
indices[indicesOffset++] = triangles[i + 1] + verticesOffset;
|
||||
indices[indicesOffset++] = triangles[i + 2] + verticesOffset;
|
||||
}
|
||||
let index = verticesOffset * verticesStride;
|
||||
for (let i = 0; i < points.length; i += 2) {
|
||||
vertices[index] = points[i];
|
||||
vertices[index + 1] = points[i + 1];
|
||||
index += verticesStride;
|
||||
}
|
||||
}
|
||||
|
||||
export { triangulateWithHoles };
|
||||
//# sourceMappingURL=triangulateWithHoles.mjs.map
|
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/graphics/shared/utils/triangulateWithHoles.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"triangulateWithHoles.mjs","sources":["../../../../../src/scene/graphics/shared/utils/triangulateWithHoles.ts"],"sourcesContent":["import { default as earcut } from 'earcut';\n\nexport function triangulateWithHoles(\n points: number[],\n holes: number[],\n vertices: number[],\n verticesStride: number,\n verticesOffset: number,\n\n indices: number[],\n indicesOffset: number\n)\n{\n const triangles = earcut(points, holes, 2);\n\n if (!triangles)\n {\n return;\n }\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices[indicesOffset++] = (triangles[i] + verticesOffset);\n indices[indicesOffset++] = (triangles[i + 1] + verticesOffset);\n indices[indicesOffset++] = (triangles[i + 2] + verticesOffset);\n }\n\n let index = verticesOffset * verticesStride;\n\n for (let i = 0; i < points.length; i += 2)\n {\n vertices[index] = points[i];\n vertices[index + 1] = points[i + 1];\n\n index += verticesStride;\n }\n}\n\n"],"names":[],"mappings":";;;AAEO,SAAS,qBACZ,MACA,EAAA,KAAA,EACA,UACA,cACA,EAAA,cAAA,EAEA,SACA,aAEJ,EAAA;AACI,EAAA,MAAM,SAAY,GAAA,MAAA,CAAO,MAAQ,EAAA,KAAA,EAAO,CAAC,CAAA,CAAA;AAEzC,EAAA,IAAI,CAAC,SACL,EAAA;AACI,IAAA,OAAA;AAAA,GACJ;AAEA,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,SAAU,CAAA,MAAA,EAAQ,KAAK,CAC3C,EAAA;AACI,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAC,CAAI,GAAA,cAAA,CAAA;AAC3C,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,cAAA,CAAA;AAC/C,IAAA,OAAA,CAAQ,aAAe,EAAA,CAAA,GAAK,SAAU,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,cAAA,CAAA;AAAA,GACnD;AAEA,EAAA,IAAI,QAAQ,cAAiB,GAAA,cAAA,CAAA;AAE7B,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,MAAO,CAAA,MAAA,EAAQ,KAAK,CACxC,EAAA;AACI,IAAS,QAAA,CAAA,KAAK,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA,CAAA;AAC1B,IAAA,QAAA,CAAS,KAAQ,GAAA,CAAC,CAAI,GAAA,MAAA,CAAO,IAAI,CAAC,CAAA,CAAA;AAElC,IAAS,KAAA,IAAA,cAAA,CAAA;AAAA,GACb;AACJ;;;;"}
|
Reference in New Issue
Block a user