MCPcopy Create free account
hub / github.com/melonjs/melonJS / imageSize

Function imageSize

packages/melonjs/src/renderable/sprite3d.js:20–31  ·  view source on GitHub ↗
(settings)

Source from the content-addressed store, hash-verified

18// touching the renderer (the texture atlas itself is resolved by the Mesh
19// base class). Runs before `super()`, so it must not touch `this`.
20function imageSize(settings) {
21 const src = settings.image ?? settings.texture;
22 if (src instanceof TextureAtlas) {
23 const texture = src.getTexture();
24 return { w: texture.width, h: texture.height };
25 }
26 const image = typeof src === "object" ? src : getImage(src);
27 if (!image) {
28 throw new Error("Sprite3d: '" + src + "' image/texture not found!");
29 }
30 return { w: image.width, h: image.height };
31}
32
33/**
34 * A textured **quad in 3D space** — the 3D counterpart of {@link Sprite},

Callers 1

constructorMethod · 0.85

Calls 2

getImageFunction · 0.90
getTextureMethod · 0.45

Tested by

no test coverage detected