Skip to content

Commit

Permalink
fix stb_dxt.h; fix misspelled STB_DXT_IMPLEMENTATION in test jig
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Barrett committed Jan 30, 2018
1 parent f2974f6 commit 06feddd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
20 changes: 10 additions & 10 deletions stb_dxt.h
@@ -1,4 +1,4 @@
// stb_dxt.h - v1.08 - DXT1/DXT5 compressor - public domain // stb_dxt.h - v1.08b - DXT1/DXT5 compressor - public domain
// original by fabian "ryg" giesen - ported to C by stb // original by fabian "ryg" giesen - ported to C by stb
// use '#define STB_DXT_IMPLEMENTATION' before including to create the implementation // use '#define STB_DXT_IMPLEMENTATION' before including to create the implementation
// //
Expand Down Expand Up @@ -32,11 +32,6 @@
#ifndef STB_INCLUDE_STB_DXT_H #ifndef STB_INCLUDE_STB_DXT_H
#define STB_INCLUDE_STB_DXT_H #define STB_INCLUDE_STB_DXT_H


// compression mode (bitflags)
#define STB_DXT_NORMAL 0
#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like!
#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower.

#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
Expand All @@ -47,15 +42,21 @@ extern "C" {
#define STBDDEF extern #define STBDDEF extern
#endif #endif


// compression mode (bitflags)
#define STB_DXT_NORMAL 0
#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like!
#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower.

STBDDEF void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src_rgba_four_bytes_per_pixel, int alpha, int mode); STBDDEF void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src_rgba_four_bytes_per_pixel, int alpha, int mode);
STBDDEF void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src_r_one_byte_per_pixel); STBDDEF void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src_r_one_byte_per_pixel);
STBDDEF void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src_rg_two_byte_per_pixel); STBDDEF void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src_rg_two_byte_per_pixel);


#define STB_COMPRESS_DXT_BLOCK

#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

#endif // STB_INCLUDE_STB_DXT_H
#define STB_COMPRESS_DXT_BLOCK


#ifdef STB_DXT_IMPLEMENTATION #ifdef STB_DXT_IMPLEMENTATION


Expand Down Expand Up @@ -650,7 +651,7 @@ static void stb__InitDXT()


void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode) void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode)
{ {
unsigned char *data[16][4]; unsigned char data[16][4];
static int init=1; static int init=1;
if (init) { if (init) {
stb__InitDXT(); stb__InitDXT();
Expand Down Expand Up @@ -683,7 +684,6 @@ void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src)
stb__CompressAlphaBlock(dest + 8,(unsigned char*) src+1,2); stb__CompressAlphaBlock(dest + 8,(unsigned char*) src+1,2);
} }
#endif // STB_DXT_IMPLEMENTATION #endif // STB_DXT_IMPLEMENTATION
#endif // STB_INCLUDE_STB_DXT_H


/* /*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions tests/test_c_compilation.c
Expand Up @@ -4,7 +4,6 @@


#define STB_PERLIN_IMPLEMENTATION #define STB_PERLIN_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION
#define STB_DXT_IMPLEMENATION
#define STB_C_LEXER_IMPLEMENTATIOn #define STB_C_LEXER_IMPLEMENTATIOn
#define STB_DIVIDE_IMPLEMENTATION #define STB_DIVIDE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
Expand All @@ -19,12 +18,14 @@
#include "stb_image.h" #include "stb_image.h"
#include "stb_image_write.h" #include "stb_image_write.h"
#include "stb_perlin.h" #include "stb_perlin.h"
#include "stb_dxt.h"
#include "stb_c_lexer.h" #include "stb_c_lexer.h"
#include "stb_divide.h" #include "stb_divide.h"
#include "stb_image_resize.h" #include "stb_image_resize.h"
#include "stb_rect_pack.h" #include "stb_rect_pack.h"


#define STB_DXT_IMPLEMENTATION
#include "stb_dxt.h"

#define STBVOX_CONFIG_MODE 1 #define STBVOX_CONFIG_MODE 1
#include "stb_voxel_render.h" #include "stb_voxel_render.h"


Expand Down

0 comments on commit 06feddd

Please sign in to comment.