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

Method getUnit

packages/melonjs/src/video/texture/cache.js:122–134  ·  view source on GitHub ↗

* @ignore

(texture)

Source from the content-addressed store, hash-verified

120 * @ignore
121 */
122 getUnit(texture) {
123 const source = texture.sources.get(texture.activeAtlas);
124 const repeat = normalizeRepeat(texture.repeat);
125 let perRepeat = this.units.get(source);
126 if (perRepeat === undefined) {
127 perRepeat = new Map();
128 this.units.set(source, perRepeat);
129 }
130 if (!perRepeat.has(repeat)) {
131 perRepeat.set(repeat, this.allocateTextureUnit());
132 }
133 return perRepeat.get(repeat);
134 }
135
136 /**
137 * @ignore

Callers 6

invalidateMethod · 0.80
uploadTextureMethod · 0.80
texture.spec.jsFile · 0.80

Calls 5

allocateTextureUnitMethod · 0.95
normalizeRepeatFunction · 0.85
getMethod · 0.65
setMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected