mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-23 00:15:23 +00:00
set crossOrigin on WebGL atlas image loaders
Atlases now load from the CDN; without crossOrigin = "anonymous" the browser refuses to texImage2D the cross-origin image. Requires the CDN to send Access-Control-Allow-Origin for /_assets/atlases/.
This commit is contained in:
@@ -207,6 +207,7 @@ export class ConquestPopupPass {
|
||||
|
||||
private loadAtlas(): void {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
const gl = this.gl;
|
||||
const tex = gl.createTexture()!;
|
||||
|
||||
@@ -268,6 +268,7 @@ export class FxSpritePass {
|
||||
|
||||
private async loadAtlas(): Promise<void> {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = fxAtlasUrl;
|
||||
await img.decode();
|
||||
const gl = this.gl;
|
||||
|
||||
@@ -113,6 +113,7 @@ export class IconProgram {
|
||||
const gl = this.gl;
|
||||
const load = (url: string, cb: (tex: WebGLTexture) => void) => {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
const tex = gl.createTexture()!;
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
|
||||
@@ -105,6 +105,7 @@ export class StatusIconProgram {
|
||||
private loadAtlas(): void {
|
||||
const gl = this.gl;
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
const tex = gl.createTexture()!;
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
|
||||
@@ -127,6 +127,7 @@ export class TextProgram {
|
||||
private loadAtlas(): void {
|
||||
const gl = this.gl;
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
const tex = gl.createTexture()!;
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
|
||||
@@ -229,6 +229,7 @@ export class RadialMenuPass {
|
||||
|
||||
private loadEmojiAtlas(): void {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
this.atlasImg = img;
|
||||
this.rebuildAtlasTexture();
|
||||
|
||||
@@ -210,6 +210,7 @@ export class StructureLevelPass {
|
||||
|
||||
private loadAtlas(): void {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = () => {
|
||||
const gl = this.gl;
|
||||
const tex = gl.createTexture()!;
|
||||
|
||||
@@ -245,6 +245,7 @@ export class StructurePass {
|
||||
|
||||
private async loadAtlas(): Promise<void> {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = iconAtlasUrl;
|
||||
await img.decode();
|
||||
const gl = this.gl;
|
||||
|
||||
@@ -301,6 +301,7 @@ export class UnitPass {
|
||||
|
||||
private async loadAtlas(): Promise<void> {
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = unitAtlasUrl;
|
||||
await img.decode();
|
||||
const gl = this.gl;
|
||||
|
||||
Reference in New Issue
Block a user