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

Method Preload

engine/Poseidon/Graphics/Textures/TexturePreload.cpp:20–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void PreloadedTextures::Preload(bool all)
21{
22 if (_data.Size() >= MaxPreloadedTexture)
23 {
24 return;
25 }
26 _data.Clear();
27 _data.Resize(MaxPreloadedTexture);
28
29 const ParamEntry& tp = Remaster >> "CfgPreloadTextures";
30 auto loadTex = [&](const char* key) -> Ref<Texture>
31 {
32 RStringB name = tp >> key;
33 if (name.GetLength() == 0)
34 return nullptr;
35 return GlobLoadTexture(name);
36 };
37
38 _data[TextureDefault] = loadTex("textureDefault");
39 GetDefaultTexture() = _data[TextureDefault].GetRef();
40 _data[TextureWhite] = loadTex("textureWhite");
41 _data[TextureBlack] = loadTex("textureBlack");
42 _data[TextureLine] = loadTex("textureLine"); // 8x8
43 // we want 4x4 mipmap level only
44 if (_data[TextureLine])
45 {
46 _data[TextureLine]->SetMipmapRange(1, 1);
47 }
48
49 if (!all)
50 {
51 return;
52 }
53
54 _data[TrackTexture] = loadTex("trackTexture");
55 _data[TrackTextureFour] = loadTex("trackTextureFour");
56
57 _data[Corner] = GlobLoadTexture(GetPictureName(Pars >> "CfgInGameUI" >> "imageCornerElement"));
58
59 const ParamEntry& wrapper = Pars >> "CfgWrapperUI";
60 _data[DialogBackground] = GlobLoadTexture(GetPictureName(wrapper >> "Background" >> "texture"));
61 _data[DialogTitle] = GlobLoadTexture(GetPictureName(wrapper >> "TitleBar" >> "texture"));
62 _data[DialogGroup] = GlobLoadTexture(GetPictureName(wrapper >> "GroupBox2" >> "texture"));
63
64 const ParamEntry& cursor = Pars >> "CfgInGameUI" >> "Cursor";
65 _data[CursorLocked] = GlobLoadTexture(GetPictureName(cursor >> "lock_target"));
66 _data[CursorTarget] = GlobLoadTexture(GetPictureName(cursor >> "select_target"));
67 _data[CursorAim] = GlobLoadTexture(GetPictureName(cursor >> "aim"));
68 _data[CursorWeapon] = GlobLoadTexture(GetPictureName(cursor >> "weapon"));
69 _data[CursorStrategy] = GlobLoadTexture(GetPictureName(cursor >> "tactical"));
70 _data[CursorStrategyMove] = GlobLoadTexture(GetPictureName(cursor >> "move"));
71 _data[CursorStrategyAttack] = GlobLoadTexture(GetPictureName(cursor >> "attack"));
72 _data[CursorStrategyGetIn] = GlobLoadTexture(GetPictureName(cursor >> "getin"));
73 _data[CursorStrategySelect] = GlobLoadTexture(GetPictureName(cursor >> "select"));
74 _data[CursorStrategyWatch] = GlobLoadTexture(GetPictureName(cursor >> "watch"));
75 _data[CursorOutArrow] = GlobLoadTexture(GetPictureName(cursor >> "outArrow"));
76
77 _data[Compass000] = loadTex("compass000");

Callers 2

VehicleTypes_PreloadFunction · 0.45

Calls 9

GlobLoadTextureFunction · 0.85
GetPictureNameFunction · 0.85
SizeMethod · 0.45
ClearMethod · 0.45
ResizeMethod · 0.45
GetLengthMethod · 0.45
GetRefMethod · 0.45
SetMipmapRangeMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected