Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sdds.h File Reference
#include "gfxlib_struct.h"

Go to the source code of this file.

Functions

void ddsDecompress (unsigned char *&input, unsigned char *&output, TEXTUREFORMAT format, int height, int width)
 

Function Documentation

void ddsDecompress ( unsigned char *&  input,
unsigned char *&  output,
TEXTUREFORMAT  format,
int  height,
int  width 
)

Definition at line 111 of file sdds.cpp.

References buffer, decode_color_block(), decode_dxt3_alpha(), decode_dxt5_alpha(), DXT3, DXT5, height, width, x, and y.

Referenced by GFXTransferTexture(), and LoadTex().

112 {
113  unsigned char *pos_out = NULL, *pos_in = NULL;
114  int bpp = 4;
115  unsigned int sx, sy;
116 
117  sx = (width < 4) ? width : 4;
118  sy = (height < 4) ? width : 4;
119  data = (unsigned char*) malloc( height*width*bpp );
120  pos_out = data;
121  pos_in = buffer;
122  for (int y = 0; y < height; y += 4)
123  for (int x = 0; x < width; x += 4) {
124  pos_out = data+(y*width+x)*bpp;
125  if (internformat == DXT3) {
126  decode_dxt3_alpha( pos_out+3, pos_in, sx, sy, width*bpp );
127  pos_in += 8;
128  } else if (internformat == DXT5) {
129  decode_dxt5_alpha( pos_out+3, pos_in, sx, sy, bpp, width*bpp );
130  pos_in += 8;
131  }
132  decode_color_block( pos_out, pos_in, sx, sy, width*bpp, internformat );
133  pos_in += 8;
134  }
135 }