sdfsdfs
This commit is contained in:
10
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.d.ts
generated
vendored
Normal file
10
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { ArrayFixed } from '../../../utils/types';
|
||||
import type { PlaneGeometry } from '../../mesh-plane/PlaneGeometry';
|
||||
/**
|
||||
* Apply a projective transformation to a plane geometry
|
||||
* @param width - The width of the plane
|
||||
* @param height - The height of the plane
|
||||
* @param geometry - The plane geometry to apply the transformation to
|
||||
* @param transformationMatrix - The transformation matrix to apply
|
||||
*/
|
||||
export declare function applyProjectiveTransformationToPlane(width: number, height: number, geometry: PlaneGeometry, transformationMatrix: ArrayFixed<number, 9>): void;
|
34
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.js
generated
vendored
Normal file
34
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function applyProjectiveTransformationToPlane(width, height, geometry, transformationMatrix) {
|
||||
const buffer = geometry.buffers[0];
|
||||
const vertices = buffer.data;
|
||||
const { verticesX, verticesY } = geometry;
|
||||
const sizeX = width / (verticesX - 1);
|
||||
const sizeY = height / (verticesY - 1);
|
||||
let index = 0;
|
||||
const a00 = transformationMatrix[0];
|
||||
const a01 = transformationMatrix[1];
|
||||
const a02 = transformationMatrix[2];
|
||||
const a10 = transformationMatrix[3];
|
||||
const a11 = transformationMatrix[4];
|
||||
const a12 = transformationMatrix[5];
|
||||
const a20 = transformationMatrix[6];
|
||||
const a21 = transformationMatrix[7];
|
||||
const a22 = transformationMatrix[8];
|
||||
for (let i = 0; i < vertices.length; i += 2) {
|
||||
const x = index % verticesX * sizeX;
|
||||
const y = (index / verticesX | 0) * sizeY;
|
||||
const newX = a00 * x + a01 * y + a02;
|
||||
const newY = a10 * x + a11 * y + a12;
|
||||
const w = a20 * x + a21 * y + a22;
|
||||
vertices[i] = newX / w;
|
||||
vertices[i + 1] = newY / w;
|
||||
index++;
|
||||
}
|
||||
buffer.update();
|
||||
}
|
||||
|
||||
exports.applyProjectiveTransformationToPlane = applyProjectiveTransformationToPlane;
|
||||
//# sourceMappingURL=applyProjectiveTransformationToPlane.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"applyProjectiveTransformationToPlane.js","sources":["../../../../src/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.ts"],"sourcesContent":["import type { ArrayFixed } from '../../../utils/types';\nimport type { PlaneGeometry } from '../../mesh-plane/PlaneGeometry';\n\n/**\n * Apply a projective transformation to a plane geometry\n * @param width - The width of the plane\n * @param height - The height of the plane\n * @param geometry - The plane geometry to apply the transformation to\n * @param transformationMatrix - The transformation matrix to apply\n */\nexport function applyProjectiveTransformationToPlane(\n width: number,\n height: number,\n geometry: PlaneGeometry,\n transformationMatrix: ArrayFixed<number, 9>\n)\n{\n const buffer = geometry.buffers[0];\n\n // Access the vertices of the mesh\n const vertices = buffer.data;\n\n const { verticesX, verticesY } = geometry;\n\n const sizeX = (width) / (verticesX - 1);\n const sizeY = (height) / (verticesY - 1);\n\n let index = 0;\n\n const a00 = transformationMatrix[0];\n const a01 = transformationMatrix[1];\n const a02 = transformationMatrix[2];\n const a10 = transformationMatrix[3];\n const a11 = transformationMatrix[4];\n const a12 = transformationMatrix[5];\n const a20 = transformationMatrix[6];\n const a21 = transformationMatrix[7];\n const a22 = transformationMatrix[8];\n\n // Apply the transformation to each vertex\n for (let i = 0; i < vertices.length; i += 2)\n {\n const x = (index % verticesX) * sizeX;\n const y = ((index / verticesX) | 0) * sizeY;\n\n const newX = (a00 * x) + (a01 * y) + a02;\n const newY = (a10 * x) + (a11 * y) + a12;\n const w = (a20 * x) + (a21 * y) + a22;\n\n vertices[i] = newX / w;\n vertices[i + 1] = newY / w;\n\n index++;\n }\n\n // Update the mesh geometry to reflect the changes\n buffer.update();\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,oCACZ,CAAA,KAAA,EACA,MACA,EAAA,QAAA,EACA,oBAEJ,EAAA;AACI,EAAM,MAAA,MAAA,GAAS,QAAS,CAAA,OAAA,CAAQ,CAAC,CAAA,CAAA;AAGjC,EAAA,MAAM,WAAW,MAAO,CAAA,IAAA,CAAA;AAExB,EAAM,MAAA,EAAE,SAAW,EAAA,SAAA,EAAc,GAAA,QAAA,CAAA;AAEjC,EAAM,MAAA,KAAA,GAAS,SAAU,SAAY,GAAA,CAAA,CAAA,CAAA;AACrC,EAAM,MAAA,KAAA,GAAS,UAAW,SAAY,GAAA,CAAA,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAGlC,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,QAAS,CAAA,MAAA,EAAQ,KAAK,CAC1C,EAAA;AACI,IAAM,MAAA,CAAA,GAAK,QAAQ,SAAa,GAAA,KAAA,CAAA;AAChC,IAAM,MAAA,CAAA,GAAA,CAAM,KAAQ,GAAA,SAAA,GAAa,CAAK,IAAA,KAAA,CAAA;AAEtC,IAAA,MAAM,IAAQ,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AACrC,IAAA,MAAM,IAAQ,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AACrC,IAAA,MAAM,CAAK,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AAElC,IAAS,QAAA,CAAA,CAAC,IAAI,IAAO,GAAA,CAAA,CAAA;AACrB,IAAS,QAAA,CAAA,CAAA,GAAI,CAAC,CAAA,GAAI,IAAO,GAAA,CAAA,CAAA;AAEzB,IAAA,KAAA,EAAA,CAAA;AAAA,GACJ;AAGA,EAAA,MAAA,CAAO,MAAO,EAAA,CAAA;AAClB;;;;"}
|
32
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.mjs
generated
vendored
Normal file
32
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.mjs
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
function applyProjectiveTransformationToPlane(width, height, geometry, transformationMatrix) {
|
||||
const buffer = geometry.buffers[0];
|
||||
const vertices = buffer.data;
|
||||
const { verticesX, verticesY } = geometry;
|
||||
const sizeX = width / (verticesX - 1);
|
||||
const sizeY = height / (verticesY - 1);
|
||||
let index = 0;
|
||||
const a00 = transformationMatrix[0];
|
||||
const a01 = transformationMatrix[1];
|
||||
const a02 = transformationMatrix[2];
|
||||
const a10 = transformationMatrix[3];
|
||||
const a11 = transformationMatrix[4];
|
||||
const a12 = transformationMatrix[5];
|
||||
const a20 = transformationMatrix[6];
|
||||
const a21 = transformationMatrix[7];
|
||||
const a22 = transformationMatrix[8];
|
||||
for (let i = 0; i < vertices.length; i += 2) {
|
||||
const x = index % verticesX * sizeX;
|
||||
const y = (index / verticesX | 0) * sizeY;
|
||||
const newX = a00 * x + a01 * y + a02;
|
||||
const newY = a10 * x + a11 * y + a12;
|
||||
const w = a20 * x + a21 * y + a22;
|
||||
vertices[i] = newX / w;
|
||||
vertices[i + 1] = newY / w;
|
||||
index++;
|
||||
}
|
||||
buffer.update();
|
||||
}
|
||||
|
||||
export { applyProjectiveTransformationToPlane };
|
||||
//# sourceMappingURL=applyProjectiveTransformationToPlane.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"applyProjectiveTransformationToPlane.mjs","sources":["../../../../src/scene/mesh-perspective/utils/applyProjectiveTransformationToPlane.ts"],"sourcesContent":["import type { ArrayFixed } from '../../../utils/types';\nimport type { PlaneGeometry } from '../../mesh-plane/PlaneGeometry';\n\n/**\n * Apply a projective transformation to a plane geometry\n * @param width - The width of the plane\n * @param height - The height of the plane\n * @param geometry - The plane geometry to apply the transformation to\n * @param transformationMatrix - The transformation matrix to apply\n */\nexport function applyProjectiveTransformationToPlane(\n width: number,\n height: number,\n geometry: PlaneGeometry,\n transformationMatrix: ArrayFixed<number, 9>\n)\n{\n const buffer = geometry.buffers[0];\n\n // Access the vertices of the mesh\n const vertices = buffer.data;\n\n const { verticesX, verticesY } = geometry;\n\n const sizeX = (width) / (verticesX - 1);\n const sizeY = (height) / (verticesY - 1);\n\n let index = 0;\n\n const a00 = transformationMatrix[0];\n const a01 = transformationMatrix[1];\n const a02 = transformationMatrix[2];\n const a10 = transformationMatrix[3];\n const a11 = transformationMatrix[4];\n const a12 = transformationMatrix[5];\n const a20 = transformationMatrix[6];\n const a21 = transformationMatrix[7];\n const a22 = transformationMatrix[8];\n\n // Apply the transformation to each vertex\n for (let i = 0; i < vertices.length; i += 2)\n {\n const x = (index % verticesX) * sizeX;\n const y = ((index / verticesX) | 0) * sizeY;\n\n const newX = (a00 * x) + (a01 * y) + a02;\n const newY = (a10 * x) + (a11 * y) + a12;\n const w = (a20 * x) + (a21 * y) + a22;\n\n vertices[i] = newX / w;\n vertices[i + 1] = newY / w;\n\n index++;\n }\n\n // Update the mesh geometry to reflect the changes\n buffer.update();\n}\n"],"names":[],"mappings":";AAUO,SAAS,oCACZ,CAAA,KAAA,EACA,MACA,EAAA,QAAA,EACA,oBAEJ,EAAA;AACI,EAAM,MAAA,MAAA,GAAS,QAAS,CAAA,OAAA,CAAQ,CAAC,CAAA,CAAA;AAGjC,EAAA,MAAM,WAAW,MAAO,CAAA,IAAA,CAAA;AAExB,EAAM,MAAA,EAAE,SAAW,EAAA,SAAA,EAAc,GAAA,QAAA,CAAA;AAEjC,EAAM,MAAA,KAAA,GAAS,SAAU,SAAY,GAAA,CAAA,CAAA,CAAA;AACrC,EAAM,MAAA,KAAA,GAAS,UAAW,SAAY,GAAA,CAAA,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AAEZ,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAClC,EAAM,MAAA,GAAA,GAAM,qBAAqB,CAAC,CAAA,CAAA;AAGlC,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,QAAS,CAAA,MAAA,EAAQ,KAAK,CAC1C,EAAA;AACI,IAAM,MAAA,CAAA,GAAK,QAAQ,SAAa,GAAA,KAAA,CAAA;AAChC,IAAM,MAAA,CAAA,GAAA,CAAM,KAAQ,GAAA,SAAA,GAAa,CAAK,IAAA,KAAA,CAAA;AAEtC,IAAA,MAAM,IAAQ,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AACrC,IAAA,MAAM,IAAQ,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AACrC,IAAA,MAAM,CAAK,GAAA,GAAA,GAAM,CAAM,GAAA,GAAA,GAAM,CAAK,GAAA,GAAA,CAAA;AAElC,IAAS,QAAA,CAAA,CAAC,IAAI,IAAO,GAAA,CAAA,CAAA;AACrB,IAAS,QAAA,CAAA,CAAA,GAAI,CAAC,CAAA,GAAI,IAAO,GAAA,CAAA,CAAA;AAEzB,IAAA,KAAA,EAAA,CAAA;AAAA,GACJ;AAGA,EAAA,MAAA,CAAO,MAAO,EAAA,CAAA;AAClB;;;;"}
|
26
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.d.ts
generated
vendored
Normal file
26
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ArrayFixed } from '../../../utils/types';
|
||||
type Matrix3x3 = ArrayFixed<number, 9>;
|
||||
/**
|
||||
* Compute a 2D projection matrix
|
||||
* @param out - The matrix to store the result in
|
||||
* @param x1s - The x coordinate of the first source point
|
||||
* @param y1s - The y coordinate of the first source point
|
||||
* @param x1d - The x coordinate of the first destination point
|
||||
* @param y1d - The y coordinate of the first destination point
|
||||
* @param x2s - The x coordinate of the second source point
|
||||
* @param y2s - The y coordinate of the second source point
|
||||
* @param x2d - The x coordinate of the second destination point
|
||||
* @param y2d - The y coordinate of the second destination point
|
||||
* @param x3s - The x coordinate of the third source point
|
||||
* @param y3s - The y coordinate of the third source point
|
||||
* @param x3d - The x coordinate of the third destination point
|
||||
* @param y3d - The y coordinate of the third destination point
|
||||
* @param x4s - The x coordinate of the fourth source point
|
||||
* @param y4s - The y coordinate of the fourth source point
|
||||
* @param x4d - The x coordinate of the fourth destination point
|
||||
* @param y4d - The y coordinate of the fourth destination point
|
||||
* @returns - The computed 2D projection matrix
|
||||
* @private
|
||||
*/
|
||||
export declare function compute2DProjection(out: Matrix3x3, x1s: number, y1s: number, x1d: number, y1d: number, x2s: number, y2s: number, x2d: number, y2d: number, x3s: number, y3s: number, x3d: number, y3d: number, x4s: number, y4s: number, x4d: number, y4d: number): Matrix3x3;
|
||||
export {};
|
136
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.js
generated
vendored
Normal file
136
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function computeAdjugate(out, matrix) {
|
||||
const a00 = matrix[0];
|
||||
const a01 = matrix[1];
|
||||
const a02 = matrix[2];
|
||||
const a10 = matrix[3];
|
||||
const a11 = matrix[4];
|
||||
const a12 = matrix[5];
|
||||
const a20 = matrix[6];
|
||||
const a21 = matrix[7];
|
||||
const a22 = matrix[8];
|
||||
out[0] = a11 * a22 - a12 * a21;
|
||||
out[1] = a02 * a21 - a01 * a22;
|
||||
out[2] = a01 * a12 - a02 * a11;
|
||||
out[3] = a12 * a20 - a10 * a22;
|
||||
out[4] = a00 * a22 - a02 * a20;
|
||||
out[5] = a02 * a10 - a00 * a12;
|
||||
out[6] = a10 * a21 - a11 * a20;
|
||||
out[7] = a01 * a20 - a00 * a21;
|
||||
out[8] = a00 * a11 - a01 * a10;
|
||||
return out;
|
||||
}
|
||||
function multiplyMatrix3x3(out, a, b) {
|
||||
const a00 = a[0];
|
||||
const a01 = a[1];
|
||||
const a02 = a[2];
|
||||
const a10 = a[3];
|
||||
const a11 = a[4];
|
||||
const a12 = a[5];
|
||||
const a20 = a[6];
|
||||
const a21 = a[7];
|
||||
const a22 = a[8];
|
||||
const b00 = b[0];
|
||||
const b01 = b[1];
|
||||
const b02 = b[2];
|
||||
const b10 = b[3];
|
||||
const b11 = b[4];
|
||||
const b12 = b[5];
|
||||
const b20 = b[6];
|
||||
const b21 = b[7];
|
||||
const b22 = b[8];
|
||||
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
||||
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
||||
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
||||
out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
||||
out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
||||
out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
||||
out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
||||
out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
||||
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
||||
return out;
|
||||
}
|
||||
function multiplyMatrixAndVector(out, m, v) {
|
||||
const x = v[0];
|
||||
const y = v[1];
|
||||
const z = v[2];
|
||||
out[0] = m[0] * x + m[1] * y + m[2] * z;
|
||||
out[1] = m[3] * x + m[4] * y + m[5] * z;
|
||||
out[2] = m[6] * x + m[7] * y + m[8] * z;
|
||||
return out;
|
||||
}
|
||||
const tempMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const tempVec = [0, 0, 0];
|
||||
const tempVec2 = [0, 0, 0];
|
||||
function generateBasisToPointsMatrix(out, x1, y1, x2, y2, x3, y3, x4, y4) {
|
||||
const m = tempMatrix;
|
||||
m[0] = x1;
|
||||
m[1] = x2;
|
||||
m[2] = x3;
|
||||
m[3] = y1;
|
||||
m[4] = y2;
|
||||
m[5] = y3;
|
||||
m[6] = 1;
|
||||
m[7] = 1;
|
||||
m[8] = 1;
|
||||
const adjugateM = computeAdjugate(
|
||||
out,
|
||||
// reusing out as adjugateM is only used once
|
||||
m
|
||||
);
|
||||
tempVec2[0] = x4;
|
||||
tempVec2[1] = y4;
|
||||
tempVec2[2] = 1;
|
||||
const v = multiplyMatrixAndVector(
|
||||
tempVec,
|
||||
adjugateM,
|
||||
tempVec2
|
||||
);
|
||||
const diagonalMatrix = out;
|
||||
out[0] = v[0];
|
||||
out[1] = 0;
|
||||
out[2] = 0;
|
||||
out[3] = 0;
|
||||
out[4] = v[1];
|
||||
out[5] = 0;
|
||||
out[6] = 0;
|
||||
out[7] = 0;
|
||||
out[8] = v[2];
|
||||
return multiplyMatrix3x3(out, diagonalMatrix, m);
|
||||
}
|
||||
const tempSourceMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const tempDestinationMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
function compute2DProjection(out, x1s, y1s, x1d, y1d, x2s, y2s, x2d, y2d, x3s, y3s, x3d, y3d, x4s, y4s, x4d, y4d) {
|
||||
const sourceMatrix = generateBasisToPointsMatrix(
|
||||
tempSourceMatrix,
|
||||
x1s,
|
||||
y1s,
|
||||
x2s,
|
||||
y2s,
|
||||
x3s,
|
||||
y3s,
|
||||
x4s,
|
||||
y4s
|
||||
);
|
||||
const destinationMatrix = generateBasisToPointsMatrix(
|
||||
tempDestinationMatrix,
|
||||
x1d,
|
||||
y1d,
|
||||
x2d,
|
||||
y2d,
|
||||
x3d,
|
||||
y3d,
|
||||
x4d,
|
||||
y4d
|
||||
);
|
||||
return multiplyMatrix3x3(
|
||||
out,
|
||||
computeAdjugate(sourceMatrix, sourceMatrix),
|
||||
destinationMatrix
|
||||
);
|
||||
}
|
||||
|
||||
exports.compute2DProjection = compute2DProjection;
|
||||
//# sourceMappingURL=compute2DProjections.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
134
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.mjs
generated
vendored
Normal file
134
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.mjs
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
function computeAdjugate(out, matrix) {
|
||||
const a00 = matrix[0];
|
||||
const a01 = matrix[1];
|
||||
const a02 = matrix[2];
|
||||
const a10 = matrix[3];
|
||||
const a11 = matrix[4];
|
||||
const a12 = matrix[5];
|
||||
const a20 = matrix[6];
|
||||
const a21 = matrix[7];
|
||||
const a22 = matrix[8];
|
||||
out[0] = a11 * a22 - a12 * a21;
|
||||
out[1] = a02 * a21 - a01 * a22;
|
||||
out[2] = a01 * a12 - a02 * a11;
|
||||
out[3] = a12 * a20 - a10 * a22;
|
||||
out[4] = a00 * a22 - a02 * a20;
|
||||
out[5] = a02 * a10 - a00 * a12;
|
||||
out[6] = a10 * a21 - a11 * a20;
|
||||
out[7] = a01 * a20 - a00 * a21;
|
||||
out[8] = a00 * a11 - a01 * a10;
|
||||
return out;
|
||||
}
|
||||
function multiplyMatrix3x3(out, a, b) {
|
||||
const a00 = a[0];
|
||||
const a01 = a[1];
|
||||
const a02 = a[2];
|
||||
const a10 = a[3];
|
||||
const a11 = a[4];
|
||||
const a12 = a[5];
|
||||
const a20 = a[6];
|
||||
const a21 = a[7];
|
||||
const a22 = a[8];
|
||||
const b00 = b[0];
|
||||
const b01 = b[1];
|
||||
const b02 = b[2];
|
||||
const b10 = b[3];
|
||||
const b11 = b[4];
|
||||
const b12 = b[5];
|
||||
const b20 = b[6];
|
||||
const b21 = b[7];
|
||||
const b22 = b[8];
|
||||
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
||||
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
||||
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
||||
out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
||||
out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
||||
out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
||||
out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
||||
out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
||||
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
||||
return out;
|
||||
}
|
||||
function multiplyMatrixAndVector(out, m, v) {
|
||||
const x = v[0];
|
||||
const y = v[1];
|
||||
const z = v[2];
|
||||
out[0] = m[0] * x + m[1] * y + m[2] * z;
|
||||
out[1] = m[3] * x + m[4] * y + m[5] * z;
|
||||
out[2] = m[6] * x + m[7] * y + m[8] * z;
|
||||
return out;
|
||||
}
|
||||
const tempMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const tempVec = [0, 0, 0];
|
||||
const tempVec2 = [0, 0, 0];
|
||||
function generateBasisToPointsMatrix(out, x1, y1, x2, y2, x3, y3, x4, y4) {
|
||||
const m = tempMatrix;
|
||||
m[0] = x1;
|
||||
m[1] = x2;
|
||||
m[2] = x3;
|
||||
m[3] = y1;
|
||||
m[4] = y2;
|
||||
m[5] = y3;
|
||||
m[6] = 1;
|
||||
m[7] = 1;
|
||||
m[8] = 1;
|
||||
const adjugateM = computeAdjugate(
|
||||
out,
|
||||
// reusing out as adjugateM is only used once
|
||||
m
|
||||
);
|
||||
tempVec2[0] = x4;
|
||||
tempVec2[1] = y4;
|
||||
tempVec2[2] = 1;
|
||||
const v = multiplyMatrixAndVector(
|
||||
tempVec,
|
||||
adjugateM,
|
||||
tempVec2
|
||||
);
|
||||
const diagonalMatrix = out;
|
||||
out[0] = v[0];
|
||||
out[1] = 0;
|
||||
out[2] = 0;
|
||||
out[3] = 0;
|
||||
out[4] = v[1];
|
||||
out[5] = 0;
|
||||
out[6] = 0;
|
||||
out[7] = 0;
|
||||
out[8] = v[2];
|
||||
return multiplyMatrix3x3(out, diagonalMatrix, m);
|
||||
}
|
||||
const tempSourceMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
const tempDestinationMatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
function compute2DProjection(out, x1s, y1s, x1d, y1d, x2s, y2s, x2d, y2d, x3s, y3s, x3d, y3d, x4s, y4s, x4d, y4d) {
|
||||
const sourceMatrix = generateBasisToPointsMatrix(
|
||||
tempSourceMatrix,
|
||||
x1s,
|
||||
y1s,
|
||||
x2s,
|
||||
y2s,
|
||||
x3s,
|
||||
y3s,
|
||||
x4s,
|
||||
y4s
|
||||
);
|
||||
const destinationMatrix = generateBasisToPointsMatrix(
|
||||
tempDestinationMatrix,
|
||||
x1d,
|
||||
y1d,
|
||||
x2d,
|
||||
y2d,
|
||||
x3d,
|
||||
y3d,
|
||||
x4d,
|
||||
y4d
|
||||
);
|
||||
return multiplyMatrix3x3(
|
||||
out,
|
||||
computeAdjugate(sourceMatrix, sourceMatrix),
|
||||
destinationMatrix
|
||||
);
|
||||
}
|
||||
|
||||
export { compute2DProjection };
|
||||
//# sourceMappingURL=compute2DProjections.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-perspective/utils/compute2DProjections.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user