mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 23:34:53 +08:00
[ts] TextureAtlas and AssetManager updates.
* AssetManager's textureLoader returns Texture. * AssetManager#loadTexture success gives a Texture. * TextureAtlas no longer has a textureLoader, it creates all the pages without a texture set. * TextureAtlasRegion no longer has a texture, use region.page.texture instead. * AssetManager#loadTextureAtlas no longer parses the atlas text twice. It creates the atlas, then loads and sets all the textures.
This commit is contained in:
parent
c1e18a2237
commit
4062ccb1a9
25
spine-ts/build/spine-all.d.ts
vendored
25
spine-ts/build/spine-all.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
@ -1826,6 +1824,9 @@ declare module spine {
|
||||
controlBones: string[];
|
||||
success: (player: SpinePlayer) => void;
|
||||
error: (player: SpinePlayer, msg: string) => void;
|
||||
frame: (player: SpinePlayer) => void;
|
||||
update: (player: SpinePlayer) => void;
|
||||
draw: (player: SpinePlayer) => void;
|
||||
downloader: spine.Downloader;
|
||||
}
|
||||
interface Viewport {
|
||||
@ -1841,14 +1842,14 @@ declare module spine {
|
||||
class SpinePlayer {
|
||||
private config;
|
||||
private parent;
|
||||
private dom;
|
||||
private canvas;
|
||||
dom: HTMLElement;
|
||||
canvas: HTMLCanvasElement;
|
||||
private context;
|
||||
private sceneRenderer;
|
||||
private loadingScreen;
|
||||
private assetManager;
|
||||
private bg;
|
||||
private bgFullscreen;
|
||||
assetManager: spine.webgl.AssetManager;
|
||||
bg: Color;
|
||||
bgFullscreen: Color;
|
||||
private playerControls;
|
||||
private timelineSlider;
|
||||
private playButton;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
spine-ts/build/spine-canvas.d.ts
vendored
12
spine-ts/build/spine-canvas.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
|
||||
@ -1981,7 +1981,7 @@ var spine;
|
||||
else if (current.trackLast >= current.trackEnd && !current.mixingFrom) {
|
||||
tracks[i] = null;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
continue;
|
||||
}
|
||||
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
||||
@ -2300,7 +2300,7 @@ var spine;
|
||||
if (!current)
|
||||
return;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
var entry = current;
|
||||
while (true) {
|
||||
var from = entry.mixingFrom;
|
||||
@ -2314,9 +2314,6 @@ var spine;
|
||||
this.tracks[current.trackIndex] = null;
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
this.disposeNext(entry.next);
|
||||
};
|
||||
AnimationState.prototype.setCurrent = function (index, current, interrupt) {
|
||||
var from = this.expandToIndex(index);
|
||||
this.tracks[index] = current;
|
||||
@ -2351,12 +2348,12 @@ var spine;
|
||||
this.tracks[trackIndex] = current.mixingFrom;
|
||||
this.queue.interrupt(current);
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
}
|
||||
else
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
}
|
||||
var entry = this.trackEntry(trackIndex, animation, loop, current);
|
||||
this.setCurrent(trackIndex, entry, interrupt);
|
||||
@ -2457,7 +2454,7 @@ var spine;
|
||||
entry.mixBlend = spine.MixBlend.replace;
|
||||
return entry;
|
||||
};
|
||||
AnimationState.prototype.disposeNext = function (entry) {
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
var next = entry.next;
|
||||
while (next) {
|
||||
this.queue.dispose(next);
|
||||
@ -2871,49 +2868,31 @@ var spine;
|
||||
if (error === void 0) { error = null; }
|
||||
var parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
|
||||
path = this.start(path);
|
||||
this.downloader.downloadText(path, function (atlasData) {
|
||||
var pagesLoaded = 0;
|
||||
var atlasPages = new Array();
|
||||
this.downloader.downloadText(path, function (atlasText) {
|
||||
try {
|
||||
var atlas = new spine.TextureAtlas(atlasData, function (path) {
|
||||
atlasPages.push(parent == "" ? path : parent + "/" + path);
|
||||
var image = document.createElement("img");
|
||||
image.width = 16;
|
||||
image.height = 16;
|
||||
return new spine.FakeTexture(image);
|
||||
});
|
||||
var _loop_1 = function (atlasPage) {
|
||||
var pageLoadError = false;
|
||||
_this.loadTexture(atlasPage, function (imagePath, image) {
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length) {
|
||||
if (!pageLoadError) {
|
||||
try {
|
||||
_this.success(success, path, new spine.TextureAtlas(atlasData, function (path) {
|
||||
return _this.get(parent == "" ? path : parent + "/" + path);
|
||||
}));
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}
|
||||
else
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
var atlas_1 = new spine.TextureAtlas(atlasText);
|
||||
var toLoad_1 = atlas_1.pages.length, abort_1 = false;
|
||||
var _loop_1 = function (page) {
|
||||
_this.loadTexture(parent == "" ? page.name : parent + "/" + page.name, function (imagePath, texture) {
|
||||
if (!abort_1) {
|
||||
page.setTexture(texture);
|
||||
if (--toLoad_1 == 0)
|
||||
_this.success(success, path, atlas_1);
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1) {
|
||||
abort_1 = true;
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
}
|
||||
}, function (imagePath, errorMessage) {
|
||||
pageLoadError = true;
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
});
|
||||
};
|
||||
for (var _i = 0, atlasPages_1 = atlasPages; _i < atlasPages_1.length; _i++) {
|
||||
var atlasPage = atlasPages_1[_i];
|
||||
_loop_1(atlasPage);
|
||||
for (var _i = 0, _a = atlas_1.pages; _i < _a.length; _i++) {
|
||||
var page = _a[_i];
|
||||
_loop_1(page);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
_this.error(error, path, "Couldn't parse texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}, function (status, responseText) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText);
|
||||
@ -7371,14 +7350,9 @@ var spine;
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlas = (function () {
|
||||
function TextureAtlas(atlasText, textureLoader) {
|
||||
function TextureAtlas(atlasText) {
|
||||
this.pages = new Array();
|
||||
this.regions = new Array();
|
||||
this.load(atlasText, textureLoader);
|
||||
}
|
||||
TextureAtlas.prototype.load = function (atlasText, textureLoader) {
|
||||
if (!textureLoader)
|
||||
throw new Error("textureLoader cannot be null.");
|
||||
var reader = new TextureAtlasReader(atlasText);
|
||||
var entry = new Array(4);
|
||||
var page = null;
|
||||
@ -7471,9 +7445,6 @@ var spine;
|
||||
if (field)
|
||||
field();
|
||||
}
|
||||
page.texture = textureLoader(page.name);
|
||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
||||
this.pages.push(page);
|
||||
}
|
||||
else {
|
||||
@ -7519,11 +7490,10 @@ var spine;
|
||||
region.u2 = (region.x + region.width) / page.width;
|
||||
region.v2 = (region.y + region.height) / page.height;
|
||||
}
|
||||
region.texture = page.texture;
|
||||
this.regions.push(region);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
TextureAtlas.prototype.findRegion = function (name) {
|
||||
for (var i = 0; i < this.regions.length; i++) {
|
||||
if (this.regions[i].name == name) {
|
||||
@ -7581,6 +7551,11 @@ var spine;
|
||||
this.uWrap = spine.TextureWrap.ClampToEdge;
|
||||
this.vWrap = spine.TextureWrap.ClampToEdge;
|
||||
}
|
||||
TextureAtlasPage.prototype.setTexture = function (texture) {
|
||||
this.texture = texture;
|
||||
texture.setFilters(this.minFilter, this.magFilter);
|
||||
texture.setWraps(this.uWrap, this.vWrap);
|
||||
};
|
||||
return TextureAtlasPage;
|
||||
}());
|
||||
spine.TextureAtlasPage = TextureAtlasPage;
|
||||
@ -8630,8 +8605,8 @@ var spine;
|
||||
var n = this.uvs.length;
|
||||
var u = this.region.u, v = this.region.v, width = 0, height = 0;
|
||||
if (this.region instanceof spine.TextureAtlasRegion) {
|
||||
var region = this.region;
|
||||
var textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;
|
||||
var region = this.region, image = region.page.texture.getImage();
|
||||
var textureWidth = image.width, textureHeight = image.height;
|
||||
switch (region.degrees) {
|
||||
case 90:
|
||||
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
||||
@ -9066,7 +9041,7 @@ var spine;
|
||||
if (!(attachment instanceof spine.RegionAttachment))
|
||||
continue;
|
||||
var region = attachment.region;
|
||||
var image = region.texture.getImage();
|
||||
var image = region.page.texture.getImage();
|
||||
var slotColor = slot.color;
|
||||
var regionColor = attachment.color;
|
||||
color.set(skeletonColor.r * slotColor.r * regionColor.r, skeletonColor.g * slotColor.g * regionColor.g, skeletonColor.b * slotColor.b * regionColor.b, skeletonColor.a * slotColor.a * regionColor.a);
|
||||
@ -9113,13 +9088,13 @@ var spine;
|
||||
vertices = this.computeRegionVertices(slot, regionAttachment, false);
|
||||
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
||||
region = regionAttachment.region;
|
||||
texture = region.texture.getImage();
|
||||
texture = region.page.texture.getImage();
|
||||
}
|
||||
else if (attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment;
|
||||
vertices = this.computeMeshVertices(slot, mesh, false);
|
||||
triangles = mesh.triangles;
|
||||
texture = mesh.region.renderObject.texture.getImage();
|
||||
texture = mesh.region.renderObject.page.texture.getImage();
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
File diff suppressed because one or more lines are too long
12
spine-ts/build/spine-core.d.ts
vendored
12
spine-ts/build/spine-core.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
|
||||
@ -1981,7 +1981,7 @@ var spine;
|
||||
else if (current.trackLast >= current.trackEnd && !current.mixingFrom) {
|
||||
tracks[i] = null;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
continue;
|
||||
}
|
||||
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
||||
@ -2300,7 +2300,7 @@ var spine;
|
||||
if (!current)
|
||||
return;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
var entry = current;
|
||||
while (true) {
|
||||
var from = entry.mixingFrom;
|
||||
@ -2314,9 +2314,6 @@ var spine;
|
||||
this.tracks[current.trackIndex] = null;
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
this.disposeNext(entry.next);
|
||||
};
|
||||
AnimationState.prototype.setCurrent = function (index, current, interrupt) {
|
||||
var from = this.expandToIndex(index);
|
||||
this.tracks[index] = current;
|
||||
@ -2351,12 +2348,12 @@ var spine;
|
||||
this.tracks[trackIndex] = current.mixingFrom;
|
||||
this.queue.interrupt(current);
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
}
|
||||
else
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
}
|
||||
var entry = this.trackEntry(trackIndex, animation, loop, current);
|
||||
this.setCurrent(trackIndex, entry, interrupt);
|
||||
@ -2457,7 +2454,7 @@ var spine;
|
||||
entry.mixBlend = spine.MixBlend.replace;
|
||||
return entry;
|
||||
};
|
||||
AnimationState.prototype.disposeNext = function (entry) {
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
var next = entry.next;
|
||||
while (next) {
|
||||
this.queue.dispose(next);
|
||||
@ -2871,49 +2868,31 @@ var spine;
|
||||
if (error === void 0) { error = null; }
|
||||
var parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
|
||||
path = this.start(path);
|
||||
this.downloader.downloadText(path, function (atlasData) {
|
||||
var pagesLoaded = 0;
|
||||
var atlasPages = new Array();
|
||||
this.downloader.downloadText(path, function (atlasText) {
|
||||
try {
|
||||
var atlas = new spine.TextureAtlas(atlasData, function (path) {
|
||||
atlasPages.push(parent == "" ? path : parent + "/" + path);
|
||||
var image = document.createElement("img");
|
||||
image.width = 16;
|
||||
image.height = 16;
|
||||
return new spine.FakeTexture(image);
|
||||
});
|
||||
var _loop_1 = function (atlasPage) {
|
||||
var pageLoadError = false;
|
||||
_this.loadTexture(atlasPage, function (imagePath, image) {
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length) {
|
||||
if (!pageLoadError) {
|
||||
try {
|
||||
_this.success(success, path, new spine.TextureAtlas(atlasData, function (path) {
|
||||
return _this.get(parent == "" ? path : parent + "/" + path);
|
||||
}));
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}
|
||||
else
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
var atlas_1 = new spine.TextureAtlas(atlasText);
|
||||
var toLoad_1 = atlas_1.pages.length, abort_1 = false;
|
||||
var _loop_1 = function (page) {
|
||||
_this.loadTexture(parent == "" ? page.name : parent + "/" + page.name, function (imagePath, texture) {
|
||||
if (!abort_1) {
|
||||
page.setTexture(texture);
|
||||
if (--toLoad_1 == 0)
|
||||
_this.success(success, path, atlas_1);
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1) {
|
||||
abort_1 = true;
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
}
|
||||
}, function (imagePath, errorMessage) {
|
||||
pageLoadError = true;
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
});
|
||||
};
|
||||
for (var _i = 0, atlasPages_1 = atlasPages; _i < atlasPages_1.length; _i++) {
|
||||
var atlasPage = atlasPages_1[_i];
|
||||
_loop_1(atlasPage);
|
||||
for (var _i = 0, _a = atlas_1.pages; _i < _a.length; _i++) {
|
||||
var page = _a[_i];
|
||||
_loop_1(page);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
_this.error(error, path, "Couldn't parse texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}, function (status, responseText) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText);
|
||||
@ -7371,14 +7350,9 @@ var spine;
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlas = (function () {
|
||||
function TextureAtlas(atlasText, textureLoader) {
|
||||
function TextureAtlas(atlasText) {
|
||||
this.pages = new Array();
|
||||
this.regions = new Array();
|
||||
this.load(atlasText, textureLoader);
|
||||
}
|
||||
TextureAtlas.prototype.load = function (atlasText, textureLoader) {
|
||||
if (!textureLoader)
|
||||
throw new Error("textureLoader cannot be null.");
|
||||
var reader = new TextureAtlasReader(atlasText);
|
||||
var entry = new Array(4);
|
||||
var page = null;
|
||||
@ -7471,9 +7445,6 @@ var spine;
|
||||
if (field)
|
||||
field();
|
||||
}
|
||||
page.texture = textureLoader(page.name);
|
||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
||||
this.pages.push(page);
|
||||
}
|
||||
else {
|
||||
@ -7519,11 +7490,10 @@ var spine;
|
||||
region.u2 = (region.x + region.width) / page.width;
|
||||
region.v2 = (region.y + region.height) / page.height;
|
||||
}
|
||||
region.texture = page.texture;
|
||||
this.regions.push(region);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
TextureAtlas.prototype.findRegion = function (name) {
|
||||
for (var i = 0; i < this.regions.length; i++) {
|
||||
if (this.regions[i].name == name) {
|
||||
@ -7581,6 +7551,11 @@ var spine;
|
||||
this.uWrap = spine.TextureWrap.ClampToEdge;
|
||||
this.vWrap = spine.TextureWrap.ClampToEdge;
|
||||
}
|
||||
TextureAtlasPage.prototype.setTexture = function (texture) {
|
||||
this.texture = texture;
|
||||
texture.setFilters(this.minFilter, this.magFilter);
|
||||
texture.setWraps(this.uWrap, this.vWrap);
|
||||
};
|
||||
return TextureAtlasPage;
|
||||
}());
|
||||
spine.TextureAtlasPage = TextureAtlasPage;
|
||||
@ -8630,8 +8605,8 @@ var spine;
|
||||
var n = this.uvs.length;
|
||||
var u = this.region.u, v = this.region.v, width = 0, height = 0;
|
||||
if (this.region instanceof spine.TextureAtlasRegion) {
|
||||
var region = this.region;
|
||||
var textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;
|
||||
var region = this.region, image = region.page.texture.getImage();
|
||||
var textureWidth = image.width, textureHeight = image.height;
|
||||
switch (region.degrees) {
|
||||
case 90:
|
||||
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
||||
|
||||
File diff suppressed because one or more lines are too long
25
spine-ts/build/spine-player.d.ts
vendored
25
spine-ts/build/spine-player.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
@ -1730,6 +1728,9 @@ declare module spine {
|
||||
controlBones: string[];
|
||||
success: (player: SpinePlayer) => void;
|
||||
error: (player: SpinePlayer, msg: string) => void;
|
||||
frame: (player: SpinePlayer) => void;
|
||||
update: (player: SpinePlayer) => void;
|
||||
draw: (player: SpinePlayer) => void;
|
||||
downloader: spine.Downloader;
|
||||
}
|
||||
interface Viewport {
|
||||
@ -1745,14 +1746,14 @@ declare module spine {
|
||||
class SpinePlayer {
|
||||
private config;
|
||||
private parent;
|
||||
private dom;
|
||||
private canvas;
|
||||
dom: HTMLElement;
|
||||
canvas: HTMLCanvasElement;
|
||||
private context;
|
||||
private sceneRenderer;
|
||||
private loadingScreen;
|
||||
private assetManager;
|
||||
private bg;
|
||||
private bgFullscreen;
|
||||
assetManager: spine.webgl.AssetManager;
|
||||
bg: Color;
|
||||
bgFullscreen: Color;
|
||||
private playerControls;
|
||||
private timelineSlider;
|
||||
private playButton;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
spine-ts/build/spine-threejs.d.ts
vendored
12
spine-ts/build/spine-threejs.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
|
||||
@ -1981,7 +1981,7 @@ var spine;
|
||||
else if (current.trackLast >= current.trackEnd && !current.mixingFrom) {
|
||||
tracks[i] = null;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
continue;
|
||||
}
|
||||
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
||||
@ -2300,7 +2300,7 @@ var spine;
|
||||
if (!current)
|
||||
return;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
var entry = current;
|
||||
while (true) {
|
||||
var from = entry.mixingFrom;
|
||||
@ -2314,9 +2314,6 @@ var spine;
|
||||
this.tracks[current.trackIndex] = null;
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
this.disposeNext(entry.next);
|
||||
};
|
||||
AnimationState.prototype.setCurrent = function (index, current, interrupt) {
|
||||
var from = this.expandToIndex(index);
|
||||
this.tracks[index] = current;
|
||||
@ -2351,12 +2348,12 @@ var spine;
|
||||
this.tracks[trackIndex] = current.mixingFrom;
|
||||
this.queue.interrupt(current);
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
}
|
||||
else
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
}
|
||||
var entry = this.trackEntry(trackIndex, animation, loop, current);
|
||||
this.setCurrent(trackIndex, entry, interrupt);
|
||||
@ -2457,7 +2454,7 @@ var spine;
|
||||
entry.mixBlend = spine.MixBlend.replace;
|
||||
return entry;
|
||||
};
|
||||
AnimationState.prototype.disposeNext = function (entry) {
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
var next = entry.next;
|
||||
while (next) {
|
||||
this.queue.dispose(next);
|
||||
@ -2871,49 +2868,31 @@ var spine;
|
||||
if (error === void 0) { error = null; }
|
||||
var parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
|
||||
path = this.start(path);
|
||||
this.downloader.downloadText(path, function (atlasData) {
|
||||
var pagesLoaded = 0;
|
||||
var atlasPages = new Array();
|
||||
this.downloader.downloadText(path, function (atlasText) {
|
||||
try {
|
||||
var atlas = new spine.TextureAtlas(atlasData, function (path) {
|
||||
atlasPages.push(parent == "" ? path : parent + "/" + path);
|
||||
var image = document.createElement("img");
|
||||
image.width = 16;
|
||||
image.height = 16;
|
||||
return new spine.FakeTexture(image);
|
||||
});
|
||||
var _loop_1 = function (atlasPage) {
|
||||
var pageLoadError = false;
|
||||
_this.loadTexture(atlasPage, function (imagePath, image) {
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length) {
|
||||
if (!pageLoadError) {
|
||||
try {
|
||||
_this.success(success, path, new spine.TextureAtlas(atlasData, function (path) {
|
||||
return _this.get(parent == "" ? path : parent + "/" + path);
|
||||
}));
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}
|
||||
else
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
var atlas_1 = new spine.TextureAtlas(atlasText);
|
||||
var toLoad_1 = atlas_1.pages.length, abort_1 = false;
|
||||
var _loop_1 = function (page) {
|
||||
_this.loadTexture(parent == "" ? page.name : parent + "/" + page.name, function (imagePath, texture) {
|
||||
if (!abort_1) {
|
||||
page.setTexture(texture);
|
||||
if (--toLoad_1 == 0)
|
||||
_this.success(success, path, atlas_1);
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1) {
|
||||
abort_1 = true;
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
}
|
||||
}, function (imagePath, errorMessage) {
|
||||
pageLoadError = true;
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
});
|
||||
};
|
||||
for (var _i = 0, atlasPages_1 = atlasPages; _i < atlasPages_1.length; _i++) {
|
||||
var atlasPage = atlasPages_1[_i];
|
||||
_loop_1(atlasPage);
|
||||
for (var _i = 0, _a = atlas_1.pages; _i < _a.length; _i++) {
|
||||
var page = _a[_i];
|
||||
_loop_1(page);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
_this.error(error, path, "Couldn't parse texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}, function (status, responseText) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText);
|
||||
@ -7371,14 +7350,9 @@ var spine;
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlas = (function () {
|
||||
function TextureAtlas(atlasText, textureLoader) {
|
||||
function TextureAtlas(atlasText) {
|
||||
this.pages = new Array();
|
||||
this.regions = new Array();
|
||||
this.load(atlasText, textureLoader);
|
||||
}
|
||||
TextureAtlas.prototype.load = function (atlasText, textureLoader) {
|
||||
if (!textureLoader)
|
||||
throw new Error("textureLoader cannot be null.");
|
||||
var reader = new TextureAtlasReader(atlasText);
|
||||
var entry = new Array(4);
|
||||
var page = null;
|
||||
@ -7471,9 +7445,6 @@ var spine;
|
||||
if (field)
|
||||
field();
|
||||
}
|
||||
page.texture = textureLoader(page.name);
|
||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
||||
this.pages.push(page);
|
||||
}
|
||||
else {
|
||||
@ -7519,11 +7490,10 @@ var spine;
|
||||
region.u2 = (region.x + region.width) / page.width;
|
||||
region.v2 = (region.y + region.height) / page.height;
|
||||
}
|
||||
region.texture = page.texture;
|
||||
this.regions.push(region);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
TextureAtlas.prototype.findRegion = function (name) {
|
||||
for (var i = 0; i < this.regions.length; i++) {
|
||||
if (this.regions[i].name == name) {
|
||||
@ -7581,6 +7551,11 @@ var spine;
|
||||
this.uWrap = spine.TextureWrap.ClampToEdge;
|
||||
this.vWrap = spine.TextureWrap.ClampToEdge;
|
||||
}
|
||||
TextureAtlasPage.prototype.setTexture = function (texture) {
|
||||
this.texture = texture;
|
||||
texture.setFilters(this.minFilter, this.magFilter);
|
||||
texture.setWraps(this.uWrap, this.vWrap);
|
||||
};
|
||||
return TextureAtlasPage;
|
||||
}());
|
||||
spine.TextureAtlasPage = TextureAtlasPage;
|
||||
@ -8630,8 +8605,8 @@ var spine;
|
||||
var n = this.uvs.length;
|
||||
var u = this.region.u, v = this.region.v, width = 0, height = 0;
|
||||
if (this.region instanceof spine.TextureAtlasRegion) {
|
||||
var region = this.region;
|
||||
var textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;
|
||||
var region = this.region, image = region.page.texture.getImage();
|
||||
var textureWidth = image.width, textureHeight = image.height;
|
||||
switch (region.degrees) {
|
||||
case 90:
|
||||
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
||||
@ -9234,7 +9209,7 @@ var spine;
|
||||
region.computeWorldVertices(slot.bone, vertices, 0, vertexSize);
|
||||
triangles = SkeletonMesh.QUAD_TRIANGLES;
|
||||
uvs = region.uvs;
|
||||
texture = region.region.renderObject.texture;
|
||||
texture = region.region.renderObject.page.texture;
|
||||
}
|
||||
else if (attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment;
|
||||
@ -9247,7 +9222,7 @@ var spine;
|
||||
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, vertexSize);
|
||||
triangles = mesh.triangles;
|
||||
uvs = mesh.uvs;
|
||||
texture = mesh.region.renderObject.texture;
|
||||
texture = mesh.region.renderObject.page.texture;
|
||||
}
|
||||
else if (attachment instanceof spine.ClippingAttachment) {
|
||||
var clip = (attachment);
|
||||
|
||||
File diff suppressed because one or more lines are too long
12
spine-ts/build/spine-webgl.d.ts
vendored
12
spine-ts/build/spine-webgl.d.ts
vendored
@ -232,7 +232,6 @@ declare module spine {
|
||||
queueEvents(entry: TrackEntry, animationTime: number): void;
|
||||
clearTracks(): void;
|
||||
clearTrack(trackIndex: number): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
|
||||
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
||||
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
||||
@ -243,7 +242,7 @@ declare module spine {
|
||||
setEmptyAnimations(mixDuration?: number): void;
|
||||
expandToIndex(index: number): TrackEntry;
|
||||
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
|
||||
disposeNext(entry: TrackEntry): void;
|
||||
clearNext(entry: TrackEntry): void;
|
||||
_animationsChanged(): void;
|
||||
computeHold(entry: TrackEntry): void;
|
||||
getCurrent(trackIndex: number): TrackEntry;
|
||||
@ -351,7 +350,7 @@ declare module spine {
|
||||
private errors;
|
||||
private toLoad;
|
||||
private loaded;
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix?: string, downloader?: Downloader);
|
||||
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader);
|
||||
private start;
|
||||
private success;
|
||||
private error;
|
||||
@ -359,7 +358,7 @@ declare module spine {
|
||||
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
|
||||
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
|
||||
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, image: HTMLImageElement | ImageBitmap) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
|
||||
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void): void;
|
||||
get(path: string): any;
|
||||
remove(path: string): any;
|
||||
@ -847,8 +846,7 @@ declare module spine {
|
||||
class TextureAtlas implements Disposable {
|
||||
pages: TextureAtlasPage[];
|
||||
regions: TextureAtlasRegion[];
|
||||
constructor(atlasText: string, textureLoader: (path: string) => any);
|
||||
private load;
|
||||
constructor(atlasText: string);
|
||||
findRegion(name: string): TextureAtlasRegion;
|
||||
dispose(): void;
|
||||
}
|
||||
@ -862,6 +860,7 @@ declare module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
setTexture(texture: Texture): void;
|
||||
}
|
||||
class TextureAtlasRegion extends TextureRegion {
|
||||
page: TextureAtlasPage;
|
||||
@ -874,7 +873,6 @@ declare module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
|
||||
@ -1981,7 +1981,7 @@ var spine;
|
||||
else if (current.trackLast >= current.trackEnd && !current.mixingFrom) {
|
||||
tracks[i] = null;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
continue;
|
||||
}
|
||||
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
||||
@ -2300,7 +2300,7 @@ var spine;
|
||||
if (!current)
|
||||
return;
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
var entry = current;
|
||||
while (true) {
|
||||
var from = entry.mixingFrom;
|
||||
@ -2314,9 +2314,6 @@ var spine;
|
||||
this.tracks[current.trackIndex] = null;
|
||||
this.queue.drain();
|
||||
};
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
this.disposeNext(entry.next);
|
||||
};
|
||||
AnimationState.prototype.setCurrent = function (index, current, interrupt) {
|
||||
var from = this.expandToIndex(index);
|
||||
this.tracks[index] = current;
|
||||
@ -2351,12 +2348,12 @@ var spine;
|
||||
this.tracks[trackIndex] = current.mixingFrom;
|
||||
this.queue.interrupt(current);
|
||||
this.queue.end(current);
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
}
|
||||
else
|
||||
this.disposeNext(current);
|
||||
this.clearNext(current);
|
||||
}
|
||||
var entry = this.trackEntry(trackIndex, animation, loop, current);
|
||||
this.setCurrent(trackIndex, entry, interrupt);
|
||||
@ -2457,7 +2454,7 @@ var spine;
|
||||
entry.mixBlend = spine.MixBlend.replace;
|
||||
return entry;
|
||||
};
|
||||
AnimationState.prototype.disposeNext = function (entry) {
|
||||
AnimationState.prototype.clearNext = function (entry) {
|
||||
var next = entry.next;
|
||||
while (next) {
|
||||
this.queue.dispose(next);
|
||||
@ -2871,49 +2868,31 @@ var spine;
|
||||
if (error === void 0) { error = null; }
|
||||
var parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
|
||||
path = this.start(path);
|
||||
this.downloader.downloadText(path, function (atlasData) {
|
||||
var pagesLoaded = 0;
|
||||
var atlasPages = new Array();
|
||||
this.downloader.downloadText(path, function (atlasText) {
|
||||
try {
|
||||
var atlas = new spine.TextureAtlas(atlasData, function (path) {
|
||||
atlasPages.push(parent == "" ? path : parent + "/" + path);
|
||||
var image = document.createElement("img");
|
||||
image.width = 16;
|
||||
image.height = 16;
|
||||
return new spine.FakeTexture(image);
|
||||
});
|
||||
var _loop_1 = function (atlasPage) {
|
||||
var pageLoadError = false;
|
||||
_this.loadTexture(atlasPage, function (imagePath, image) {
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length) {
|
||||
if (!pageLoadError) {
|
||||
try {
|
||||
_this.success(success, path, new spine.TextureAtlas(atlasData, function (path) {
|
||||
return _this.get(parent == "" ? path : parent + "/" + path);
|
||||
}));
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}
|
||||
else
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
var atlas_1 = new spine.TextureAtlas(atlasText);
|
||||
var toLoad_1 = atlas_1.pages.length, abort_1 = false;
|
||||
var _loop_1 = function (page) {
|
||||
_this.loadTexture(parent == "" ? page.name : parent + "/" + page.name, function (imagePath, texture) {
|
||||
if (!abort_1) {
|
||||
page.setTexture(texture);
|
||||
if (--toLoad_1 == 0)
|
||||
_this.success(success, path, atlas_1);
|
||||
}
|
||||
}, function (imagePath, message) {
|
||||
if (!abort_1) {
|
||||
abort_1 = true;
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page " + imagePath + ": " + message);
|
||||
}
|
||||
}, function (imagePath, errorMessage) {
|
||||
pageLoadError = true;
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length)
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + " page: " + imagePath);
|
||||
});
|
||||
};
|
||||
for (var _i = 0, atlasPages_1 = atlasPages; _i < atlasPages_1.length; _i++) {
|
||||
var atlasPage = atlasPages_1[_i];
|
||||
_loop_1(atlasPage);
|
||||
for (var _i = 0, _a = atlas_1.pages; _i < _a.length; _i++) {
|
||||
var page = _a[_i];
|
||||
_loop_1(page);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": " + e.message);
|
||||
_this.error(error, path, "Couldn't parse texture atlas " + path + ": " + e.message);
|
||||
}
|
||||
}, function (status, responseText) {
|
||||
_this.error(error, path, "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText);
|
||||
@ -7371,14 +7350,9 @@ var spine;
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var TextureAtlas = (function () {
|
||||
function TextureAtlas(atlasText, textureLoader) {
|
||||
function TextureAtlas(atlasText) {
|
||||
this.pages = new Array();
|
||||
this.regions = new Array();
|
||||
this.load(atlasText, textureLoader);
|
||||
}
|
||||
TextureAtlas.prototype.load = function (atlasText, textureLoader) {
|
||||
if (!textureLoader)
|
||||
throw new Error("textureLoader cannot be null.");
|
||||
var reader = new TextureAtlasReader(atlasText);
|
||||
var entry = new Array(4);
|
||||
var page = null;
|
||||
@ -7471,9 +7445,6 @@ var spine;
|
||||
if (field)
|
||||
field();
|
||||
}
|
||||
page.texture = textureLoader(page.name);
|
||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
||||
this.pages.push(page);
|
||||
}
|
||||
else {
|
||||
@ -7519,11 +7490,10 @@ var spine;
|
||||
region.u2 = (region.x + region.width) / page.width;
|
||||
region.v2 = (region.y + region.height) / page.height;
|
||||
}
|
||||
region.texture = page.texture;
|
||||
this.regions.push(region);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
TextureAtlas.prototype.findRegion = function (name) {
|
||||
for (var i = 0; i < this.regions.length; i++) {
|
||||
if (this.regions[i].name == name) {
|
||||
@ -7581,6 +7551,11 @@ var spine;
|
||||
this.uWrap = spine.TextureWrap.ClampToEdge;
|
||||
this.vWrap = spine.TextureWrap.ClampToEdge;
|
||||
}
|
||||
TextureAtlasPage.prototype.setTexture = function (texture) {
|
||||
this.texture = texture;
|
||||
texture.setFilters(this.minFilter, this.magFilter);
|
||||
texture.setWraps(this.uWrap, this.vWrap);
|
||||
};
|
||||
return TextureAtlasPage;
|
||||
}());
|
||||
spine.TextureAtlasPage = TextureAtlasPage;
|
||||
@ -8630,8 +8605,8 @@ var spine;
|
||||
var n = this.uvs.length;
|
||||
var u = this.region.u, v = this.region.v, width = 0, height = 0;
|
||||
if (this.region instanceof spine.TextureAtlasRegion) {
|
||||
var region = this.region;
|
||||
var textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;
|
||||
var region = this.region, image = region.page.texture.getImage();
|
||||
var textureWidth = image.width, textureHeight = image.height;
|
||||
switch (region.degrees) {
|
||||
case 90:
|
||||
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
||||
@ -10383,7 +10358,7 @@ var spine;
|
||||
quad[i++] = 0;
|
||||
quad[i] = 0;
|
||||
}
|
||||
this.batcher.draw(region.texture, quad, QUAD_TRIANGLES);
|
||||
this.batcher.draw(region.page.texture, quad, QUAD_TRIANGLES);
|
||||
};
|
||||
SceneRenderer.prototype.line = function (x, y, x2, y2, color, color2) {
|
||||
if (color === void 0) { color = null; }
|
||||
@ -11264,7 +11239,7 @@ var spine;
|
||||
region.computeWorldVertices(slot.bone, renderable.vertices, 0, clippedVertexSize);
|
||||
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
||||
uvs = region.uvs;
|
||||
texture = region.region.renderObject.texture;
|
||||
texture = region.region.renderObject.page.texture;
|
||||
attachmentColor = region.color;
|
||||
}
|
||||
else if (attachment instanceof spine.MeshAttachment) {
|
||||
@ -11277,7 +11252,7 @@ var spine;
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, renderable.vertices, 0, clippedVertexSize);
|
||||
triangles = mesh.triangles;
|
||||
texture = mesh.region.renderObject.texture;
|
||||
texture = mesh.region.renderObject.page.texture;
|
||||
uvs = mesh.uvs;
|
||||
attachmentColor = mesh.color;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -64,7 +64,7 @@ module spine.canvas {
|
||||
let attachment = slot.getAttachment();
|
||||
if (!(attachment instanceof RegionAttachment)) continue;
|
||||
let region: TextureAtlasRegion = <TextureAtlasRegion>attachment.region;
|
||||
let image: HTMLImageElement = (<CanvasTexture>region.texture).getImage() as HTMLImageElement;
|
||||
let image: HTMLImageElement = (<CanvasTexture>region.page.texture).getImage() as HTMLImageElement;
|
||||
|
||||
let slotColor = slot.color;
|
||||
let regionColor = attachment.color;
|
||||
@ -126,12 +126,12 @@ module spine.canvas {
|
||||
vertices = this.computeRegionVertices(slot, regionAttachment, false);
|
||||
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
||||
region = <TextureAtlasRegion>regionAttachment.region;
|
||||
texture = (<CanvasTexture>region.texture).getImage() as HTMLImageElement;
|
||||
texture = (<CanvasTexture>region.page.texture).getImage() as HTMLImageElement;
|
||||
} else if (attachment instanceof MeshAttachment) {
|
||||
let mesh = <MeshAttachment>attachment;
|
||||
vertices = this.computeMeshVertices(slot, mesh, false);
|
||||
triangles = mesh.triangles;
|
||||
texture = (<TextureAtlasRegion>mesh.region.renderObject).texture.getImage() as HTMLImageElement;
|
||||
texture = (<TextureAtlasRegion>mesh.region.renderObject).page.texture.getImage() as HTMLImageElement;
|
||||
} else
|
||||
continue;
|
||||
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
module spine {
|
||||
export class AssetManager implements Disposable {
|
||||
private pathPrefix: string;
|
||||
private textureLoader: (image: HTMLImageElement | ImageBitmap) => any;
|
||||
private textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture;
|
||||
private downloader: Downloader;
|
||||
private assets: Map<any> = {};
|
||||
private errors: Map<string> = {};
|
||||
private toLoad = 0;
|
||||
private loaded = 0;
|
||||
|
||||
constructor (textureLoader: (image: HTMLImageElement | ImageBitmap) => any, pathPrefix: string = "", downloader: Downloader = null) {
|
||||
constructor (textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix: string = "", downloader: Downloader = null) {
|
||||
this.textureLoader = textureLoader;
|
||||
this.pathPrefix = pathPrefix;
|
||||
this.downloader = downloader || new Downloader();
|
||||
@ -103,7 +103,7 @@ module spine {
|
||||
}
|
||||
|
||||
loadTexture (path: string,
|
||||
success: (path: string, image: HTMLImageElement | ImageBitmap) => void = null,
|
||||
success: (path: string, texture: Texture) => void = null,
|
||||
error: (path: string, message: string) => void = null) {
|
||||
path = this.start(path);
|
||||
|
||||
@ -140,42 +140,28 @@ module spine {
|
||||
let parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
|
||||
path = this.start(path);
|
||||
|
||||
this.downloader.downloadText(path, (atlasData: string): void => {
|
||||
let pagesLoaded = 0;
|
||||
let atlasPages = new Array<string>();
|
||||
this.downloader.downloadText(path, (atlasText: string): void => {
|
||||
try {
|
||||
let atlas = new TextureAtlas(atlasData, (path: string) => {
|
||||
atlasPages.push(parent == "" ? path : parent + "/" + path);
|
||||
let image = document.createElement("img") as HTMLImageElement;
|
||||
image.width = 16;
|
||||
image.height = 16;
|
||||
return new FakeTexture(image);
|
||||
});
|
||||
for (let atlasPage of atlasPages) {
|
||||
let pageLoadError = false;
|
||||
this.loadTexture(atlasPage, (imagePath: string, image: HTMLImageElement | ImageBitmap) => {
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length) {
|
||||
if (!pageLoadError) {
|
||||
try {
|
||||
this.success(success, path, new TextureAtlas(atlasData, (path: string) => {
|
||||
return this.get(parent == "" ? path : parent + "/" + path);
|
||||
}));
|
||||
} catch (e) {
|
||||
this.error(error, path, `Couldn't load texture atlas ${path}: ${e.message}`);
|
||||
}
|
||||
} else
|
||||
this.error(error, path, `Couldn't load texture atlas ${path} page: ${imagePath}`);
|
||||
let atlas = new TextureAtlas(atlasText);
|
||||
let toLoad = atlas.pages.length, abort = false;
|
||||
for (let page of atlas.pages) {
|
||||
this.loadTexture(parent == "" ? page.name : parent + "/" + page.name,
|
||||
(imagePath: string, texture: Texture) => {
|
||||
if (!abort) {
|
||||
page.setTexture(texture);
|
||||
if (--toLoad == 0) this.success(success, path, atlas);
|
||||
}
|
||||
},
|
||||
(imagePath: string, message: string) => {
|
||||
if (!abort) {
|
||||
abort = true;
|
||||
this.error(error, path, `Couldn't load texture atlas ${path} page ${imagePath}: ${message}`);
|
||||
}
|
||||
}
|
||||
}, (imagePath: string, errorMessage: string) => {
|
||||
pageLoadError = true;
|
||||
pagesLoaded++;
|
||||
if (pagesLoaded == atlasPages.length)
|
||||
this.error(error, path, `Couldn't load texture atlas ${path} page: ${imagePath}`);
|
||||
});
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
this.error(error, path, `Couldn't load texture atlas ${path}: ${e.message}`);
|
||||
this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
|
||||
}
|
||||
}, (status: number, responseText: string): void => {
|
||||
this.error(error, path, `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`);
|
||||
|
||||
@ -32,13 +32,7 @@ module spine {
|
||||
pages = new Array<TextureAtlasPage>();
|
||||
regions = new Array<TextureAtlasRegion>();
|
||||
|
||||
constructor (atlasText: string, textureLoader: (path: string) => any) {
|
||||
this.load(atlasText, textureLoader);
|
||||
}
|
||||
|
||||
private load (atlasText: string, textureLoader: (path: string) => any) {
|
||||
if (!textureLoader) throw new Error("textureLoader cannot be null.");
|
||||
|
||||
constructor (atlasText: string) {
|
||||
let reader = new TextureAtlasReader(atlasText);
|
||||
let entry = new Array<string>(4);
|
||||
let page: TextureAtlasPage = null;
|
||||
@ -131,11 +125,6 @@ module spine {
|
||||
let field: Function = pageFields[entry[0]];
|
||||
if (field) field();
|
||||
}
|
||||
page.texture = textureLoader(page.name);
|
||||
page.texture.setFilters(page.minFilter, page.magFilter);
|
||||
page.texture.setWraps(page.uWrap, page.vWrap);
|
||||
// page.width = page.texture.getImage().width;
|
||||
// page.height = page.texture.getImage().height;
|
||||
this.pages.push(page);
|
||||
} else {
|
||||
region = new TextureAtlasRegion();
|
||||
@ -179,7 +168,6 @@ module spine {
|
||||
region.u2 = (region.x + region.width) / page.width;
|
||||
region.v2 = (region.y + region.height) / page.height;
|
||||
}
|
||||
region.texture = page.texture;
|
||||
this.regions.push(region);
|
||||
}
|
||||
}
|
||||
@ -246,6 +234,12 @@ module spine {
|
||||
width: number;
|
||||
height: number;
|
||||
pma: boolean;
|
||||
|
||||
setTexture (texture: Texture) {
|
||||
this.texture = texture;
|
||||
texture.setFilters(this.minFilter, this.magFilter);
|
||||
texture.setWraps(this.uWrap, this.vWrap);
|
||||
}
|
||||
}
|
||||
|
||||
export class TextureAtlasRegion extends TextureRegion {
|
||||
@ -259,7 +253,6 @@ module spine {
|
||||
originalHeight: number;
|
||||
index: number;
|
||||
degrees: number;
|
||||
texture: Texture;
|
||||
names: string[];
|
||||
values: number[][];
|
||||
}
|
||||
|
||||
@ -81,8 +81,8 @@ module spine {
|
||||
let n = this.uvs.length;
|
||||
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
||||
if (this.region instanceof TextureAtlasRegion) {
|
||||
let region = this.region;
|
||||
let textureWidth = region.texture.getImage().width, textureHeight = region.texture.getImage().height;
|
||||
let region = this.region, image = region.page.texture.getImage();
|
||||
let textureWidth = image.width, textureHeight = image.height;
|
||||
switch(region.degrees) {
|
||||
case 90:
|
||||
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
||||
|
||||
@ -175,7 +175,7 @@ module spine.threejs {
|
||||
region.computeWorldVertices(slot.bone, vertices, 0, vertexSize);
|
||||
triangles = SkeletonMesh.QUAD_TRIANGLES;
|
||||
uvs = region.uvs;
|
||||
texture = <ThreeJsTexture>(<TextureAtlasRegion>region.region.renderObject).texture;
|
||||
texture = <ThreeJsTexture>(<TextureAtlasRegion>region.region.renderObject).page.texture;
|
||||
} else if (attachment instanceof MeshAttachment) {
|
||||
let mesh = <MeshAttachment>attachment;
|
||||
attachmentColor = mesh.color;
|
||||
@ -187,7 +187,7 @@ module spine.threejs {
|
||||
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, vertexSize);
|
||||
triangles = mesh.triangles;
|
||||
uvs = mesh.uvs;
|
||||
texture = <ThreeJsTexture>(<TextureAtlasRegion>mesh.region.renderObject).texture;
|
||||
texture = <ThreeJsTexture>(<TextureAtlasRegion>mesh.region.renderObject).page.texture;
|
||||
} else if (attachment instanceof ClippingAttachment) {
|
||||
let clip = <ClippingAttachment>(attachment);
|
||||
clipper.clipStart(slot, clip);
|
||||
|
||||
@ -396,7 +396,7 @@ module spine.webgl {
|
||||
quad[i++] = 0;
|
||||
quad[i] = 0;
|
||||
}
|
||||
this.batcher.draw(<GLTexture>region.texture, quad, QUAD_TRIANGLES);
|
||||
this.batcher.draw(<GLTexture>region.page.texture, quad, QUAD_TRIANGLES);
|
||||
}
|
||||
|
||||
line (x: number, y: number, x2: number, y2: number, color: Color = null, color2: Color = null) {
|
||||
|
||||
@ -107,7 +107,7 @@ module spine.webgl {
|
||||
region.computeWorldVertices(slot.bone, renderable.vertices, 0, clippedVertexSize);
|
||||
triangles = SkeletonRenderer.QUAD_TRIANGLES;
|
||||
uvs = region.uvs;
|
||||
texture = <GLTexture>(<TextureAtlasRegion>region.region.renderObject).texture;
|
||||
texture = <GLTexture>(<TextureAtlasRegion>region.region.renderObject).page.texture;
|
||||
attachmentColor = region.color;
|
||||
} else if (attachment instanceof MeshAttachment) {
|
||||
let mesh = <MeshAttachment>attachment;
|
||||
@ -119,7 +119,7 @@ module spine.webgl {
|
||||
}
|
||||
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, renderable.vertices, 0, clippedVertexSize);
|
||||
triangles = mesh.triangles;
|
||||
texture = <GLTexture>(<TextureAtlasRegion>mesh.region.renderObject).texture;
|
||||
texture = <GLTexture>(<TextureAtlasRegion>mesh.region.renderObject).page.texture;
|
||||
uvs = mesh.uvs;
|
||||
attachmentColor = mesh.color;
|
||||
} else if (attachment instanceof ClippingAttachment) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user