mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[ts] Fix formatting.
This commit is contained in:
parent
248e4a9759
commit
12cd0d7c0b
@ -33,28 +33,28 @@ import * as THREE from "three";
|
||||
export class ThreeJsTexture extends Texture {
|
||||
texture: THREE.Texture;
|
||||
|
||||
constructor(image: HTMLImageElement) {
|
||||
constructor (image: HTMLImageElement) {
|
||||
super(image);
|
||||
this.texture = new THREE.Texture(image);
|
||||
this.texture.flipY = false;
|
||||
this.texture.needsUpdate = true;
|
||||
}
|
||||
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter) {
|
||||
setFilters (minFilter: TextureFilter, magFilter: TextureFilter) {
|
||||
this.texture.minFilter = ThreeJsTexture.toThreeJsTextureFilter(minFilter);
|
||||
this.texture.magFilter = ThreeJsTexture.toThreeJsTextureFilter(magFilter);
|
||||
}
|
||||
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap) {
|
||||
setWraps (uWrap: TextureWrap, vWrap: TextureWrap) {
|
||||
this.texture.wrapS = ThreeJsTexture.toThreeJsTextureWrap(uWrap);
|
||||
this.texture.wrapT = ThreeJsTexture.toThreeJsTextureWrap(vWrap);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
dispose () {
|
||||
this.texture.dispose();
|
||||
}
|
||||
|
||||
static toThreeJsTextureFilter(filter: TextureFilter) {
|
||||
static toThreeJsTextureFilter (filter: TextureFilter) {
|
||||
if (filter === TextureFilter.Linear) return THREE.LinearFilter;
|
||||
else if (filter === TextureFilter.MipMap) return THREE.LinearMipMapLinearFilter; // also includes TextureFilter.MipMapLinearLinear
|
||||
else if (filter === TextureFilter.MipMapLinearNearest) return THREE.LinearMipMapNearestFilter;
|
||||
@ -64,14 +64,14 @@ export class ThreeJsTexture extends Texture {
|
||||
else throw new Error("Unknown texture filter: " + filter);
|
||||
}
|
||||
|
||||
static toThreeJsTextureWrap(wrap: TextureWrap) {
|
||||
static toThreeJsTextureWrap (wrap: TextureWrap) {
|
||||
if (wrap === TextureWrap.ClampToEdge) return THREE.ClampToEdgeWrapping;
|
||||
else if (wrap === TextureWrap.MirroredRepeat) return THREE.MirroredRepeatWrapping;
|
||||
else if (wrap === TextureWrap.Repeat) return THREE.RepeatWrapping;
|
||||
else throw new Error("Unknown texture wrap: " + wrap);
|
||||
}
|
||||
|
||||
static toThreeJsBlending(blend: BlendMode) {
|
||||
static toThreeJsBlending (blend: BlendMode) {
|
||||
if (blend === BlendMode.Normal) return THREE.NormalBlending;
|
||||
else if (blend === BlendMode.Additive) return THREE.AdditiveBlending;
|
||||
else if (blend === BlendMode.Multiply) return THREE.MultiplyBlending;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user