MCPcopy Create free account
hub / github.com/DentonW/DevIL / iBuildMipmaps

Function iBuildMipmaps

DevIL/src-ILU/src/ilu_mipmap.cpp:19–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19ILboolean iBuildMipmaps(ILimage *Parent, ILuint Width, ILuint Height, ILuint Depth)
20{
21 ILuint x1 = 0, x2 = 0, y1 = 0, y2 = 0;
22
23 if (Parent->Width == 1 && Parent->Height == 1 && Parent->Depth == 1) { // Already at the last mipmap
24 return IL_TRUE;
25 }
26
27 if (Width == 0)
28 Width = 1;
29 if (Height == 0)
30 Height = 1;
31 if (Depth == 0)
32 Depth = 1;
33
34 Parent->Mipmaps = iluScale_(Parent, Width, Height, Depth);
35 if (Parent->Mipmaps == NULL)
36 return IL_FALSE;
37
38 iBuildMipmaps(Parent->Mipmaps, Parent->Mipmaps->Width >> 1, Parent->Mipmaps->Height >> 1, Parent->Mipmaps->Depth >> 1);
39
40 return IL_TRUE;
41}
42
43
44// Note: No longer changes all textures to powers of 2.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected