From f724e69acde2674e2175e7d369a727c900ac52df Mon Sep 17 00:00:00 2001 From: slack Date: Thu, 16 Oct 2008 02:16:43 +0200 Subject: [PATCH] Texture improvements. Renamed models/ to data/ - TGA GU_PSM_8888 to LTX GU_PSM_5650 conversion - Moved texture binding to Gfx in order to have all psp-dependent code together. - swizzling and unswizzling - models/ renamed to data/ --- {models => data}/ship.lob | Bin {models => data}/ship.tga | Bin {models => data}/shipdawhip.lob | Bin data/shipdawhip.ltx | Bin 0 -> 32784 bytes {models => data}/shipdawhip.tga | Bin game.cc | 6 ++-- gfx.cc | 6 +++- gfx.h | 6 +++- models/colors-noUV.lob | Bin 1040 -> 0 bytes texture.cc | 56 +++++++++++++++++++++----------- texture.h | 3 +- 11 files changed, 51 insertions(+), 26 deletions(-) rename {models => data}/ship.lob (100%) rename {models => data}/ship.tga (100%) rename {models => data}/shipdawhip.lob (100%) create mode 100644 data/shipdawhip.ltx rename {models => data}/shipdawhip.tga (100%) delete mode 100644 models/colors-noUV.lob diff --git a/models/ship.lob b/data/ship.lob similarity index 100% rename from models/ship.lob rename to data/ship.lob diff --git a/models/ship.tga b/data/ship.tga similarity index 100% rename from models/ship.tga rename to data/ship.tga diff --git a/models/shipdawhip.lob b/data/shipdawhip.lob similarity index 100% rename from models/shipdawhip.lob rename to data/shipdawhip.lob diff --git a/data/shipdawhip.ltx b/data/shipdawhip.ltx new file mode 100644 index 0000000000000000000000000000000000000000..f4c4f8f52e3013c1064f777333656e1c32cb8b56 GIT binary patch literal 32784 zcmeI5T~J)-ndiI48mnV))G;K3<6JZrvFLy;+QPdAJ5!-0V$lXiv_z@`v#DZRIG_g2 zpcby$ZDwnu95Gf;Ln7SLRdYj4;}PCQHcHD^%!P>|fdn!lw(hNrP=rQkf)mZ<{(tYw zQMa6=CZCh3-8rY!oacO>_v88hpO5!d|NlI3#G~bZZ~tTa*I&B5#pfm?_1R*1qw{>e zSe^>rFQ4)a<%*B{J+tY8?DsSWrX$Er-jQHwbT-|QJD*=~7>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v9^ssvj`A zXxYpxFs2Mh@R`|zln1D>zl>pR(`*V)%KkhqUoigs0h6sEG*OMY`~jPu6?Cya1&jaa z60U(=zzJ*yD>b49{7Qa1n?GEc>&S?*fn7DwV0v)g75$j6e9zzhnkkPA^r*) z+7-==<%?Cz@9+Bda4U~M|+9tflLb6XK3j}R!pUxYQ#r?ZJ`xmcwTfr|L z`9tlo{n5>GyI+6(p`KZMUoxqfQ64;e9^M~2aisj#CoBt>1q+$$2#KzNo@+;tJz&a+M cfVmU#SF_j7&jnHw8MAY9@ class Gfx: public Singleton @@ -25,11 +26,14 @@ class Gfx: public Singleton void update_fps(); void swap_buffers(); + // Camera controls; void perspective(float fov, float aspect, float znear, float zfar); - void look_at(ScePspFVector3 *eye, ScePspFVector3 *center, ScePspFVector3 *up); void look_at(float eye_x, float eye_y, float eye_z, float center_x, float center_y, float center_z, float up_x, float up_y, float up_z); + + // Texture + void bind_texture(const Texture& t); }; #define GFX Gfx::Instance() diff --git a/models/colors-noUV.lob b/models/colors-noUV.lob deleted file mode 100644 index bc44456fcc46153bc54e35f584c3033ebb272d99..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1040 zcmah|IZnht5Ugdr-1l-{3rI+ah!@xrAqm=m2appHk}Pi_V;{l103rUuuH{QZ^^7ff zz+-}*vASH{(_P(<56{<6cQ?1^0G4TK3jNyq3at$l@Dgb~ig@!oBQ}hPy^9HE{lql% zTnX&2s4bx2wq7I1K2IZ9c}%iH$>IO7IE&J@XFcb@N4x zrzEbtDP|3pW4Q8u;}@(b{Q0I+Q+wk(C7&=}TnI)z4zh`UzIe!|z#&;n(Op@avEnUUR<0##H4z zIWv(HtLfnMbJ7wMdG76}#XP%0UM-)a5f`u(^UYGg-R)u?3z)+UX0ga~i5uNP4=Y&3 f8rHFaP4uyaZR}tdd)UVT4snEIoM6E76leGW8$hbk diff --git a/texture.cc b/texture.cc index 46de12f..706a985 100644 --- a/texture.cc +++ b/texture.cc @@ -33,7 +33,7 @@ unsigned int Texture::get_bpp() default: printf("Error: Unsupported texture type\n"); } - return -1; + return 0; } // LTX == Laz0r TeXture ;) @@ -51,7 +51,7 @@ void Texture::readLTX(const char *filename) FILE *fp = fopen(filename, "rb"); if(!fp) { - printf("Error, couldn't open file\n"); + printf("Texture::readLTX: Error, couldn't open file %s\n", filename); return; } @@ -60,7 +60,7 @@ void Texture::readLTX(const char *filename) fread(&header, sizeof(LTXHeader), 1, fp); if (strncmp("lzrT", header.sig, 4)) { - printf("Error: not a LTX file\n"); + printf("Texture::readLTX: Error, %s is not a LTX file\n", filename); return; } @@ -97,7 +97,7 @@ void Texture::readTGA(const char *filename) if(!fp) { - printf("Error, couldn't open file\n"); + printf("Texture::readTGA: Error, couldn't open file %s\n", filename); return; } @@ -109,7 +109,7 @@ void Texture::readTGA(const char *filename) if(memcmp(unCompressHeader, tgaHeader, sizeof(unCompressHeader)) != 0) { fclose(fp); - printf("Error, not an uncompressed TGA file\n"); + printf("Texture::readTGA: Error, %s is not an uncompressed TGA file\n", filename); width=0; height=0; pixels=0; @@ -153,8 +153,6 @@ void Texture::readTGA(const char *filename) // Close the file fclose(fp); - swizzle(); - swizzle(); swizzle(); printf("Read TGA texture %s (%ux%u)\n", filename, width, height); @@ -167,17 +165,11 @@ Texture::~Texture() delete[] pixels; } -void Texture::bind() -{ - sceGuTexMode(mode, 0, 0, swizzled? 1: 0); - sceGuTexImage(0, width, height, width, pixels); -} - void Texture::swizzle() { unsigned int bytes_per_pixel = get_bpp()/8; unsigned int i,j; - unsigned int rowblocks = (width * bytes_per_pixel / 16); + unsigned int row_blocks = (width * bytes_per_pixel / 16); long size = width * height * long(bytes_per_pixel); unsigned char* out = new unsigned char[size]; @@ -191,14 +183,39 @@ void Texture::swizzle() unsigned int x = (i - blockx*16); unsigned int y = (j - blocky*8); - unsigned int block_index = blockx + ((blocky) * rowblocks); + unsigned int block_index = blockx + ((blocky) * row_blocks); unsigned int block_address = block_index * 16 * 8; out[block_address + x + y * 16] = pixels[i+j*width*bytes_per_pixel]; } } memcpy(pixels, out, size ); - swizzled = !swizzled; + swizzled = true; + delete[] out; +} + +void Texture::unswizzle() +{ + unsigned int bytes_per_pixel = get_bpp()/8; + long size = width * height * long(bytes_per_pixel); + unsigned int total_blocks = size/(16*8); + unsigned int row_blocks = total_blocks/(height/8); + + unsigned char* out = new unsigned char[size]; + + for (unsigned int block_index=0; block_index < total_blocks; block_index++) + { + for (unsigned int block_offset = 0; block_offset < 16*8; ++block_offset) + { + unsigned int block_y = block_index / row_blocks; + unsigned int block_x = block_index % row_blocks; + unsigned int y = block_offset/16; + unsigned int x = block_offset%16; + out[(block_y*8+y)*width*bytes_per_pixel+16*block_x+x] = pixels[block_index*(16*8)+block_offset]; + } + } + memcpy(pixels, out, size ); + swizzled = false; delete[] out; } @@ -211,12 +228,13 @@ bool Texture::saveLTX(const char *filename, int dst_mode) // FIXME: Swizzle != Unswizzle :( // Save current parameters + unsigned int src_bpp=get_bpp(); int src_mode = mode; unsigned char *src_pixels = pixels; bool src_swizzled = swizzled; // Undo swizzling, if any - if (src_swizzled) swizzle(); + if (src_swizzled) unswizzle(); if (mode != GU_PSM_8888) { @@ -230,7 +248,7 @@ bool Texture::saveLTX(const char *filename, int dst_mode) // convert pixel format int dst_index=0; - for (int src_index=0; src_index < width*height*4; src_index+=4) + for (int src_index=0; src_index < width*height*4; src_index+=src_bpp/8) { unsigned char r = src_pixels[src_index]; unsigned char g = src_pixels[src_index+1]; @@ -240,7 +258,7 @@ bool Texture::saveLTX(const char *filename, int dst_mode) switch(dst_mode) { case GU_PSM_5650: { - unsigned short val = ((r>>3) << 11) | ((g>>2) << 5) | (b>>3); + unsigned short val = ((b>>3) << 11) | ((g>>2) << 5) | (r>>3); ((unsigned short *)pixels)[dst_index] = val; dst_index++; break; diff --git a/texture.h b/texture.h index 9bd5f93..dfe090b 100644 --- a/texture.h +++ b/texture.h @@ -13,12 +13,11 @@ struct Texture Texture(const char *filename); ~Texture(); - void bind(); - bool saveLTX(const char *filename, int dst_mode); private: void swizzle(); + void unswizzle(); unsigned int get_bpp(); void readTGA(const char *filename); void readLTX(const char *filename); -- 2.34.1