- Main Page
- Classes
- Files

- File List
- File Members

# flTexture.c File Reference

`#include "flGlobal.h"`
`#include <string.h>`
`#include <stdio.h>`
`#include <pspgu.h>`
`#include <pspkernel.h>`

Go to the source code of this file.

## Classes
struct | texTreeNode
## Functions
bool | texTreeAdd (char *inPath, Texture *inTex)
Texture * | texTreeFindTexByPath (char *inPath)
texTreeNode * | texTreeFindNodeByTexR (Texture *inTex, texTreeNode *inNode)
char * | texTreeFindPathByTex (Texture *inTex)
texTreeNode * | texTreeFindNodeByTex (Texture *inTex)
void | texTreeAddR (texTreeNode *inNode)
void | texTreeDelR (texTreeNode *inNode)
bool | texTreeDelNodeByTex (Texture *inTex)
u8 | texBPP (Texture *inTex)
u8 | texPalettized (Texture *inTex)
u8 | palBPP (Palette *inPal)
void | palBind (Palette *inPalette)
void | texInit ()
Texture * | texLoad (char *inPath)
bool | texSave (Texture *inTex, char *inPath)
char * | texPath (Texture *inTex)
Texture * | texCreate (u32 inWidth, u32 inHeight, u8 inPixelFormat)
Texture * | texCreateBlank (u32 inWidth, u32 inHeight, u8 inPixelFormat)
bool | texSwizzle (Texture *inTex)
bool | texUnswizzle (Texture *inTex)
void | texBind (Texture *inTex)
void | texFree (void *inTex)
int | texMipMap (Texture *inTex, u8 inLevel)
bool | texMipMapAdd (Texture *inTex)
Palette * | palCreate (u32 inEntries, u8 inFormat, bool inGlobal)
void | palFree (Palette *inPalette)
s32 | palClosestColor (Palette *inPal, u32 inColor)
Palette * | palCreateGrayscaleT8 ()
Palette * | palCreateGrayscaleT4 ()
Palette * | palCreateMonoT4 (u32 inForeColor, u32 inBackColor)
Palette * | palCreateDefaultColorT4 ()
Palette * | palGrayscaleT8 ()
Palette * | palGrayscaleT4 ()
Palette * | palDefaultColorT4 ()
Texture * | texScreenshot ()
bool | texMoveVMem (Texture *inTex)
bool | palMoveVMem (Palette *inPal)
u32 | texPixel (Texture *inTex, int inX, int inY)
## Variables
texTreeNode * | texTree = NULL
void * | texBound = NULL
void * | palBound = NULL
Palette * | palGrayscaleT8Ptr = NULL
Palette * | palGrayscaleT4Ptr = NULL
Palette * | palDefaultColorT4Ptr = NULL

## Function Documentation

void palBind | ( | Palette * | inPalette | ) | `[inline]`

Definition at line 158 of file flTexture.c.

References palBound, Palette::palData, Palette::palEntries, and Palette::palPixelFormat.

Referenced by texBind().

u8 palBPP | ( | Palette * | inPal | ) | `[inline]`

Definition at line 125 of file flTexture.c.

References debugWarning, graphicsPixelFormatBPP(), and Palette::palPixelFormat.

Referenced by palCreate(), and palMoveVMem().

s32 palClosestColor | ( | Palette * | inPal,
|  | u32 | inColor |
| ) |  |  |

Definition at line 875 of file flTexture.c.

References color4444_Cmp, color5551_Cmp, color5650_Cmp, color8888_Cmp, debugWarning, Palette::palData, Palette::palEntries, and Palette::palPixelFormat.

Palette* palCreate | ( | u32 | inEntries,
|  | u8 | inFormat,
|  | bool | inGlobal |
| ) |  |  |

Definition at line 805 of file flTexture.c.

References debugDevWarning, debugError, memAlign, memAlloc, memAllocUncached, memClear, memFree, NULL, palBPP(), Palette::palData, Palette::palEntries, Palette::palGlobal, and Palette::palPixelFormat.

Referenced by palCreateDefaultColorT4(), palCreateGrayscaleT4(), palCreateGrayscaleT8(), palCreateMonoT4(), and texLoadTGA().

Palette* palCreateDefaultColorT4 | ( |  | ) |

Definition at line 1004 of file flTexture.c.

References FL_TEXTURE_UNCACHED, palCreate(), and Palette::palData.

Referenced by palDefaultColorT4().

Palette* palCreateGrayscaleT4 | ( |  | ) |

Definition at line 972 of file flTexture.c.

References palCreate(), and Palette::palData.

Referenced by palGrayscaleT4().

Palette* palCreateGrayscaleT8 | ( |  | ) |

Definition at line 956 of file flTexture.c.

References palCreate(), and Palette::palData.

Referenced by palGrayscaleT8().

Palette* palCreateMonoT4 | ( | u32 | inForeColor,
|  | u32 | inBackColor |
| ) |  |  |

Definition at line 988 of file flTexture.c.

References palCreate(), and Palette::palData.

Referenced by fontDraw2dChar(), and fontDraw2dString().

Palette* palDefaultColorT4 | ( |  | ) |

Definition at line 1045 of file flTexture.c.

References palCreateDefaultColorT4(), palDefaultColorT4Ptr, and Palette::palGlobal.

void palFree | ( | Palette * | inPalette | ) |

Definition at line 860 of file flTexture.c.

References memFree, NULL, palBound, and Palette::palData.

Referenced by fontDraw2dChar(), fontDraw2dString(), and texFree().

Palette* palGrayscaleT4 | ( |  | ) |

Definition at line 1037 of file flTexture.c.

References palCreateGrayscaleT4(), Palette::palGlobal, and palGrayscaleT4Ptr.

Palette* palGrayscaleT8 | ( |  | ) |

Definition at line 1029 of file flTexture.c.

References palCreateGrayscaleT8(), Palette::palGlobal, and palGrayscaleT8Ptr.

Referenced by texLoadTGA().

bool palMoveVMem | ( | Palette * | inPal | ) |

Definition at line 1132 of file flTexture.c.

References debugWarning, graphicsDisplayList, graphicsFrame, memCopy, memFree, palBPP(), Palette::palData, Palette::palEntries, Palette::palPixelFormat, and vmemAlloc.

void texBind | ( | Texture * | inTex | ) |

Definition at line 506 of file flTexture.c.

References debugWarning, NULL, palBind(), texBound, Texture::texData, Texture::texDataHeight, Texture::texDataWidth, Texture::texMipData, Texture::texMipMaps, Texture::texPalette, texPalettized(), Texture::texPixelFormat, Texture::texStride, and Texture::texSwizzled.

Referenced by fontDraw2dChar(), fontDraw2dString(), graphics2dDrawTexture(), graphics2dDrawTextureSection(), graphics3dDrawCubeTextured(), graphics3dDrawSphereTextured(), mdl3dStatDrawTextured(), and spriteDraw2dFrame().

u8 texBPP | ( | Texture * | inTex | ) | `[inline]`

Definition at line 99 of file flTexture.c.

References Texture::texPixelFormat.

Referenced by texCreate(), texCreateBlank(), texPixel(), texSaveTGA(), texSwizzle(), and texUnswizzle().

Texture* texCreate | ( | u32 | inWidth,
|  | u32 | inHeight,
|  | u8 | inPixelFormat |
| ) |  |  |

Definition at line 376 of file flTexture.c.

References debugError, memAlign, memAlloc, memAllocUncached, memClear, memFree, NULL, Texture::texAlpha, texBPP(), Texture::texData, Texture::texDataHeight, texDataSize, Texture::texDataWidth, Texture::texHeight, Texture::texMipData, Texture::texMipMaps, Texture::texPalette, Texture::texPixelFormat, Texture::texStride, Texture::texSwizzled, Texture::texUseCount, and Texture::texWidth.

Referenced by texCreateBlank(), and texScreenshot().

Texture* texCreateBlank | ( | u32 | inWidth,
|  | u32 | inHeight,
|  | u8 | inPixelFormat |
| ) |  |  |

Definition at line 428 of file flTexture.c.

References memClear, NULL, texBPP(), texCreate(), Texture::texData, Texture::texDataHeight, and Texture::texDataWidth.

void texFree | ( | void * | inTex | ) |

Definition at line 546 of file flTexture.c.

References memFree, NULL, palFree(), Palette::palGlobal, texBound, Texture::texData, Texture::texMipData, Texture::texMipMaps, Texture::texPalette, and Texture::texUseCount.

Referenced by fontFree(), and mdl3dStatFree().

void texInit | ( |  | ) |

Definition at line 168 of file flTexture.c.

References FL_TEXTURE_ERRORTEX_PATH, and texLoad().

Referenced by flInitialize().

Texture* texLoad | ( | char * | inPath | ) |

Definition at line 178 of file flTexture.c.

References debugError, debugWarning, fileExtension(), filePathValidate(), FL_TEXTURE_AUTOMIPMAP, memFree, memIsCachedPointer, NULL, Texture::texData, texDataSize, texLoadBMP(), texLoadPCX(), texLoadTGA(), texMipMap(), texPalettized(), texSwizzle(), texTreeAdd(), texTreeFindTexByPath(), and Texture::texUseCount.

Referenced by fontLoad(), mdl3dAnimLoadMD2(), mdl3dStatLoadOBJ(), and texInit().

int texMipMap | ( | Texture * | inTex,
|  | u8 | inLevel |
| ) |  |  |

Definition at line 590 of file flTexture.c.

References debugWarning, min, Texture::texDataHeight, Texture::texDataWidth, texMipMapAdd(), and Texture::texMipMaps.

Referenced by texLoad().

bool texMipMapAdd | ( | Texture * | inTex | ) |

Definition at line 611 of file flTexture.c.

References debugDevWarning, debugWarning, FL_DEBUG_DEVWARNING, Texture::texMipMaps, texPalettized(), Texture::texSwizzled, and texUnswizzle().

Referenced by texMipMap().

bool texMoveVMem | ( | Texture * | inTex | ) |

Definition at line 1081 of file flTexture.c.

References debugWarning, graphicsDisplayList, graphicsFrame, memCopy, memFree, Texture::texData, Texture::texDataHeight, texDataSize, Texture::texDataWidth, Texture::texMipData, Texture::texMipMaps, Texture::texPixelFormat, and vmemAlloc.

u8 texPalettized | ( | Texture * | inTex | ) | `[inline]`

Definition at line 121 of file flTexture.c.

References Texture::texPixelFormat.

Referenced by texBind(), texLoad(), texMipMapAdd(), and texSaveTGA().

char* texPath | ( | Texture * | inTex | ) |

Definition at line 372 of file flTexture.c.

References texTreeFindPathByTex().

Referenced by mdl3dStatSaveOBJ().

u32 texPixel | ( | Texture * | inTex,
|  | int | inX,
|  | int | inY |
| ) |  |  |

Definition at line 1164 of file flTexture.c.

References memCopy, texBPP(), Texture::texData, Texture::texDataWidth, Texture::texHeight, and Texture::texWidth.

bool texSave | ( | Texture * | inTex,
|  | char * | inPath |
| ) |  |  |

Definition at line 282 of file flTexture.c.

References debugError, debugWarning, fileExtension(), filePathValidate(), memFree, texSaveBMP(), texSavePCX(), and texSaveTGA().

Referenced by debugScreenshot().

Texture* texScreenshot | ( |  | ) |

Definition at line 1054 of file flTexture.c.

References debugError, FL_TEXTURE_UNCACHED, graphicsDispBuffer, memCopy, NULL, SCREEN_HEIGHT, SCREEN_STRIDE, SCREEN_WIDTH, Texture::texAlpha, texCreate(), Texture::texData, Texture::texDataWidth, and vmemAbsolutePtr.

Referenced by debugScreenshot().

bool texSwizzle | ( | Texture * | inTex | ) |

Definition at line 439 of file flTexture.c.

References debugWarning, FL_DEBUG_WARNING, graphicsSwizzleData(), texBPP(), Texture::texData, Texture::texDataHeight, Texture::texDataWidth, Texture::texHeight, Texture::texMipData, Texture::texMipMaps, Texture::texPixelFormat, and Texture::texSwizzled.

Referenced by texLoad().

bool texTreeAdd | ( | char * | inPath,
|  | Texture * | inTex |
| ) |  |  |

Definition at line 1208 of file flTexture.c.

References debugWarning, flRunning, memAlloc, NULL, texTreeNode::texNodeData, texTreeNode::texNodeNext, texTreeNode::texNodePath, and texTree.

Referenced by texLoad(), and texTreeAddR().

void texTreeAddR | ( | texTreeNode * | inNode | ) |

Definition at line 1295 of file flTexture.c.

References texTreeNode::texNodeData, texTreeNode::texNodeNext, texTreeNode::texNodePath, and texTreeAdd().

Referenced by texTreeDelNodeByTex().

bool texTreeDelNodeByTex | ( | Texture * | inTex | ) |

Definition at line 1311 of file flTexture.c.

References debugWarning, texTreeNode::texNodeNext, texTree, texTreeAddR(), texTreeDelR(), and texTreeFindNodeByTex().

void texTreeDelR | ( | texTreeNode * | inNode | ) |

Definition at line 1303 of file flTexture.c.

References texTreeNode::texNodeNext.

Referenced by texTreeDelNodeByTex().

texTreeNode * texTreeFindNodeByTex | ( | Texture * | inTex | ) |

Definition at line 1289 of file flTexture.c.

References NULL, texTree, and texTreeFindNodeByTexR().

Referenced by texTreeDelNodeByTex().

texTreeNode * texTreeFindNodeByTexR | ( | Texture * | inTex,
|  | texTreeNode * | inNode |
| ) |  |  |

Definition at line 1267 of file flTexture.c.

References NULL, texTreeNode::texNodeData, and texTreeNode::texNodeNext.

Referenced by texTreeFindNodeByTex(), and texTreeFindPathByTex().

char * texTreeFindPathByTex | ( | Texture * | inTex | ) |

Definition at line 1283 of file flTexture.c.

References NULL, texTreeNode::texNodePath, texTree, and texTreeFindNodeByTexR().

Referenced by texPath().

Texture * texTreeFindTexByPath | ( | char * | inPath | ) |

Definition at line 1250 of file flTexture.c.

References flRunning, NULL, texTreeNode::texNodeData, texTreeNode::texNodeNext, texTreeNode::texNodePath, and texTree.

Referenced by texLoad().

bool texUnswizzle | ( | Texture * | inTex | ) |

Definition at line 472 of file flTexture.c.

References debugWarning, FL_DEBUG_WARNING, graphicsUnswizzleData(), texBPP(), Texture::texData, Texture::texDataHeight, Texture::texDataWidth, Texture::texHeight, Texture::texMipData, Texture::texMipMaps, Texture::texPixelFormat, and Texture::texSwizzled.

Referenced by texMipMapAdd(), and texSaveTGA().

## Variable Documentation

void* palBound = NULL

Definition at line 75 of file flTexture.c.

Referenced by fontDraw2dChar(), fontDraw2dString(), graphicsEffectFsColorEnhance(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), palBind(), and palFree().

Palette* palDefaultColorT4Ptr = NULL

Definition at line 79 of file flTexture.c.

Referenced by palDefaultColorT4().

Palette* palGrayscaleT4Ptr = NULL

Definition at line 78 of file flTexture.c.

Referenced by palGrayscaleT4().

Palette* palGrayscaleT8Ptr = NULL

Definition at line 77 of file flTexture.c.

Referenced by palGrayscaleT8().

void* texBound = NULL

Definition at line 74 of file flTexture.c.

Referenced by fontDraw2dChar(), fontDraw2dString(), graphicsEffectFsColorEnhance(), graphicsEffectFsDepthFog(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), graphicsSwapBuffers(), texBind(), and texFree().

texTreeNode* texTree = NULL

Definition at line 62 of file flTexture.c.

Referenced by texTreeAdd(), texTreeDelNodeByTex(), texTreeFindNodeByTex(), texTreeFindPathByTex(), and texTreeFindTexByPath().