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

Method getNormalTexture

packages/melonjs/src/video/texture/atlas.js:347–355  ·  view source on GitHub ↗

* Return the paired normal-map texture for the given region, or `null` * if no normal map was provided to this atlas. The normal map shares * the same UV layout as the color texture returned by TextureAtlas#getTexture. * @param {object} [region] - region name in case of multipack textu

(region)

Source from the content-addressed store, hash-verified

345 * @returns {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null}
346 */
347 getNormalTexture(region) {
348 if (this.normalSources.size === 0) {
349 return null;
350 }
351 if (typeof region === "object" && typeof region.texture === "string") {
352 return this.normalSources.get(region.texture) ?? null;
353 }
354 return this.normalSources.get(this.activeAtlas) ?? null;
355 }
356
357 /**
358 * add a region to the atlas

Callers 2

constructorMethod · 0.80
texture.spec.jsFile · 0.80

Calls 1

getMethod · 0.65

Tested by

no test coverage detected