sdfsdfs
This commit is contained in:
60
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.d.ts
generated
vendored
Normal file
60
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Mesh } from '../mesh/shared/Mesh';
|
||||
import type { Texture } from '../../rendering/renderers/shared/texture/Texture';
|
||||
import type { DestroyOptions } from '../container/destroyTypes';
|
||||
import type { MeshOptions } from '../mesh/shared/Mesh';
|
||||
/**
|
||||
* Constructor options used for `MeshPlane` instances.
|
||||
* ```js
|
||||
* const meshPlane = new MeshPlane({
|
||||
* texture: Texture.from('snake.png'),
|
||||
* verticesX: 20,
|
||||
* verticesY: 20,
|
||||
* });
|
||||
* ```
|
||||
* @see {@link scene.MeshPlane}
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface MeshPlaneOptions extends Omit<MeshOptions, 'geometry'> {
|
||||
/** The texture to use on the plane. */
|
||||
texture: Texture;
|
||||
/** The number of vertices in the x-axis */
|
||||
verticesX?: number;
|
||||
/** The number of vertices in the y-axis */
|
||||
verticesY?: number;
|
||||
}
|
||||
/**
|
||||
* The MeshPlane allows you to draw a texture across several points and then manipulate these points
|
||||
* @example
|
||||
* import { Point, MeshPlane, Texture } from 'pixi.js';
|
||||
*
|
||||
* for (let i = 0; i < 20; i++) {
|
||||
* points.push(new Point(i * 50, 0));
|
||||
* }
|
||||
* const MeshPlane = new MeshPlane({ texture: Texture.from('snake.png'), verticesX: points });
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class MeshPlane extends Mesh {
|
||||
/** The geometry is automatically updated when the texture size changes. */
|
||||
autoResize: boolean;
|
||||
protected _textureID: number;
|
||||
/**
|
||||
* @param options - Options to be applied to MeshPlane
|
||||
*/
|
||||
constructor(options: MeshPlaneOptions);
|
||||
/**
|
||||
* Method used for overrides, to do something in case texture frame was changed.
|
||||
* Meshes based on plane can override it and change more details based on texture.
|
||||
*/
|
||||
textureUpdated(): void;
|
||||
set texture(value: Texture);
|
||||
/** The texture of the MeshPlane */
|
||||
get texture(): Texture;
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options?: DestroyOptions): void;
|
||||
}
|
61
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.js
generated
vendored
Normal file
61
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
var definedProps = require('../container/utils/definedProps.js');
|
||||
var Mesh = require('../mesh/shared/Mesh.js');
|
||||
var PlaneGeometry = require('./PlaneGeometry.js');
|
||||
|
||||
"use strict";
|
||||
class MeshPlane extends Mesh.Mesh {
|
||||
/**
|
||||
* @param options - Options to be applied to MeshPlane
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, verticesX, verticesY, ...rest } = options;
|
||||
const planeGeometry = new PlaneGeometry.PlaneGeometry(definedProps.definedProps({
|
||||
width: texture.width,
|
||||
height: texture.height,
|
||||
verticesX,
|
||||
verticesY
|
||||
}));
|
||||
super(definedProps.definedProps({ ...rest, geometry: planeGeometry, texture }));
|
||||
this.texture = texture;
|
||||
this.autoResize = true;
|
||||
}
|
||||
/**
|
||||
* Method used for overrides, to do something in case texture frame was changed.
|
||||
* Meshes based on plane can override it and change more details based on texture.
|
||||
*/
|
||||
textureUpdated() {
|
||||
const geometry = this.geometry;
|
||||
const { width, height } = this.texture;
|
||||
if (this.autoResize && (geometry.width !== width || geometry.height !== height)) {
|
||||
geometry.width = width;
|
||||
geometry.height = height;
|
||||
geometry.build({});
|
||||
}
|
||||
}
|
||||
set texture(value) {
|
||||
this._texture?.off("update", this.textureUpdated, this);
|
||||
super.texture = value;
|
||||
value.on("update", this.textureUpdated, this);
|
||||
this.textureUpdated();
|
||||
}
|
||||
/** The texture of the MeshPlane */
|
||||
get texture() {
|
||||
return this._texture;
|
||||
}
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options) {
|
||||
this.texture.off("update", this.textureUpdated, this);
|
||||
super.destroy(options);
|
||||
}
|
||||
}
|
||||
|
||||
exports.MeshPlane = MeshPlane;
|
||||
//# sourceMappingURL=MeshPlane.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
59
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.mjs
generated
vendored
Normal file
59
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.mjs
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { definedProps } from '../container/utils/definedProps.mjs';
|
||||
import { Mesh } from '../mesh/shared/Mesh.mjs';
|
||||
import { PlaneGeometry } from './PlaneGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
class MeshPlane extends Mesh {
|
||||
/**
|
||||
* @param options - Options to be applied to MeshPlane
|
||||
*/
|
||||
constructor(options) {
|
||||
const { texture, verticesX, verticesY, ...rest } = options;
|
||||
const planeGeometry = new PlaneGeometry(definedProps({
|
||||
width: texture.width,
|
||||
height: texture.height,
|
||||
verticesX,
|
||||
verticesY
|
||||
}));
|
||||
super(definedProps({ ...rest, geometry: planeGeometry, texture }));
|
||||
this.texture = texture;
|
||||
this.autoResize = true;
|
||||
}
|
||||
/**
|
||||
* Method used for overrides, to do something in case texture frame was changed.
|
||||
* Meshes based on plane can override it and change more details based on texture.
|
||||
*/
|
||||
textureUpdated() {
|
||||
const geometry = this.geometry;
|
||||
const { width, height } = this.texture;
|
||||
if (this.autoResize && (geometry.width !== width || geometry.height !== height)) {
|
||||
geometry.width = width;
|
||||
geometry.height = height;
|
||||
geometry.build({});
|
||||
}
|
||||
}
|
||||
set texture(value) {
|
||||
this._texture?.off("update", this.textureUpdated, this);
|
||||
super.texture = value;
|
||||
value.on("update", this.textureUpdated, this);
|
||||
this.textureUpdated();
|
||||
}
|
||||
/** The texture of the MeshPlane */
|
||||
get texture() {
|
||||
return this._texture;
|
||||
}
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options) {
|
||||
this.texture.off("update", this.textureUpdated, this);
|
||||
super.destroy(options);
|
||||
}
|
||||
}
|
||||
|
||||
export { MeshPlane };
|
||||
//# sourceMappingURL=MeshPlane.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-plane/MeshPlane.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.d.ts
generated
vendored
Normal file
51
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { MeshGeometry } from '../mesh/shared/MeshGeometry';
|
||||
import type { MeshGeometryOptions } from '../mesh/shared/MeshGeometry';
|
||||
/**
|
||||
* Constructor options used for `PlaneGeometry` instances.
|
||||
* ```js
|
||||
* const planeGeometry = new PlaneGeometry({
|
||||
* width: 100,
|
||||
* height: 100,
|
||||
* verticesX: 10,
|
||||
* verticesY: 10,
|
||||
* });
|
||||
* ```
|
||||
* @see {@link scene.PlaneGeometry}
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface PlaneGeometryOptions {
|
||||
/** Width of plane */
|
||||
width?: number;
|
||||
/** Height of plane */
|
||||
height?: number;
|
||||
/** Number of vertices on x-axis */
|
||||
verticesX?: number;
|
||||
/** Number of vertices on y-axis */
|
||||
verticesY?: number;
|
||||
}
|
||||
/**
|
||||
* The PlaneGeometry allows you to draw a 2d plane
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class PlaneGeometry extends MeshGeometry {
|
||||
static defaultOptions: PlaneGeometryOptions & MeshGeometryOptions;
|
||||
/** The number of vertices on x-axis */
|
||||
verticesX: number;
|
||||
/** The number of vertices on y-axis */
|
||||
verticesY: number;
|
||||
/** The width of plane */
|
||||
width: number;
|
||||
/** The height of plane */
|
||||
height: number;
|
||||
/**
|
||||
* @param {PlaneGeometryOptions} options - Options to be applied to plane geometry
|
||||
*/
|
||||
constructor(options: PlaneGeometryOptions);
|
||||
/** @deprecated since 8.0.0 */
|
||||
constructor(width?: number, height?: number, verticesX?: number, verticesY?: number);
|
||||
/**
|
||||
* Refreshes plane coordinates
|
||||
* @param options - Options to be applied to plane geometry
|
||||
*/
|
||||
build(options: PlaneGeometryOptions): void;
|
||||
}
|
80
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.js
generated
vendored
Normal file
80
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
var deprecation = require('../../utils/logging/deprecation.js');
|
||||
var MeshGeometry = require('../mesh/shared/MeshGeometry.js');
|
||||
|
||||
"use strict";
|
||||
const _PlaneGeometry = class _PlaneGeometry extends MeshGeometry.MeshGeometry {
|
||||
constructor(...args) {
|
||||
super({});
|
||||
let options = args[0] ?? {};
|
||||
if (typeof options === "number") {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead");
|
||||
options = {
|
||||
width: options,
|
||||
height: args[1],
|
||||
verticesX: args[2],
|
||||
verticesY: args[3]
|
||||
};
|
||||
}
|
||||
this.build(options);
|
||||
}
|
||||
/**
|
||||
* Refreshes plane coordinates
|
||||
* @param options - Options to be applied to plane geometry
|
||||
*/
|
||||
build(options) {
|
||||
options = { ..._PlaneGeometry.defaultOptions, ...options };
|
||||
this.verticesX = this.verticesX ?? options.verticesX;
|
||||
this.verticesY = this.verticesY ?? options.verticesY;
|
||||
this.width = this.width ?? options.width;
|
||||
this.height = this.height ?? options.height;
|
||||
const total = this.verticesX * this.verticesY;
|
||||
const verts = [];
|
||||
const uvs = [];
|
||||
const indices = [];
|
||||
const verticesX = this.verticesX - 1;
|
||||
const verticesY = this.verticesY - 1;
|
||||
const sizeX = this.width / verticesX;
|
||||
const sizeY = this.height / verticesY;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const x = i % this.verticesX;
|
||||
const y = i / this.verticesX | 0;
|
||||
verts.push(x * sizeX, y * sizeY);
|
||||
uvs.push(x / verticesX, y / verticesY);
|
||||
}
|
||||
const totalSub = verticesX * verticesY;
|
||||
for (let i = 0; i < totalSub; i++) {
|
||||
const xpos = i % verticesX;
|
||||
const ypos = i / verticesX | 0;
|
||||
const value = ypos * this.verticesX + xpos;
|
||||
const value2 = ypos * this.verticesX + xpos + 1;
|
||||
const value3 = (ypos + 1) * this.verticesX + xpos;
|
||||
const value4 = (ypos + 1) * this.verticesX + xpos + 1;
|
||||
indices.push(
|
||||
value,
|
||||
value2,
|
||||
value3,
|
||||
value2,
|
||||
value4,
|
||||
value3
|
||||
);
|
||||
}
|
||||
this.buffers[0].data = new Float32Array(verts);
|
||||
this.buffers[1].data = new Float32Array(uvs);
|
||||
this.indexBuffer.data = new Uint32Array(indices);
|
||||
this.buffers[0].update();
|
||||
this.buffers[1].update();
|
||||
this.indexBuffer.update();
|
||||
}
|
||||
};
|
||||
_PlaneGeometry.defaultOptions = {
|
||||
width: 100,
|
||||
height: 100,
|
||||
verticesX: 10,
|
||||
verticesY: 10
|
||||
};
|
||||
let PlaneGeometry = _PlaneGeometry;
|
||||
|
||||
exports.PlaneGeometry = PlaneGeometry;
|
||||
//# sourceMappingURL=PlaneGeometry.js.map
|
1
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.mjs
generated
vendored
Normal file
78
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.mjs
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';
|
||||
import { MeshGeometry } from '../mesh/shared/MeshGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
const _PlaneGeometry = class _PlaneGeometry extends MeshGeometry {
|
||||
constructor(...args) {
|
||||
super({});
|
||||
let options = args[0] ?? {};
|
||||
if (typeof options === "number") {
|
||||
deprecation(v8_0_0, "PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead");
|
||||
options = {
|
||||
width: options,
|
||||
height: args[1],
|
||||
verticesX: args[2],
|
||||
verticesY: args[3]
|
||||
};
|
||||
}
|
||||
this.build(options);
|
||||
}
|
||||
/**
|
||||
* Refreshes plane coordinates
|
||||
* @param options - Options to be applied to plane geometry
|
||||
*/
|
||||
build(options) {
|
||||
options = { ..._PlaneGeometry.defaultOptions, ...options };
|
||||
this.verticesX = this.verticesX ?? options.verticesX;
|
||||
this.verticesY = this.verticesY ?? options.verticesY;
|
||||
this.width = this.width ?? options.width;
|
||||
this.height = this.height ?? options.height;
|
||||
const total = this.verticesX * this.verticesY;
|
||||
const verts = [];
|
||||
const uvs = [];
|
||||
const indices = [];
|
||||
const verticesX = this.verticesX - 1;
|
||||
const verticesY = this.verticesY - 1;
|
||||
const sizeX = this.width / verticesX;
|
||||
const sizeY = this.height / verticesY;
|
||||
for (let i = 0; i < total; i++) {
|
||||
const x = i % this.verticesX;
|
||||
const y = i / this.verticesX | 0;
|
||||
verts.push(x * sizeX, y * sizeY);
|
||||
uvs.push(x / verticesX, y / verticesY);
|
||||
}
|
||||
const totalSub = verticesX * verticesY;
|
||||
for (let i = 0; i < totalSub; i++) {
|
||||
const xpos = i % verticesX;
|
||||
const ypos = i / verticesX | 0;
|
||||
const value = ypos * this.verticesX + xpos;
|
||||
const value2 = ypos * this.verticesX + xpos + 1;
|
||||
const value3 = (ypos + 1) * this.verticesX + xpos;
|
||||
const value4 = (ypos + 1) * this.verticesX + xpos + 1;
|
||||
indices.push(
|
||||
value,
|
||||
value2,
|
||||
value3,
|
||||
value2,
|
||||
value4,
|
||||
value3
|
||||
);
|
||||
}
|
||||
this.buffers[0].data = new Float32Array(verts);
|
||||
this.buffers[1].data = new Float32Array(uvs);
|
||||
this.indexBuffer.data = new Uint32Array(indices);
|
||||
this.buffers[0].update();
|
||||
this.buffers[1].update();
|
||||
this.indexBuffer.update();
|
||||
}
|
||||
};
|
||||
_PlaneGeometry.defaultOptions = {
|
||||
width: 100,
|
||||
height: 100,
|
||||
verticesX: 10,
|
||||
verticesY: 10
|
||||
};
|
||||
let PlaneGeometry = _PlaneGeometry;
|
||||
|
||||
export { PlaneGeometry };
|
||||
//# sourceMappingURL=PlaneGeometry.mjs.map
|
1
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/mesh-plane/PlaneGeometry.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user