sdfsdfs
This commit is contained in:
56
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.d.ts
generated
vendored
Normal file
56
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Mesh } from '../mesh/shared/Mesh';
|
||||
import type { PointData } from '../../maths/point/PointData';
|
||||
import type { Texture } from '../../rendering/renderers/shared/texture/Texture';
|
||||
import type { MeshOptions } from '../mesh/shared/Mesh';
|
||||
/**
|
||||
* Constructor options used for `MeshRope` instances.
|
||||
* ```js
|
||||
* const meshRope = new MeshRope({
|
||||
* texture: Texture.from('snake.png'),
|
||||
* points: [new Point(0, 0), new Point(100, 0)],
|
||||
* textureScale: 0,
|
||||
* });
|
||||
* ```
|
||||
* @see {@link scene.MeshRope}
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface MeshRopeOptions extends Omit<MeshOptions, 'geometry'> {
|
||||
/** The texture to use on the rope. */
|
||||
texture: Texture;
|
||||
/** An array of points that determine the rope. */
|
||||
points: PointData[];
|
||||
/**
|
||||
* Rope texture scale, if zero then the rope texture is stretched.
|
||||
* Positive values scale rope texture
|
||||
* keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture
|
||||
* and downsampling here. If set to zero, texture will be stretched instead.
|
||||
*/
|
||||
textureScale?: number;
|
||||
}
|
||||
/**
|
||||
* The rope allows you to draw a texture across several points and then manipulate these points
|
||||
* @example
|
||||
* import { Point, MeshRope, Texture } from 'pixi.js';
|
||||
*
|
||||
* for (let i = 0; i < 20; i++) {
|
||||
* points.push(new Point(i * 50, 0));
|
||||
* };
|
||||
* const rope = new MeshRope(Texture.from('snake.png'), points);
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class MeshRope extends Mesh {
|
||||
static defaultOptions: Partial<MeshRopeOptions>;
|
||||
/** re-calculate vertices by rope points each frame */
|
||||
autoUpdate: boolean;
|
||||
/**
|
||||
* Note: The wrap mode of the texture is set to REPEAT if `textureScale` is positive.
|
||||
* @param options
|
||||
* @param options.texture - The texture to use on the rope.
|
||||
* @param options.points - An array of {@link math.Point} objects to construct this rope.
|
||||
* @param {number} options.textureScale - Optional. Positive values scale rope texture
|
||||
* keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture
|
||||
* and downsampling here. If set to zero, texture will be stretched instead.
|
||||
*/
|
||||
constructor(options: MeshRopeOptions);
|
||||
private _render;
|
||||
}
|
46
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.js
generated
vendored
Normal file
46
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var definedProps = require('../container/utils/definedProps.js');
|
||||
var Mesh = require('../mesh/shared/Mesh.js');
|
||||
var RopeGeometry = require('./RopeGeometry.js');
|
||||
|
||||
"use strict";
|
||||
const _MeshRope = class _MeshRope extends Mesh.Mesh {
|
||||
/**
|
||||
* Note: The wrap mode of the texture is set to REPEAT if `textureScale` is positive.
|
||||
* @param options
|
||||
* @param options.texture - The texture to use on the rope.
|
||||
* @param options.points - An array of {@link math.Point} objects to construct this rope.
|
||||
* @param {number} options.textureScale - Optional. Positive values scale rope texture
|
||||
* keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture
|
||||
* and downsampling here. If set to zero, texture will be stretched instead.
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, points, textureScale, ...rest } = { ..._MeshRope.defaultOptions, ...options };
|
||||
const ropeGeometry = new RopeGeometry.RopeGeometry(definedProps.definedProps({ width: texture.height, points, textureScale }));
|
||||
if (textureScale > 0) {
|
||||
texture.source.style.addressMode = "repeat";
|
||||
}
|
||||
super(definedProps.definedProps({
|
||||
...rest,
|
||||
texture,
|
||||
geometry: ropeGeometry
|
||||
}));
|
||||
this.autoUpdate = true;
|
||||
this.onRender = this._render;
|
||||
}
|
||||
_render() {
|
||||
const geometry = this.geometry;
|
||||
if (this.autoUpdate || geometry._width !== this.texture.height) {
|
||||
geometry._width = this.texture.height;
|
||||
geometry.update();
|
||||
}
|
||||
}
|
||||
};
|
||||
_MeshRope.defaultOptions = {
|
||||
textureScale: 0
|
||||
};
|
||||
let MeshRope = _MeshRope;
|
||||
|
||||
exports.MeshRope = MeshRope;
|
||||
//# sourceMappingURL=MeshRope.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MeshRope.js","sources":["../../../src/scene/mesh-simple/MeshRope.ts"],"sourcesContent":["import { definedProps } from '../container/utils/definedProps';\nimport { Mesh } from '../mesh/shared/Mesh';\nimport { RopeGeometry } from './RopeGeometry';\n\nimport type { PointData } from '../../maths/point/PointData';\nimport type { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport type { MeshOptions } from '../mesh/shared/Mesh';\n\n/**\n * Constructor options used for `MeshRope` instances.\n * ```js\n * const meshRope = new MeshRope({\n * texture: Texture.from('snake.png'),\n * points: [new Point(0, 0), new Point(100, 0)],\n * textureScale: 0,\n * });\n * ```\n * @see {@link scene.MeshRope}\n * @memberof scene\n */\nexport interface MeshRopeOptions extends Omit<MeshOptions, 'geometry'>\n{\n /** The texture to use on the rope. */\n texture: Texture;\n /** An array of points that determine the rope. */\n points: PointData[];\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be stretched instead.\n */\n textureScale?: number;\n}\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n * @example\n * import { Point, MeshRope, Texture } from 'pixi.js';\n *\n * for (let i = 0; i < 20; i++) {\n * points.push(new Point(i * 50, 0));\n * };\n * const rope = new MeshRope(Texture.from('snake.png'), points);\n * @memberof scene\n */\nexport class MeshRope extends Mesh\n{\n public static defaultOptions: Partial<MeshRopeOptions> = {\n textureScale: 0,\n };\n\n /** re-calculate vertices by rope points each frame */\n public autoUpdate: boolean;\n\n /**\n * Note: The wrap mode of the texture is set to REPEAT if `textureScale` is positive.\n * @param options\n * @param options.texture - The texture to use on the rope.\n * @param options.points - An array of {@link math.Point} objects to construct this rope.\n * @param {number} options.textureScale - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be stretched instead.\n */\n constructor(options: MeshRopeOptions)\n {\n const { texture, points, textureScale, ...rest } = { ...MeshRope.defaultOptions, ...options };\n const ropeGeometry = new RopeGeometry(definedProps({ width: texture.height, points, textureScale }));\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.source.style.addressMode = 'repeat';\n }\n super(definedProps({\n ...rest,\n texture,\n geometry: ropeGeometry,\n }));\n\n this.autoUpdate = true;\n\n this.onRender = this._render;\n }\n\n private _render(): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.texture.height)\n {\n geometry._width = this.texture.height;\n geometry.update();\n }\n }\n}\n"],"names":["Mesh","RopeGeometry","definedProps"],"mappings":";;;;;;;AA8CO,MAAM,SAAA,GAAN,MAAM,SAAA,SAAiBA,SAC9B,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBI,YAAY,OACZ,EAAA;AACI,IAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,YAAA,EAAc,GAAG,IAAA,EAAS,GAAA,EAAE,GAAG,SAAA,CAAS,cAAgB,EAAA,GAAG,OAAQ,EAAA,CAAA;AAC5F,IAAM,MAAA,YAAA,GAAe,IAAIC,yBAAA,CAAaC,yBAAa,CAAA,EAAE,KAAO,EAAA,OAAA,CAAQ,MAAQ,EAAA,MAAA,EAAQ,YAAa,EAAC,CAAC,CAAA,CAAA;AAEnG,IAAA,IAAI,eAAe,CACnB,EAAA;AAEI,MAAQ,OAAA,CAAA,MAAA,CAAO,MAAM,WAAc,GAAA,QAAA,CAAA;AAAA,KACvC;AACA,IAAA,KAAA,CAAMA,yBAAa,CAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,OAAA;AAAA,MACA,QAAU,EAAA,YAAA;AAAA,KACb,CAAC,CAAA,CAAA;AAEF,IAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAElB,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,OAAA,CAAA;AAAA,GACzB;AAAA,EAEQ,OACR,GAAA;AACI,IAAA,MAAM,WAAyB,IAAK,CAAA,QAAA,CAAA;AAEpC,IAAA,IAAI,KAAK,UAAc,IAAA,QAAA,CAAS,MAAW,KAAA,IAAA,CAAK,QAAQ,MACxD,EAAA;AACI,MAAS,QAAA,CAAA,MAAA,GAAS,KAAK,OAAQ,CAAA,MAAA,CAAA;AAC/B,MAAA,QAAA,CAAS,MAAO,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AACJ,CAAA,CAAA;AAjDa,SAAA,CAEK,cAA2C,GAAA;AAAA,EACrD,YAAc,EAAA,CAAA;AAClB,CAAA,CAAA;AAJG,IAAM,QAAN,GAAA;;;;"}
|
44
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.mjs
generated
vendored
Normal file
44
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.mjs
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { definedProps } from '../container/utils/definedProps.mjs';
|
||||
import { Mesh } from '../mesh/shared/Mesh.mjs';
|
||||
import { RopeGeometry } from './RopeGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
const _MeshRope = class _MeshRope extends Mesh {
|
||||
/**
|
||||
* Note: The wrap mode of the texture is set to REPEAT if `textureScale` is positive.
|
||||
* @param options
|
||||
* @param options.texture - The texture to use on the rope.
|
||||
* @param options.points - An array of {@link math.Point} objects to construct this rope.
|
||||
* @param {number} options.textureScale - Optional. Positive values scale rope texture
|
||||
* keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture
|
||||
* and downsampling here. If set to zero, texture will be stretched instead.
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, points, textureScale, ...rest } = { ..._MeshRope.defaultOptions, ...options };
|
||||
const ropeGeometry = new RopeGeometry(definedProps({ width: texture.height, points, textureScale }));
|
||||
if (textureScale > 0) {
|
||||
texture.source.style.addressMode = "repeat";
|
||||
}
|
||||
super(definedProps({
|
||||
...rest,
|
||||
texture,
|
||||
geometry: ropeGeometry
|
||||
}));
|
||||
this.autoUpdate = true;
|
||||
this.onRender = this._render;
|
||||
}
|
||||
_render() {
|
||||
const geometry = this.geometry;
|
||||
if (this.autoUpdate || geometry._width !== this.texture.height) {
|
||||
geometry._width = this.texture.height;
|
||||
geometry.update();
|
||||
}
|
||||
}
|
||||
};
|
||||
_MeshRope.defaultOptions = {
|
||||
textureScale: 0
|
||||
};
|
||||
let MeshRope = _MeshRope;
|
||||
|
||||
export { MeshRope };
|
||||
//# sourceMappingURL=MeshRope.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshRope.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MeshRope.mjs","sources":["../../../src/scene/mesh-simple/MeshRope.ts"],"sourcesContent":["import { definedProps } from '../container/utils/definedProps';\nimport { Mesh } from '../mesh/shared/Mesh';\nimport { RopeGeometry } from './RopeGeometry';\n\nimport type { PointData } from '../../maths/point/PointData';\nimport type { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport type { MeshOptions } from '../mesh/shared/Mesh';\n\n/**\n * Constructor options used for `MeshRope` instances.\n * ```js\n * const meshRope = new MeshRope({\n * texture: Texture.from('snake.png'),\n * points: [new Point(0, 0), new Point(100, 0)],\n * textureScale: 0,\n * });\n * ```\n * @see {@link scene.MeshRope}\n * @memberof scene\n */\nexport interface MeshRopeOptions extends Omit<MeshOptions, 'geometry'>\n{\n /** The texture to use on the rope. */\n texture: Texture;\n /** An array of points that determine the rope. */\n points: PointData[];\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be stretched instead.\n */\n textureScale?: number;\n}\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n * @example\n * import { Point, MeshRope, Texture } from 'pixi.js';\n *\n * for (let i = 0; i < 20; i++) {\n * points.push(new Point(i * 50, 0));\n * };\n * const rope = new MeshRope(Texture.from('snake.png'), points);\n * @memberof scene\n */\nexport class MeshRope extends Mesh\n{\n public static defaultOptions: Partial<MeshRopeOptions> = {\n textureScale: 0,\n };\n\n /** re-calculate vertices by rope points each frame */\n public autoUpdate: boolean;\n\n /**\n * Note: The wrap mode of the texture is set to REPEAT if `textureScale` is positive.\n * @param options\n * @param options.texture - The texture to use on the rope.\n * @param options.points - An array of {@link math.Point} objects to construct this rope.\n * @param {number} options.textureScale - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be stretched instead.\n */\n constructor(options: MeshRopeOptions)\n {\n const { texture, points, textureScale, ...rest } = { ...MeshRope.defaultOptions, ...options };\n const ropeGeometry = new RopeGeometry(definedProps({ width: texture.height, points, textureScale }));\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.source.style.addressMode = 'repeat';\n }\n super(definedProps({\n ...rest,\n texture,\n geometry: ropeGeometry,\n }));\n\n this.autoUpdate = true;\n\n this.onRender = this._render;\n }\n\n private _render(): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.texture.height)\n {\n geometry._width = this.texture.height;\n geometry.update();\n }\n }\n}\n"],"names":[],"mappings":";;;;;AA8CO,MAAM,SAAA,GAAN,MAAM,SAAA,SAAiB,IAC9B,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBI,YAAY,OACZ,EAAA;AACI,IAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,YAAA,EAAc,GAAG,IAAA,EAAS,GAAA,EAAE,GAAG,SAAA,CAAS,cAAgB,EAAA,GAAG,OAAQ,EAAA,CAAA;AAC5F,IAAM,MAAA,YAAA,GAAe,IAAI,YAAA,CAAa,YAAa,CAAA,EAAE,KAAO,EAAA,OAAA,CAAQ,MAAQ,EAAA,MAAA,EAAQ,YAAa,EAAC,CAAC,CAAA,CAAA;AAEnG,IAAA,IAAI,eAAe,CACnB,EAAA;AAEI,MAAQ,OAAA,CAAA,MAAA,CAAO,MAAM,WAAc,GAAA,QAAA,CAAA;AAAA,KACvC;AACA,IAAA,KAAA,CAAM,YAAa,CAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,OAAA;AAAA,MACA,QAAU,EAAA,YAAA;AAAA,KACb,CAAC,CAAA,CAAA;AAEF,IAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAElB,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,OAAA,CAAA;AAAA,GACzB;AAAA,EAEQ,OACR,GAAA;AACI,IAAA,MAAM,WAAyB,IAAK,CAAA,QAAA,CAAA;AAEpC,IAAA,IAAI,KAAK,UAAc,IAAA,QAAA,CAAS,MAAW,KAAA,IAAA,CAAK,QAAQ,MACxD,EAAA;AACI,MAAS,QAAA,CAAA,MAAA,GAAS,KAAK,OAAQ,CAAA,MAAA,CAAA;AAC/B,MAAA,QAAA,CAAS,MAAO,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AACJ,CAAA,CAAA;AAjDa,SAAA,CAEK,cAA2C,GAAA;AAAA,EACrD,YAAc,EAAA,CAAA;AAClB,CAAA,CAAA;AAJG,IAAM,QAAN,GAAA;;;;"}
|
41
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.d.ts
generated
vendored
Normal file
41
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Mesh } from '../mesh/shared/Mesh';
|
||||
import type { TypedArray } from '../../rendering/renderers/shared/buffer/Buffer';
|
||||
import type { Topology } from '../../rendering/renderers/shared/geometry/const';
|
||||
import type { Texture } from '../../rendering/renderers/shared/texture/Texture';
|
||||
import type { MeshOptions } from '../mesh/shared/Mesh';
|
||||
/**
|
||||
* Options for the simple mesh.
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface SimpleMeshOptions extends Omit<MeshOptions, 'geometry'> {
|
||||
/** The texture to use */
|
||||
texture: Texture;
|
||||
/** if you want to specify the vertices */
|
||||
vertices?: Float32Array;
|
||||
/** if you want to specify the uvs */
|
||||
uvs?: Float32Array;
|
||||
/** if you want to specify the indices */
|
||||
indices?: Uint32Array;
|
||||
/** the topology, can be any of the Topology values */
|
||||
topology?: Topology;
|
||||
}
|
||||
/**
|
||||
* The Simple Mesh class mimics Mesh in PixiJS, providing easy-to-use constructor arguments.
|
||||
* For more robust customization, use {@link scene.Mesh}.
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class MeshSimple extends Mesh {
|
||||
/** Upload vertices buffer each frame. */
|
||||
autoUpdate: boolean;
|
||||
/**
|
||||
* @param options - Options to be used for construction
|
||||
*/
|
||||
constructor(options: SimpleMeshOptions);
|
||||
/**
|
||||
* Collection of vertices data.
|
||||
* @type {Float32Array}
|
||||
*/
|
||||
get vertices(): TypedArray;
|
||||
set vertices(value: TypedArray);
|
||||
private _render;
|
||||
}
|
46
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.js
generated
vendored
Normal file
46
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var definedProps = require('../container/utils/definedProps.js');
|
||||
var Mesh = require('../mesh/shared/Mesh.js');
|
||||
var MeshGeometry = require('../mesh/shared/MeshGeometry.js');
|
||||
|
||||
"use strict";
|
||||
class MeshSimple extends Mesh.Mesh {
|
||||
/**
|
||||
* @param options - Options to be used for construction
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, vertices, uvs, indices, topology, ...rest } = options;
|
||||
const geometry = new MeshGeometry.MeshGeometry(definedProps.definedProps({
|
||||
positions: vertices,
|
||||
uvs,
|
||||
indices,
|
||||
topology
|
||||
}));
|
||||
super(definedProps.definedProps({
|
||||
...rest,
|
||||
texture,
|
||||
geometry
|
||||
}));
|
||||
this.autoUpdate = true;
|
||||
this.onRender = this._render;
|
||||
}
|
||||
/**
|
||||
* Collection of vertices data.
|
||||
* @type {Float32Array}
|
||||
*/
|
||||
get vertices() {
|
||||
return this.geometry.getBuffer("aPosition").data;
|
||||
}
|
||||
set vertices(value) {
|
||||
this.geometry.getBuffer("aPosition").data = value;
|
||||
}
|
||||
_render() {
|
||||
if (this.autoUpdate) {
|
||||
this.geometry.getBuffer("aPosition").update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.MeshSimple = MeshSimple;
|
||||
//# sourceMappingURL=MeshSimple.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MeshSimple.js","sources":["../../../src/scene/mesh-simple/MeshSimple.ts"],"sourcesContent":["import { definedProps } from '../container/utils/definedProps';\nimport { Mesh } from '../mesh/shared/Mesh';\nimport { MeshGeometry } from '../mesh/shared/MeshGeometry';\n\nimport type { TypedArray } from '../../rendering/renderers/shared/buffer/Buffer';\nimport type { Topology } from '../../rendering/renderers/shared/geometry/const';\nimport type { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport type { MeshOptions } from '../mesh/shared/Mesh';\n\n/**\n * Options for the simple mesh.\n * @memberof scene\n */\nexport interface SimpleMeshOptions extends Omit<MeshOptions, 'geometry'>\n{\n /** The texture to use */\n texture: Texture,\n /** if you want to specify the vertices */\n vertices?: Float32Array,\n /** if you want to specify the uvs */\n uvs?: Float32Array,\n /** if you want to specify the indices */\n indices?: Uint32Array,\n /** the topology, can be any of the Topology values */\n topology?: Topology\n}\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link scene.Mesh}.\n * @memberof scene\n */\nexport class MeshSimple extends Mesh\n{\n /** Upload vertices buffer each frame. */\n public autoUpdate: boolean;\n\n /**\n * @param options - Options to be used for construction\n */\n constructor(options: SimpleMeshOptions)\n {\n const { texture, vertices, uvs, indices, topology, ...rest } = options;\n const geometry = new MeshGeometry(definedProps({\n positions: vertices,\n uvs,\n indices,\n topology\n }));\n\n // geometry.getBuffer('aPosition').static = false;\n\n super(definedProps({\n ...rest,\n texture,\n geometry,\n }));\n\n this.autoUpdate = true;\n this.onRender = this._render;\n }\n\n /**\n * Collection of vertices data.\n * @type {Float32Array}\n */\n get vertices(): TypedArray\n {\n return this.geometry.getBuffer('aPosition').data;\n }\n set vertices(value: TypedArray)\n {\n this.geometry.getBuffer('aPosition').data = value;\n }\n\n private _render(): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aPosition').update();\n }\n }\n}\n"],"names":["Mesh","MeshGeometry","definedProps"],"mappings":";;;;;;;AAgCO,MAAM,mBAAmBA,SAChC,CAAA;AAAA;AAAA;AAAA;AAAA,EAOI,YAAY,OACZ,EAAA;AACI,IAAM,MAAA,EAAE,SAAS,QAAU,EAAA,GAAA,EAAK,SAAS,QAAU,EAAA,GAAG,MAAS,GAAA,OAAA,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,IAAIC,yBAAA,CAAaC,yBAAa,CAAA;AAAA,MAC3C,SAAW,EAAA,QAAA;AAAA,MACX,GAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAC,CAAA,CAAA;AAIF,IAAA,KAAA,CAAMA,yBAAa,CAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,OAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAC,CAAA,CAAA;AAEF,IAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAClB,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,OAAA,CAAA;AAAA,GACzB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,QACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,QAAA,CAAS,SAAU,CAAA,WAAW,CAAE,CAAA,IAAA,CAAA;AAAA,GAChD;AAAA,EACA,IAAI,SAAS,KACb,EAAA;AACI,IAAA,IAAA,CAAK,QAAS,CAAA,SAAA,CAAU,WAAW,CAAA,CAAE,IAAO,GAAA,KAAA,CAAA;AAAA,GAChD;AAAA,EAEQ,OACR,GAAA;AACI,IAAA,IAAI,KAAK,UACT,EAAA;AACI,MAAA,IAAA,CAAK,QAAS,CAAA,SAAA,CAAU,WAAW,CAAA,CAAE,MAAO,EAAA,CAAA;AAAA,KAChD;AAAA,GACJ;AACJ;;;;"}
|
44
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.mjs
generated
vendored
Normal file
44
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.mjs
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { definedProps } from '../container/utils/definedProps.mjs';
|
||||
import { Mesh } from '../mesh/shared/Mesh.mjs';
|
||||
import { MeshGeometry } from '../mesh/shared/MeshGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
class MeshSimple extends Mesh {
|
||||
/**
|
||||
* @param options - Options to be used for construction
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, vertices, uvs, indices, topology, ...rest } = options;
|
||||
const geometry = new MeshGeometry(definedProps({
|
||||
positions: vertices,
|
||||
uvs,
|
||||
indices,
|
||||
topology
|
||||
}));
|
||||
super(definedProps({
|
||||
...rest,
|
||||
texture,
|
||||
geometry
|
||||
}));
|
||||
this.autoUpdate = true;
|
||||
this.onRender = this._render;
|
||||
}
|
||||
/**
|
||||
* Collection of vertices data.
|
||||
* @type {Float32Array}
|
||||
*/
|
||||
get vertices() {
|
||||
return this.geometry.getBuffer("aPosition").data;
|
||||
}
|
||||
set vertices(value) {
|
||||
this.geometry.getBuffer("aPosition").data = value;
|
||||
}
|
||||
_render() {
|
||||
if (this.autoUpdate) {
|
||||
this.geometry.getBuffer("aPosition").update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { MeshSimple };
|
||||
//# sourceMappingURL=MeshSimple.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/MeshSimple.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MeshSimple.mjs","sources":["../../../src/scene/mesh-simple/MeshSimple.ts"],"sourcesContent":["import { definedProps } from '../container/utils/definedProps';\nimport { Mesh } from '../mesh/shared/Mesh';\nimport { MeshGeometry } from '../mesh/shared/MeshGeometry';\n\nimport type { TypedArray } from '../../rendering/renderers/shared/buffer/Buffer';\nimport type { Topology } from '../../rendering/renderers/shared/geometry/const';\nimport type { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport type { MeshOptions } from '../mesh/shared/Mesh';\n\n/**\n * Options for the simple mesh.\n * @memberof scene\n */\nexport interface SimpleMeshOptions extends Omit<MeshOptions, 'geometry'>\n{\n /** The texture to use */\n texture: Texture,\n /** if you want to specify the vertices */\n vertices?: Float32Array,\n /** if you want to specify the uvs */\n uvs?: Float32Array,\n /** if you want to specify the indices */\n indices?: Uint32Array,\n /** the topology, can be any of the Topology values */\n topology?: Topology\n}\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link scene.Mesh}.\n * @memberof scene\n */\nexport class MeshSimple extends Mesh\n{\n /** Upload vertices buffer each frame. */\n public autoUpdate: boolean;\n\n /**\n * @param options - Options to be used for construction\n */\n constructor(options: SimpleMeshOptions)\n {\n const { texture, vertices, uvs, indices, topology, ...rest } = options;\n const geometry = new MeshGeometry(definedProps({\n positions: vertices,\n uvs,\n indices,\n topology\n }));\n\n // geometry.getBuffer('aPosition').static = false;\n\n super(definedProps({\n ...rest,\n texture,\n geometry,\n }));\n\n this.autoUpdate = true;\n this.onRender = this._render;\n }\n\n /**\n * Collection of vertices data.\n * @type {Float32Array}\n */\n get vertices(): TypedArray\n {\n return this.geometry.getBuffer('aPosition').data;\n }\n set vertices(value: TypedArray)\n {\n this.geometry.getBuffer('aPosition').data = value;\n }\n\n private _render(): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aPosition').update();\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAgCO,MAAM,mBAAmB,IAChC,CAAA;AAAA;AAAA;AAAA;AAAA,EAOI,YAAY,OACZ,EAAA;AACI,IAAM,MAAA,EAAE,SAAS,QAAU,EAAA,GAAA,EAAK,SAAS,QAAU,EAAA,GAAG,MAAS,GAAA,OAAA,CAAA;AAC/D,IAAM,MAAA,QAAA,GAAW,IAAI,YAAA,CAAa,YAAa,CAAA;AAAA,MAC3C,SAAW,EAAA,QAAA;AAAA,MACX,GAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAC,CAAA,CAAA;AAIF,IAAA,KAAA,CAAM,YAAa,CAAA;AAAA,MACf,GAAG,IAAA;AAAA,MACH,OAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAC,CAAA,CAAA;AAEF,IAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAClB,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,OAAA,CAAA;AAAA,GACzB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,QACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,QAAA,CAAS,SAAU,CAAA,WAAW,CAAE,CAAA,IAAA,CAAA;AAAA,GAChD;AAAA,EACA,IAAI,SAAS,KACb,EAAA;AACI,IAAA,IAAA,CAAK,QAAS,CAAA,SAAA,CAAU,WAAW,CAAA,CAAE,IAAO,GAAA,KAAA,CAAA;AAAA,GAChD;AAAA,EAEQ,OACR,GAAA;AACI,IAAA,IAAI,KAAK,UACT,EAAA;AACI,MAAA,IAAA,CAAK,QAAS,CAAA,SAAA,CAAU,WAAW,CAAA,CAAE,MAAO,EAAA,CAAA;AAAA,KAChD;AAAA,GACJ;AACJ;;;;"}
|
71
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.d.ts
generated
vendored
Normal file
71
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import { MeshGeometry } from '../mesh/shared/MeshGeometry';
|
||||
import type { PointData } from '../../maths/point/PointData';
|
||||
import type { MeshGeometryOptions } from '../mesh/shared/MeshGeometry';
|
||||
/**
|
||||
* Constructor options used for `RopeGeometry` instances.
|
||||
* ```js
|
||||
* const ropeGeometry = new RopeGeometry({
|
||||
* points: [new Point(0, 0), new Point(100, 0)],
|
||||
* width: 10,
|
||||
* textureScale: 0,
|
||||
* });
|
||||
* ```
|
||||
* @see {@link scene.RopeGeometry}
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface RopeGeometryOptions {
|
||||
/** The width (i.e., thickness) of the rope. */
|
||||
width?: number;
|
||||
/** An array of points that determine the rope. */
|
||||
points?: PointData[];
|
||||
/**
|
||||
* Rope texture scale, if zero then the rope texture is stretched.
|
||||
* By default the rope texture will be stretched to match
|
||||
* rope length. If textureScale is positive this value will be treated as a scaling
|
||||
* factor and the texture will preserve its aspect ratio instead. To create a tiling rope
|
||||
* set baseTexture.wrapMode to 'repeat' and use a power of two texture,
|
||||
* then set textureScale=1 to keep the original texture pixel size.
|
||||
* In order to reduce alpha channel artifacts provide a larger texture and downsample -
|
||||
* i.e. set textureScale=0.5 to scale it down twice.
|
||||
*/
|
||||
textureScale?: number;
|
||||
}
|
||||
/**
|
||||
* RopeGeometry allows you to draw a geometry across several points and then manipulate these points.
|
||||
* @example
|
||||
* import { Point, RopeGeometry } from 'pixi.js';
|
||||
*
|
||||
* for (let i = 0; i < 20; i++) {
|
||||
* points.push(new Point(i * 50, 0));
|
||||
* };
|
||||
* const rope = new RopeGeometry(100, points);
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class RopeGeometry extends MeshGeometry {
|
||||
/** Default options for RopeGeometry constructor. */
|
||||
static defaultOptions: RopeGeometryOptions & MeshGeometryOptions;
|
||||
/** An array of points that determine the rope. */
|
||||
points: PointData[];
|
||||
/** Rope texture scale, if zero then the rope texture is stretched. */
|
||||
readonly textureScale: number;
|
||||
/**
|
||||
* The width (i.e., thickness) of the rope.
|
||||
* @readonly
|
||||
*/
|
||||
_width: number;
|
||||
/**
|
||||
* @param options - Options to be applied to rope geometry
|
||||
*/
|
||||
constructor(options: RopeGeometryOptions);
|
||||
/**
|
||||
* The width (i.e., thickness) of the rope.
|
||||
* @readonly
|
||||
*/
|
||||
get width(): number;
|
||||
/** Refreshes Rope indices and uvs */
|
||||
private _build;
|
||||
/** refreshes vertices of Rope mesh */
|
||||
updateVertices(): void;
|
||||
/** Refreshes Rope indices and uvs */
|
||||
update(): void;
|
||||
}
|
151
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.js
generated
vendored
Normal file
151
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
'use strict';
|
||||
|
||||
var MeshGeometry = require('../mesh/shared/MeshGeometry.js');
|
||||
|
||||
"use strict";
|
||||
const _RopeGeometry = class _RopeGeometry extends MeshGeometry.MeshGeometry {
|
||||
/**
|
||||
* @param options - Options to be applied to rope geometry
|
||||
*/
|
||||
constructor(options) {
|
||||
const { width, points, textureScale } = { ..._RopeGeometry.defaultOptions, ...options };
|
||||
super({
|
||||
positions: new Float32Array(points.length * 4),
|
||||
uvs: new Float32Array(points.length * 4),
|
||||
indices: new Uint32Array((points.length - 1) * 6)
|
||||
});
|
||||
this.points = points;
|
||||
this._width = width;
|
||||
this.textureScale = textureScale;
|
||||
this._build();
|
||||
}
|
||||
/**
|
||||
* The width (i.e., thickness) of the rope.
|
||||
* @readonly
|
||||
*/
|
||||
get width() {
|
||||
return this._width;
|
||||
}
|
||||
/** Refreshes Rope indices and uvs */
|
||||
_build() {
|
||||
const points = this.points;
|
||||
if (!points)
|
||||
return;
|
||||
const vertexBuffer = this.getBuffer("aPosition");
|
||||
const uvBuffer = this.getBuffer("aUV");
|
||||
const indexBuffer = this.getIndex();
|
||||
if (points.length < 1) {
|
||||
return;
|
||||
}
|
||||
if (vertexBuffer.data.length / 4 !== points.length) {
|
||||
vertexBuffer.data = new Float32Array(points.length * 4);
|
||||
uvBuffer.data = new Float32Array(points.length * 4);
|
||||
indexBuffer.data = new Uint16Array((points.length - 1) * 6);
|
||||
}
|
||||
const uvs = uvBuffer.data;
|
||||
const indices = indexBuffer.data;
|
||||
uvs[0] = 0;
|
||||
uvs[1] = 0;
|
||||
uvs[2] = 0;
|
||||
uvs[3] = 1;
|
||||
let amount = 0;
|
||||
let prev = points[0];
|
||||
const textureWidth = this._width * this.textureScale;
|
||||
const total = points.length;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const index = i * 4;
|
||||
if (this.textureScale > 0) {
|
||||
const dx = prev.x - points[i].x;
|
||||
const dy = prev.y - points[i].y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
prev = points[i];
|
||||
amount += distance / textureWidth;
|
||||
} else {
|
||||
amount = i / (total - 1);
|
||||
}
|
||||
uvs[index] = amount;
|
||||
uvs[index + 1] = 0;
|
||||
uvs[index + 2] = amount;
|
||||
uvs[index + 3] = 1;
|
||||
}
|
||||
let indexCount = 0;
|
||||
for (let i = 0; i < total - 1; i++) {
|
||||
const index = i * 2;
|
||||
indices[indexCount++] = index;
|
||||
indices[indexCount++] = index + 1;
|
||||
indices[indexCount++] = index + 2;
|
||||
indices[indexCount++] = index + 2;
|
||||
indices[indexCount++] = index + 1;
|
||||
indices[indexCount++] = index + 3;
|
||||
}
|
||||
uvBuffer.update();
|
||||
indexBuffer.update();
|
||||
this.updateVertices();
|
||||
}
|
||||
/** refreshes vertices of Rope mesh */
|
||||
updateVertices() {
|
||||
const points = this.points;
|
||||
if (points.length < 1) {
|
||||
return;
|
||||
}
|
||||
let lastPoint = points[0];
|
||||
let nextPoint;
|
||||
let perpX = 0;
|
||||
let perpY = 0;
|
||||
const vertices = this.buffers[0].data;
|
||||
const total = points.length;
|
||||
const halfWidth = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const point = points[i];
|
||||
const index = i * 4;
|
||||
if (i < points.length - 1) {
|
||||
nextPoint = points[i + 1];
|
||||
} else {
|
||||
nextPoint = point;
|
||||
}
|
||||
perpY = -(nextPoint.x - lastPoint.x);
|
||||
perpX = nextPoint.y - lastPoint.y;
|
||||
let ratio = (1 - i / (total - 1)) * 10;
|
||||
if (ratio > 1) {
|
||||
ratio = 1;
|
||||
}
|
||||
const perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
if (perpLength < 1e-6) {
|
||||
perpX = 0;
|
||||
perpY = 0;
|
||||
} else {
|
||||
perpX /= perpLength;
|
||||
perpY /= perpLength;
|
||||
perpX *= halfWidth;
|
||||
perpY *= halfWidth;
|
||||
}
|
||||
vertices[index] = point.x + perpX;
|
||||
vertices[index + 1] = point.y + perpY;
|
||||
vertices[index + 2] = point.x - perpX;
|
||||
vertices[index + 3] = point.y - perpY;
|
||||
lastPoint = point;
|
||||
}
|
||||
this.buffers[0].update();
|
||||
}
|
||||
/** Refreshes Rope indices and uvs */
|
||||
update() {
|
||||
if (this.textureScale > 0) {
|
||||
this._build();
|
||||
} else {
|
||||
this.updateVertices();
|
||||
}
|
||||
}
|
||||
};
|
||||
/** Default options for RopeGeometry constructor. */
|
||||
_RopeGeometry.defaultOptions = {
|
||||
/** The width (i.e., thickness) of the rope. */
|
||||
width: 200,
|
||||
/** An array of points that determine the rope. */
|
||||
points: [],
|
||||
/** Rope texture scale, if zero then the rope texture is stretched. */
|
||||
textureScale: 0
|
||||
};
|
||||
let RopeGeometry = _RopeGeometry;
|
||||
|
||||
exports.RopeGeometry = RopeGeometry;
|
||||
//# sourceMappingURL=RopeGeometry.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
149
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.mjs
generated
vendored
Normal file
149
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.mjs
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import { MeshGeometry } from '../mesh/shared/MeshGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
const _RopeGeometry = class _RopeGeometry extends MeshGeometry {
|
||||
/**
|
||||
* @param options - Options to be applied to rope geometry
|
||||
*/
|
||||
constructor(options) {
|
||||
const { width, points, textureScale } = { ..._RopeGeometry.defaultOptions, ...options };
|
||||
super({
|
||||
positions: new Float32Array(points.length * 4),
|
||||
uvs: new Float32Array(points.length * 4),
|
||||
indices: new Uint32Array((points.length - 1) * 6)
|
||||
});
|
||||
this.points = points;
|
||||
this._width = width;
|
||||
this.textureScale = textureScale;
|
||||
this._build();
|
||||
}
|
||||
/**
|
||||
* The width (i.e., thickness) of the rope.
|
||||
* @readonly
|
||||
*/
|
||||
get width() {
|
||||
return this._width;
|
||||
}
|
||||
/** Refreshes Rope indices and uvs */
|
||||
_build() {
|
||||
const points = this.points;
|
||||
if (!points)
|
||||
return;
|
||||
const vertexBuffer = this.getBuffer("aPosition");
|
||||
const uvBuffer = this.getBuffer("aUV");
|
||||
const indexBuffer = this.getIndex();
|
||||
if (points.length < 1) {
|
||||
return;
|
||||
}
|
||||
if (vertexBuffer.data.length / 4 !== points.length) {
|
||||
vertexBuffer.data = new Float32Array(points.length * 4);
|
||||
uvBuffer.data = new Float32Array(points.length * 4);
|
||||
indexBuffer.data = new Uint16Array((points.length - 1) * 6);
|
||||
}
|
||||
const uvs = uvBuffer.data;
|
||||
const indices = indexBuffer.data;
|
||||
uvs[0] = 0;
|
||||
uvs[1] = 0;
|
||||
uvs[2] = 0;
|
||||
uvs[3] = 1;
|
||||
let amount = 0;
|
||||
let prev = points[0];
|
||||
const textureWidth = this._width * this.textureScale;
|
||||
const total = points.length;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const index = i * 4;
|
||||
if (this.textureScale > 0) {
|
||||
const dx = prev.x - points[i].x;
|
||||
const dy = prev.y - points[i].y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
prev = points[i];
|
||||
amount += distance / textureWidth;
|
||||
} else {
|
||||
amount = i / (total - 1);
|
||||
}
|
||||
uvs[index] = amount;
|
||||
uvs[index + 1] = 0;
|
||||
uvs[index + 2] = amount;
|
||||
uvs[index + 3] = 1;
|
||||
}
|
||||
let indexCount = 0;
|
||||
for (let i = 0; i < total - 1; i++) {
|
||||
const index = i * 2;
|
||||
indices[indexCount++] = index;
|
||||
indices[indexCount++] = index + 1;
|
||||
indices[indexCount++] = index + 2;
|
||||
indices[indexCount++] = index + 2;
|
||||
indices[indexCount++] = index + 1;
|
||||
indices[indexCount++] = index + 3;
|
||||
}
|
||||
uvBuffer.update();
|
||||
indexBuffer.update();
|
||||
this.updateVertices();
|
||||
}
|
||||
/** refreshes vertices of Rope mesh */
|
||||
updateVertices() {
|
||||
const points = this.points;
|
||||
if (points.length < 1) {
|
||||
return;
|
||||
}
|
||||
let lastPoint = points[0];
|
||||
let nextPoint;
|
||||
let perpX = 0;
|
||||
let perpY = 0;
|
||||
const vertices = this.buffers[0].data;
|
||||
const total = points.length;
|
||||
const halfWidth = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const point = points[i];
|
||||
const index = i * 4;
|
||||
if (i < points.length - 1) {
|
||||
nextPoint = points[i + 1];
|
||||
} else {
|
||||
nextPoint = point;
|
||||
}
|
||||
perpY = -(nextPoint.x - lastPoint.x);
|
||||
perpX = nextPoint.y - lastPoint.y;
|
||||
let ratio = (1 - i / (total - 1)) * 10;
|
||||
if (ratio > 1) {
|
||||
ratio = 1;
|
||||
}
|
||||
const perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
|
||||
if (perpLength < 1e-6) {
|
||||
perpX = 0;
|
||||
perpY = 0;
|
||||
} else {
|
||||
perpX /= perpLength;
|
||||
perpY /= perpLength;
|
||||
perpX *= halfWidth;
|
||||
perpY *= halfWidth;
|
||||
}
|
||||
vertices[index] = point.x + perpX;
|
||||
vertices[index + 1] = point.y + perpY;
|
||||
vertices[index + 2] = point.x - perpX;
|
||||
vertices[index + 3] = point.y - perpY;
|
||||
lastPoint = point;
|
||||
}
|
||||
this.buffers[0].update();
|
||||
}
|
||||
/** Refreshes Rope indices and uvs */
|
||||
update() {
|
||||
if (this.textureScale > 0) {
|
||||
this._build();
|
||||
} else {
|
||||
this.updateVertices();
|
||||
}
|
||||
}
|
||||
};
|
||||
/** Default options for RopeGeometry constructor. */
|
||||
_RopeGeometry.defaultOptions = {
|
||||
/** The width (i.e., thickness) of the rope. */
|
||||
width: 200,
|
||||
/** An array of points that determine the rope. */
|
||||
points: [],
|
||||
/** Rope texture scale, if zero then the rope texture is stretched. */
|
||||
textureScale: 0
|
||||
};
|
||||
let RopeGeometry = _RopeGeometry;
|
||||
|
||||
export { RopeGeometry };
|
||||
//# sourceMappingURL=RopeGeometry.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-simple/RopeGeometry.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user