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

Method DoLoadHeaders

engine/PoseidonGL33/TextureGL33_Init.cpp:172–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void TextureGL33::DoLoadHeaders()
173{
174 PoseidonAssert(!_initialized);
175 _initialized = true;
176
177 int i = -1;
178
179 PacFormat format = BasicFormat(GetName());
180 bool isPaa = (format == PacARGB4444);
181
182 TextBankGL33* bank = static_cast<TextBankGL33*>(GEngine->TextBank());
183
184 if (_maxSize >= 0x10000)
185 {
186 if (!CmpStartStr(Name(), "fonts\\"))
187 _maxSize = 1024;
188 else if (!CmpStartStr(Name(), "merged\\"))
189 _maxSize = 2048;
190 else if (bank->AnimatedNumber(Name()) >= 0 && IsAlpha())
191 _maxSize = ENGINE_CONFIG.maxAnimText;
192 else
193 _maxSize = ENGINE_CONFIG.maxObjText;
194 }
195
196 RString resolved2 = Poseidon::Graphics::ResolveLooseTexturePath(Name());
197 ITextureSourceFactory* factory = SelectTextureSourceFactory(resolved2);
198 if (!factory)
199 {
200 _nMipmaps = 0;
201 return;
202 }
203 _src = factory->Create(resolved2, _mipmaps, MAX_MIPMAPS);
204
205 if (_src)
206 {
207 format = _src->GetFormat();
208
209 if (format == PacARGB4444 || format == PacAI88 || format == PacARGB8888)
210 _src->ForceAlpha();
211
212 int dxt = static_cast<EngineGL33*>(GEngine)->DXTSupport();
213 PacFormat dFormat = DstFormat(format, dxt);
214
215 if (!_src->IsTransparent() && _src->GetFormat() == PacARGB1555)
216 {
217 if (bank->_engine->Can565() && !isPaa)
218 dFormat = PacRGB565;
219 }
220
221 _largestUsed = MAX_MIPMAPS;
222 int nMipmaps = _src->GetMipmapCount();
223 for (i = 0; i < nMipmaps; i++)
224 {
225 PacLevelMem& mip = _mipmaps[i];
226 mip.SetDestFormat(dFormat, 8);
227
228 if (!mip.TooLarge(_maxSize))
229 {

Callers 1

LoadHeadersNVFunction · 0.80

Calls 15

CmpStartStrFunction · 0.85
IsAlphaFunction · 0.85
ResolveLooseTexturePathFunction · 0.85
WarningMessageFunction · 0.85
AnimatedNumberMethod · 0.80
DXTSupportMethod · 0.80
Can565Method · 0.80
SetDestFormatMethod · 0.80
TooLargeMethod · 0.80
BasicFormatFunction · 0.70
DstFormatFunction · 0.70

Tested by

no test coverage detected