mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Pma properties on atlas is used to detect pma textures.
This commit is contained in:
parent
69e4d365e0
commit
23ece7f4da
@ -227,6 +227,7 @@ interface WidgetPublicProperties {
|
|||||||
|
|
||||||
// Usage of this properties is discouraged because they can be made private in the future
|
// Usage of this properties is discouraged because they can be made private in the future
|
||||||
interface WidgetInternalProperties {
|
interface WidgetInternalProperties {
|
||||||
|
pma: boolean
|
||||||
currentScaleDpi: number
|
currentScaleDpi: number
|
||||||
dragging: boolean
|
dragging: boolean
|
||||||
dragX: number
|
dragX: number
|
||||||
@ -731,6 +732,12 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
|
|||||||
*/
|
*/
|
||||||
public dragging = false;
|
public dragging = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the widget has texture with premultiplied alpha
|
||||||
|
* Do not rely on this properties. It might be made private in the future.
|
||||||
|
*/
|
||||||
|
public pma = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, indicate {@link dispose} has been called and the widget cannot be used anymore
|
* If true, indicate {@link dispose} has been called and the widget cannot be used anymore
|
||||||
*/
|
*/
|
||||||
@ -981,7 +988,9 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
|
|||||||
this.overlay.assetManager.loadTextureAtlasButNoTexturesAsync(atlasPath).then(atlas => this.loadTexturesInPagesAttribute(atlas)),
|
this.overlay.assetManager.loadTextureAtlasButNoTexturesAsync(atlasPath).then(atlas => this.loadTexturesInPagesAttribute(atlas)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const atlas = this.overlay.assetManager.require(atlasPath);
|
const atlas = this.overlay.assetManager.require(atlasPath) as TextureAtlas;
|
||||||
|
this.pma = atlas.pages[0]?.pma
|
||||||
|
|
||||||
const atlasLoader = new AtlasAttachmentLoader(atlas);
|
const atlasLoader = new AtlasAttachmentLoader(atlas);
|
||||||
|
|
||||||
const skeletonLoader = isBinary ? new SkeletonBinary(atlasLoader) : new SkeletonJson(atlasLoader);
|
const skeletonLoader = isBinary ? new SkeletonBinary(atlasLoader) : new SkeletonJson(atlasLoader);
|
||||||
@ -1703,7 +1712,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
|
|||||||
const ref = this.parentElement!.getBoundingClientRect();
|
const ref = this.parentElement!.getBoundingClientRect();
|
||||||
const tempVector = new Vector3();
|
const tempVector = new Vector3();
|
||||||
this.skeletonList.forEach((widget) => {
|
this.skeletonList.forEach((widget) => {
|
||||||
const { skeleton, bounds, mode, debug, offsetX, offsetY, xAxis, yAxis, dragX, dragY, fit, loadingSpinner, onScreen, loading, clip, isDraggable } = widget;
|
const { skeleton, pma, bounds, mode, debug, offsetX, offsetY, xAxis, yAxis, dragX, dragY, fit, loadingSpinner, onScreen, loading, clip, isDraggable } = widget;
|
||||||
|
|
||||||
if ((!onScreen && dragX === 0 && dragY === 0)) return;
|
if ((!onScreen && dragX === 0 && dragY === 0)) return;
|
||||||
const elementRef = widget.getHTMLElementReference();
|
const elementRef = widget.getHTMLElementReference();
|
||||||
@ -1817,7 +1826,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
|
|||||||
widget.worldX = worldOffsetX;
|
widget.worldX = worldOffsetX;
|
||||||
widget.worldY = worldOffsetY;
|
widget.worldY = worldOffsetY;
|
||||||
|
|
||||||
renderer.drawSkeleton(skeleton, true, -1, -1, (vertices, size, vertexSize) => {
|
renderer.drawSkeleton(skeleton, pma, -1, -1, (vertices, size, vertexSize) => {
|
||||||
for (let i = 0; i < size; i += vertexSize) {
|
for (let i = 0; i < size; i += vertexSize) {
|
||||||
vertices[i] = vertices[i] + worldOffsetX;
|
vertices[i] = vertices[i] + worldOffsetX;
|
||||||
vertices[i + 1] = vertices[i + 1] + worldOffsetY;
|
vertices[i + 1] = vertices[i + 1] + worldOffsetY;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user