blob: ec00d7aa78c645cec68eaaf7df85640a96a6cfc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 02/16/2009
//
// Filename: src-IL/src/il_texture.c
//
// Description: Reads from a Medieval II: Total War (by Creative Assembly)
// Texture (.texture) file.
//
//-----------------------------------------------------------------------------
#include "il_internal.h"
#ifndef IL_NO_TEXTURE
//! Reads a TEXTURE file
ILboolean ilLoadTexture(ILconst_string FileName)
{
ILHANDLE TextureFile;
ILboolean bTexture = IL_FALSE;
TextureFile = iopenr(FileName);
if (TextureFile == NULL) {
ilSetError(IL_COULD_NOT_OPEN_FILE);
return bTexture;
}
bTexture = ilLoadTextureF(TextureFile);
icloser(TextureFile);
return bTexture;
}
//! Reads an already-opened TEXTURE file
ILboolean ilLoadTextureF(ILHANDLE File)
{
ILuint FirstPos;
ILboolean bRet;
iSetInputFile(File);
FirstPos = itell();
// From http://forums.totalwar.org/vb/showthread.php?t=70886, all that needs to be done
// is to strip out the first 48 bytes, and then it is DDS data.
iseek(48, IL_SEEK_CUR);
bRet = ilLoadDdsF(File);
iseek(FirstPos, IL_SEEK_SET);
return bRet;
}
//! Reads from a memory "lump" that contains a TEXTURE
ILboolean ilLoadTextureL(const void *Lump, ILuint Size)
{
iSetInputLump(Lump, Size);
// From http://forums.totalwar.org/vb/showthread.php?t=70886, all that needs to be done
// is to strip out the first 48 bytes, and then it is DDS data.
iseek(48, IL_SEEK_CUR);
return ilLoadDdsL(Lump, Size);
}
#endif//IL_NO_TEXTURE
|