- Sample prototype for a PNG saving function

- Vector2f type which will be needed for texture coordinates
- Output adjustment for pie_AddTexPage


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1550 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-04-29 00:58:39 +00:00
parent 03c620620b
commit e5e418c480
3 changed files with 16 additions and 7 deletions

View File

@ -177,7 +177,7 @@ extern void pie_DrawTexTriangle(PIEVERTEX *aVrts, void* psEffects);
extern void pie_GetResetCounts(SDWORD* pPieCount, SDWORD* pTileCount, SDWORD* pPolyCount, SDWORD* pStateCount);
/*!
* Load a PNG from file into sprite
* Load a PNG from file into texture
*
* \param fileName input file to load from
* \param sprite Sprite to read into
@ -185,6 +185,15 @@ extern void pie_GetResetCounts(SDWORD* pPieCount, SDWORD* pTileCount, SDWORD* pP
*/
BOOL pie_PNGLoadFile(const char *fileName, iTexture *s);
/*!
* Save a PNG from texture into file
*
* \param fileName output file to save to
* \param sprite Texture to read from
* \return TRUE on success, FALSE otherwise
*/
void pie_PNGSaveFile(const char *fileName, iTexture *s);
void pie_BeginLighting(float x, float y, float z);
void pie_EndLighting(void);
void pie_RemainingPasses(void);

View File

@ -44,6 +44,7 @@
//
//*************************************************************************
typedef struct { Sint32 x, y; } Vector2i;
typedef struct { float x, y; } Vector2f;
typedef struct { Sint32 x, y, z; } Vector3i;
typedef struct { float x, y, z; } Vector3f;

View File

@ -56,14 +56,14 @@ int pie_AddTexPage(iTexture* s, const char* filename, int type, BOOL bResource)
{
unsigned int i = 0;
debug(LOG_TEXTURE, "pie_AddBMPtoTexPages: %s type=%d resource=%s page=%d", filename, type, bResource ? "true" : "false", _TEX_INDEX);
debug(LOG_TEXTURE, "pie_AddTexPage: %s type=%d resource=%s page=%d", filename, type, bResource ? "true" : "false", _TEX_INDEX);
assert(s != NULL);
/* Have we already loaded this one? (Should generally not happen here.) */
while (i < _TEX_INDEX) {
if (strncmp(filename, _TEX_PAGE[i].name, iV_TEXNAME_MAX) == 0) {
// this happens with terrain for some reason, which is necessary
debug(LOG_TEXTURE, "pie_AddBMPtoTexPages: %s loaded again", filename);
debug(LOG_TEXTURE, "pie_AddTexPage: %s loaded again", filename);
}
i++;
}
@ -73,7 +73,7 @@ int pie_AddTexPage(iTexture* s, const char* filename, int type, BOOL bResource)
/* Have we used up too many? */
if (_TEX_INDEX >= iV_TEX_MAX) {
debug(LOG_ERROR, "pie_AddBMPtoTexPages: too many texture pages");
debug(LOG_ERROR, "pie_AddTexPage: too many texture pages");
assert(FALSE);
return -1;
}
@ -94,10 +94,9 @@ int pie_AddTexPage(iTexture* s, const char* filename, int type, BOOL bResource)
if ((s->width & (s->width-1)) == 0 && (s->height & (s->height-1)) == 0)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, wz_texture_compression, s->width, s->height,
GL_RGBA, GL_UNSIGNED_BYTE, s->bmp);
gluBuild2DMipmaps(GL_TEXTURE_2D, wz_texture_compression, s->width, s->height, GL_RGBA, GL_UNSIGNED_BYTE, s->bmp);
} else {
debug(LOG_ERROR, "pie_AddBMPtoTexPages: non POT texture %s.", filename);
debug(LOG_ERROR, "pie_AddTexPage: non POT texture %s", filename);
}
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);