make_ci8_tex.c 1.18 KB
/*
 *  make color index lut for 256 entries, a linear ramp
 *  make color index tex, a linear ramp
 */
#include <stdio.h>
#include "mbi.h"

#define DEF_RED		0x80
#define DEF_GRN		0x80
#define DEF_BLU		0x80
#define DEF_ALP		0xff


main(int argc, char **argv)
{
  int i, j, flag, clr, red, grn, blu;
  int             quadricate = 0;
  int             c;
  extern int      optind;
  extern char     *optarg;

  while ((c = getopt (argc, argv, "Q")) != EOF) {
      switch (c) {
                        case 'Q':
                                quadricate = 1;
                                break;
                        default:
                                break;
      }
  }


  printf("unsigned short palette256[] = {");
  for(i = 0; i < 256; i++)
  {
    if(!(i % 8))
      printf("\n");

    if(quadricate)
      printf("0x%02xff, 0x%02xff, 0x%02xff, 0x%02xff, ", i, i, i, i);
    else
      printf("0x%02xff, ", i);
  }
  printf("};\n");
  printf("\n");

  printf("static Gfx CI8ramp_dummy_aligner[] = { gsSPEndDisplayList() };\n");
  printf("unsigned char CI8ramp[] = {\n");
  for(j = 0; j < 256; j++)
  {
    if(!(j % 8))
      printf("\n");

    printf("0x%02x, ", j);
  }
  printf("};\n");
}