MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / LoadInterpolated

Method LoadInterpolated

engine/PoseidonGL33/TextureBankGL33_Core.cpp:247–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247Ref<Texture> TextBankGL33::LoadInterpolated(RStringB n1, RStringB n2, float factor)
248{
249 const float eps = 1.0 / 256;
250 if (factor >= 1.0 - eps)
251 return Load(n2);
252 if (factor <= eps)
253 return Load(n1);
254
255 Ref<Texture> txt2 = Load(n2);
256 TextureGL33* interpolate = static_cast<TextureGL33*>(txt2.GetRef());
257 int index = Find(n1, interpolate);
258 if (index >= 0)
259 {
260 TextureGL33* t = _texture[index];
261 const float iPolEps = 1.0 / 64;
262 if (fabs(t->_iFactor - factor) > iPolEps)
263 {
264 t->ReleaseMemory(true);
265 t->ReleaseSmall(true);
266 t->_iFactor = factor;
267 }
268 return t;
269 }
270 Ref<Texture> temp = Load(n1);
271 int index1 = Find(n1);
272 Ref<TextureGL33> t = Copy(index1);
273 if (t)
274 {
275 t->_interpolate = interpolate;
276 t->_iFactor = factor;
277 }
278 return t.GetRef();
279}
280
281void TextBankGL33::ReleaseAllTextures()
282{

Callers

nothing calls this directly

Calls 5

FindFunction · 0.85
fabsFunction · 0.85
ReleaseMemoryMethod · 0.80
ReleaseSmallMethod · 0.80
GetRefMethod · 0.45

Tested by

no test coverage detected