mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 06:32:00 +00:00
preliminary .xcf support.
imgtool tweaks. some build system fixups. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5560 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b1f6417d3a
commit
1c1f04370f
27 changed files with 1483 additions and 301 deletions
|
@ -61,15 +61,15 @@ IF(ZLIB_FOUND)
|
|||
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};ZLIB_STATIC)
|
||||
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES})
|
||||
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES})
|
||||
SET(FTEQCC_LIBS ${FTEQCC_LIBS} ${ZLIB_LIBRARIES})
|
||||
ELSE()
|
||||
MESSAGE(WARNING "libz library NOT available. compressed pk3 will not be available.")
|
||||
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_ZLIB)
|
||||
SET(ZLIB_LIBRARIES )
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(BZip2)
|
||||
IF(BZIP2_FOUND)
|
||||
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};AVAIL_BZLIB)
|
||||
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};AVAIL_BZLIB;BZLIB_STATIC)
|
||||
SET(FTE_LIBS ${FTE_LIBS} bz2)
|
||||
SET(FTESV_LIBS ${FTESV_LIBS} bz2)
|
||||
MESSAGE(STATUS "bzip2 library found. bz2-compressed pk3s will work for the price of extra bloat! yay!")
|
||||
|
@ -723,7 +723,7 @@ ELSE()
|
|||
plugins/bullet/bulletplug.cpp
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES(bullet PUBLIC ${BULLET_INCLUDE_DIRS})
|
||||
SET_TARGET_PROPERTIES(bullet PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN")
|
||||
SET_TARGET_PROPERTIES(bullet PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
|
||||
SET_TARGET_PROPERTIES(bullet PROPERTIES PREFIX "fteplug_")
|
||||
SET_TARGET_PROPERTIES(bullet PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
|
||||
TARGET_LINK_LIBRARIES(bullet m ${BULLET_LIBRARIES})
|
||||
|
@ -767,13 +767,15 @@ ELSE()
|
|||
SET_TARGET_PROPERTIES(iqmtool PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON}")
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} iqmtool)
|
||||
|
||||
ADD_EXECUTABLE(imgtool
|
||||
engine/client/image.c
|
||||
imgtool.c
|
||||
)
|
||||
SET_TARGET_PROPERTIES(imgtool PROPERTIES COMPILE_DEFINITIONS "IMGTOOL;${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}")
|
||||
TARGET_LINK_LIBRARIES(imgtool ${FTE_LIBS} )
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} imgtool)
|
||||
IF(NOT WIN32)
|
||||
ADD_EXECUTABLE(imgtool
|
||||
engine/client/image.c
|
||||
imgtool.c
|
||||
)
|
||||
SET_TARGET_PROPERTIES(imgtool PROPERTIES COMPILE_DEFINITIONS "IMGTOOL;${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}")
|
||||
TARGET_LINK_LIBRARIES(imgtool ${FTE_LIBS} )
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} imgtool)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(qtv
|
||||
fteqtv/netchan.c
|
||||
|
@ -846,7 +848,7 @@ ELSE()
|
|||
engine/qclib/qcd_main.c
|
||||
)
|
||||
SET_TARGET_PROPERTIES(fteqcc PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON}")
|
||||
TARGET_LINK_LIBRARIES(fteqcc ${ZLIB_LIBRARIES} m)
|
||||
TARGET_LINK_LIBRARIES(fteqcc ${FTEQCC_LIBS} m)
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} fteqcc)
|
||||
|
||||
IF(${WIN32})
|
||||
|
@ -864,7 +866,7 @@ ELSE()
|
|||
engine/qclib/qcd_main.c
|
||||
)
|
||||
SET_TARGET_PROPERTIES(fteqccgui PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON}")
|
||||
TARGET_LINK_LIBRARIES(fteqccgui ${ZLIB_LIBRARIES} shlwapi ole32 comctl32 comdlg32)
|
||||
TARGET_LINK_LIBRARIES(fteqccgui ${FTEQCC_LIBS} shlwapi ole32 comctl32 comdlg32)
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} fteqccgui)
|
||||
ELSE()
|
||||
FIND_PACKAGE(Qt5Widgets)
|
||||
|
@ -900,7 +902,7 @@ ELSE()
|
|||
TARGET_INCLUDE_DIRECTORIES(fteqccgui PUBLIC ${Qt5Widgets_INCLUDE_DIRS} ${QSCINTILLA_INCLUDE_DIR})
|
||||
SET_TARGET_PROPERTIES(fteqccgui PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON};${Qt5Widgets_COMPILE_DEFINITIONS}")
|
||||
SET_PROPERTY(TARGET fteqccgui PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||
TARGET_LINK_LIBRARIES(fteqccgui ${ZLIB_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${QSCINTILLA_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(fteqccgui ${FTEQCC_LIBS} ${Qt5Widgets_LIBRARIES} ${QSCINTILLA_LIBRARY})
|
||||
ELSE()
|
||||
MESSAGE(WARNING "qscintilla/qt5widgets library not detected, no fteqccgui for you")
|
||||
SET(INSTALLTARGS ${INSTALLTARGS} fteqccgui)
|
||||
|
|
|
@ -33,8 +33,8 @@ ANDROID_ZIPALIGN=$ANDROIDROOT/build-tools/$ANDROIDBUILDTOOLS/zipalign #relative
|
|||
|
||||
THREADS="-j 4"
|
||||
|
||||
TARGETS_LINUX="qcc-rel rel dbg vk-rel plugins-rel plugins-dbg"
|
||||
TARGETS_WINDOWS="sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel"
|
||||
TARGETS_LINUX="qcc-rel rel dbg plugins-rel plugins-dbg" #gl-rel vk-rel
|
||||
TARGETS_WINDOWS="sv-rel m-rel qcc-rel qccgui-scintilla qccgui-dbg m-dbg sv-dbg plugins-dbg plugins-rel" #gl-rel vk-rel mingl-rel d3d-rel
|
||||
|
||||
|
||||
PLUGINS_DROID="qi ezhud irc"
|
||||
|
@ -382,7 +382,7 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then
|
|||
#linux distros vary too much with various dependancies and versions and such, so we might as well pre-build our own copies of certain libraries. this really only needs to be done once, but its safe to retry anyway.
|
||||
cd $SVNROOT/engine
|
||||
if [ "$BUILD_LINUXx86" == "y" ]; then
|
||||
echo "Making libraries (x86)..."
|
||||
echo "Making libraries (linux x86)..."
|
||||
make FTE_TARGET=linux32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
|
||||
fi
|
||||
if [ "$BUILD_LINUXx64" == "y" ]; then
|
||||
|
@ -397,6 +397,12 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then
|
|||
echo "Making libraries (linux armhf)..."
|
||||
make FTE_TARGET=linuxarmhf makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
|
||||
fi
|
||||
if [ "$BUILD_WINDOWS" == "y" ]; then
|
||||
echo "Making libraries (linux armhf)..."
|
||||
make FTE_TARGET=win32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
|
||||
echo "Making libraries (linux armhf)..."
|
||||
make FTE_TARGET=win64 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
|
||||
fi
|
||||
if [ "$BUILD_WINDOWS" == "y" ] && [[ "$PLUGINS_WINDOWS" =~ "ode" ]]; then
|
||||
echo "Prebuilding ODE library (win32)..."
|
||||
make FTE_TARGET=win32 plugins-rel NATIVE_PLUGINS=ode 2>&1 >>/dev/null
|
||||
|
|
|
@ -2003,7 +2003,7 @@ endif
|
|||
plugins-dbg:
|
||||
@-mkdir -p $(DEBUG_DIR)
|
||||
@if test -e ../plugins/Makefile; \
|
||||
then $(MAKE) native -C ../plugins OUT_DIR="$(DEBUG_DIR)" CC="$(CC) $(W32_CFLAGS) $(DEBUG_CFLAGS)" CCX="$(CC) $(W32_CFLAGS) $(subst -Wno-pointer-sign,,$(DEBUG_CFLAGS))" ARCH="$(ARCH)" BASE_CFLAGS="$(BASE_CFLAGS)" BASE_CXXFLAGS="$(subst -Wno-pointer-sign,,$(BASE_CFLAGS))" FTE_TARGET="$(FTE_TARGET)"; \
|
||||
then $(MAKE) native -C ../plugins OUT_DIR="$(DEBUG_DIR)" CC="$(CC) $(W32_CFLAGS) $(DEBUG_CFLAGS)" CCX="$(CC) $(W32_CFLAGS) $(subst -Wno-pointer-sign,,$(DEBUG_CFLAGS))" ARCH="$(ARCH)" BASE_CFLAGS="$(BASE_CFLAGS) $(BRANDFLAGS)" BASE_CXXFLAGS="$(subst -Wno-pointer-sign,,$(BASE_CFLAGS)) $(BRANDFLAGS)" FTE_TARGET="$(FTE_TARGET)"; \
|
||||
else echo no plugins directory installed; \
|
||||
fi
|
||||
plugins:
|
||||
|
@ -2011,7 +2011,7 @@ plugins:
|
|||
plugins-rel:
|
||||
@-mkdir -p $(RELEASE_DIR)
|
||||
@if test -e ../plugins/Makefile; \
|
||||
then $(MAKE) native -C ../plugins OUT_DIR="$(RELEASE_DIR)" CC="$(CC) $(W32_CFLAGS) $(RELEASE_CFLAGS)" CCX="$(CXX) $(W32_CFLAGS) $(subst -Wno-pointer-sign,,$(RELEASE_CFLAGS))" ARCH="$(ARCH)" BASE_CFLAGS="$(BASE_CFLAGS)" BASE_CXXFLAGS="$(subst -Wno-pointer-sign,,$(BASE_CFLAGS))" FTE_TARGET="$(FTE_TARGET)"; \
|
||||
then $(MAKE) native -C ../plugins OUT_DIR="$(RELEASE_DIR)" CC="$(CC) $(W32_CFLAGS) $(RELEASE_CFLAGS)" CCX="$(CXX) $(W32_CFLAGS) $(subst -Wno-pointer-sign,,$(RELEASE_CFLAGS))" ARCH="$(ARCH)" BASE_CFLAGS="$(BASE_CFLAGS) $(BRANDFLAGS)" BASE_CXXFLAGS="$(subst -Wno-pointer-sign,,$(BASE_CFLAGS)) $(BRANDFLAGS)" FTE_TARGET="$(FTE_TARGET)"; \
|
||||
else echo no plugins directory installed; \
|
||||
fi
|
||||
plugins-rel:
|
||||
|
@ -2281,9 +2281,9 @@ libs-$(ARCH)/libspeexdsp.a:
|
|||
test -f speexdsp-$(SPEEXDSPVER).tar.gz || wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSPVER).tar.gz
|
||||
-test -f libs-$(ARCH)/libspeexdsp.a || (mkdir -p libs-$(ARCH)/speex && cd libs-$(ARCH) && tar -xvzf ../speexdsp-$(SPEEXDSPVER).tar.gz && cd speexdsp-$(SPEEXDSPVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp libspeexdsp/.libs/libspeexdsp.a ../ && cp -r include/speex/*.h ../speex/)
|
||||
|
||||
libs-$(ARCH)/libfreetype.a: libs-$(ARCH)/libpng.a
|
||||
libs-$(ARCH)/libfreetype.a libs-$(ARCH)/ft2build.h: libs-$(ARCH)/libpng.a
|
||||
test -f freetype-$(FREETYPEVER).tar.gz || wget https://download.savannah.gnu.org/releases/freetype/freetype-$(FREETYPEVER).tar.gz
|
||||
-test -f libs-$(ARCH)/libfreetype.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../freetype-$(FREETYPEVER).tar.gz && cd freetype-$(FREETYPEVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure CPPFLAGS=-I$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ LDFLAGS=-L$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ $(CONFIGARGS) --with-bzip2=no --with-harfbuzz=no && $(TOOLOVERRIDES) $(MAKE) && cp objs/.libs/libfreetype.a ../ && cp -r include/ ../)
|
||||
-test -f libs-$(ARCH)/libfreetype.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../freetype-$(FREETYPEVER).tar.gz && cd freetype-$(FREETYPEVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure CPPFLAGS=-I$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ LDFLAGS=-L$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ $(CONFIGARGS) --with-bzip2=no --with-harfbuzz=no && $(TOOLOVERRIDES) $(MAKE) && cp objs/.libs/libfreetype.a ../ && bash && cp -r include/* ../)
|
||||
|
||||
libs-$(ARCH)/libBulletDynamics.a:
|
||||
test -f bullet3-$(BULLETVER).tar.gz || wget https://github.com/bulletphysics/bullet3/archive/$(BULLETVER).tar.gz -O bullet3-$(BULLETVER).tar.gz
|
||||
|
|
|
@ -4905,7 +4905,7 @@ void CL_Init (void)
|
|||
|
||||
Cmd_AddCommandD ("fog", CL_Fog_f, "fog <density> <red> <green> <blue> <alpha> <depthbias>");
|
||||
Cmd_AddCommandD ("waterfog", CL_Fog_f, "waterfog <density> <red> <green> <blue> <alpha> <depthbias>");
|
||||
Cmd_AddCommand ("skygroup", CL_Skygroup_f);
|
||||
Cmd_AddCommandD ("skygroup", CL_Skygroup_f, "Provides a way to associate a skybox name with a series of maps, so that the requested skybox will override on a per-map basis.");
|
||||
//
|
||||
// Windows commands
|
||||
//
|
||||
|
|
|
@ -1080,6 +1080,7 @@ void CL_PredictMovePNum (int seat)
|
|||
|
||||
if (nopred)
|
||||
{
|
||||
lerpangles = false;
|
||||
//match interpolation info
|
||||
from.frame = ((char*)cl.previouspackentities - (char*)&cl.inframes[0].packet_entities) / sizeof(inframe_t);
|
||||
from.time = cl.inframes[from.frame & UPDATE_MASK].packet_entities.servertime;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2140,6 +2140,7 @@ uploadfmt_t PR_TranslateTextureFormat(int qcformat)
|
|||
case 11: return PTI_RGB565;
|
||||
case 12: return PTI_RGBA4444;
|
||||
case 13: return PTI_RG8;
|
||||
case 14: return PTI_RGB32F;
|
||||
|
||||
default:return PTI_INVALID;
|
||||
}
|
||||
|
|
|
@ -929,7 +929,7 @@ void skel_generateragdoll_f(void)
|
|||
|
||||
//FIXME: only write out the bodies specified as arguments, and with no //
|
||||
for (i = 0; i < numbones; i++)
|
||||
VFS_PUTS(f, va("//body b_%s %s\n", bones[i].name, bones[i].name));
|
||||
VFS_PUTS(f, va("//body \"b_%s\" \"%s\"\n", bones[i].name, bones[i].name));
|
||||
VFS_PUTS(f, "\n");
|
||||
|
||||
VFS_PUTS(f, "updatejoint default\n");
|
||||
|
|
|
@ -34,25 +34,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
qboolean r_pushdepth;
|
||||
#endif
|
||||
|
||||
extern cvar_t r_ambient;
|
||||
extern cvar_t r_ambient;
|
||||
|
||||
static vec3_t modelorg; /*set before recursively entering the visible surface finder*/
|
||||
static vec3_t modelorg; /*set before recursively entering the visible surface finder*/
|
||||
|
||||
model_t *currentmodel;
|
||||
model_t *currentmodel;
|
||||
|
||||
size_t maxblocksize;
|
||||
vec3_t *blocknormals;
|
||||
unsigned *blocklights;
|
||||
static size_t maxblocksize;
|
||||
static vec3_t *blocknormals;
|
||||
static unsigned *blocklights;
|
||||
|
||||
lightmapinfo_t **lightmap;
|
||||
int numlightmaps;
|
||||
static const float rgb9e5tab[32] = { //multipliers for the 9-bit mantissa, according to the biased mantissa
|
||||
//aka: pow(2, biasedexponent - bias-bits) where bias is 15 and bits is 9
|
||||
1.0/(1<<24), 1.0/(1<<23), 1.0/(1<<22), 1.0/(1<<21), 1.0/(1<<20), 1.0/(1<<19), 1.0/(1<<18), 1.0/(1<<17),
|
||||
1.0/(1<<16), 1.0/(1<<15), 1.0/(1<<14), 1.0/(1<<13), 1.0/(1<<12), 1.0/(1<<11), 1.0/(1<<10), 1.0/(1<<9),
|
||||
1.0/(1<<8), 1.0/(1<<7), 1.0/(1<<6), 1.0/(1<<5), 1.0/(1<<4), 1.0/(1<<3), 1.0/(1<<2), 1.0/(1<<1),
|
||||
1.0, 1.0*(1<<1), 1.0*(1<<2), 1.0*(1<<3), 1.0*(1<<4), 1.0*(1<<5), 1.0*(1<<6), 1.0*(1<<7),
|
||||
};
|
||||
extern const float rgb9e5tab[32];
|
||||
|
||||
extern mleaf_t *r_vischain; // linked list of visible leafs
|
||||
|
||||
|
|
|
@ -473,6 +473,7 @@ qboolean Image_WriteKTXFile(const char *filename, enum fs_relative fsroot, struc
|
|||
qboolean Image_WriteDDSFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips);
|
||||
void Image_BlockSizeForEncoding(uploadfmt_t encoding, unsigned int *blockbytes, unsigned int *blockwidth, unsigned int *blockheight);
|
||||
const char *Image_FormatName(uploadfmt_t encoding);
|
||||
qboolean Image_FormatHasAlpha(uploadfmt_t encoding);
|
||||
image_t *Image_LoadTexture (const char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
|
||||
struct pendingtextureinfo *Image_LoadMipsFromMemory(int flags, const char *iname, const char *fname, qbyte *filedata, int filesize);
|
||||
|
||||
|
|
|
@ -117,11 +117,13 @@ typedef enum uploadfmt
|
|||
//floating point formats
|
||||
PTI_R16F,
|
||||
PTI_R32F,
|
||||
PTI_RGB32F, //so qc can just use vectors for rgb. not really recommended.
|
||||
PTI_RGBA16F, //consider using e5bgr9 or bc6/astc
|
||||
PTI_RGBA32F, //usually overkill
|
||||
//packed/misaligned formats: these are specified in native endian order (high bits listed first because that's how things are represented in hex), so may need byte swapping...
|
||||
PTI_A2BGR10, //mostly for rendertargets, might also be useful for overbight lightmaps.
|
||||
PTI_E5BGR9, //mostly for fancy lightmaps
|
||||
PTI_B10G11R11F, //unshared exponents
|
||||
PTI_RGB565, //16bit alphaless format.
|
||||
PTI_RGBA4444, //16bit format (gl)
|
||||
PTI_ARGB4444, //16bit format (d3d)
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
//#define IMAGEFMT_HDR
|
||||
//#define IMAGEFMT_PBM
|
||||
//#define IMAGEFMT_PSD
|
||||
//#define IMAGEFMT_XCF //flattens, most of the time
|
||||
//#define IMAGEFMT_VTF
|
||||
//#define IPLOG
|
||||
//#define MVD_RECORDING
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
#define IMAGEFMT_ASTC //lame simple header around a single astc image. not needed for astc in ktx files etc. its better to use ktx files.
|
||||
#define IMAGEFMT_PBM //pbm/ppm/pgm/pfm family formats.
|
||||
#define IMAGEFMT_PSD //baselayer only.
|
||||
#define IMAGEFMT_XCF //flattens, most of the time
|
||||
#define IMAGEFMT_HDR //an RGBE format.
|
||||
#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
|
||||
#define IMAGEFMT_TGA //somewhat mandatory
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
//#define IMAGEFMT_ASTC //lame simple header around a single astc image. not needed for astc in ktx files etc. its better to use ktx files.
|
||||
//#define IMAGEFMT_PBM //pbm/ppm/pgm/pfm family formats.
|
||||
//#define IMAGEFMT_PSD //baselayer only.
|
||||
//#define IMAGEFMT_XCF //flattens, most of the time
|
||||
//#define IMAGEFMT_HDR //an RGBE format.
|
||||
//#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
|
||||
#define IMAGEFMT_TGA //somewhat mandatory
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
//#define IMAGEFMT_ASTC //lame simple header around a single astc image. not needed for astc in ktx files etc. its better to use ktx files.
|
||||
//#define IMAGEFMT_PBM //pbm/ppm/pgm/pfm family formats.
|
||||
//#define IMAGEFMT_PSD //baselayer only.
|
||||
//#define IMAGEFMT_XCF //flattens, most of the time
|
||||
//#define IMAGEFMT_HDR //an RGBE format.
|
||||
#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
|
||||
#define IMAGEFMT_TGA //somewhat mandatory
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
//#define IMAGEFMT_HDR
|
||||
//#define IMAGEFMT_PBM
|
||||
//#define IMAGEFMT_PSD
|
||||
//#define IMAGEFMT_XCF //flattens, most of the time
|
||||
#define IMAGEFMT_TGA
|
||||
#define IMAGEFMT_LMP
|
||||
//#define IMAGEFMT_PNG
|
||||
|
|
|
@ -845,7 +845,7 @@ static int QDECL COM_Dir_List(const char *name, qofs_t size, time_t mtime, void
|
|||
#endif
|
||||
else if (!Q_strcasecmp(ext, "tga") || !Q_strcasecmp(ext, "png") || !Q_strcasecmp(ext, "jpg") || !Q_strcasecmp(ext, "jpeg")|| !Q_strcasecmp(ext, "lmp") || !Q_strcasecmp(ext, "ico") ||
|
||||
!Q_strcasecmp(ext, "pcx") || !Q_strcasecmp(ext, "bmp") || !Q_strcasecmp(ext, "dds") || !Q_strcasecmp(ext, "ktx") || !Q_strcasecmp(ext, "vtf") || !Q_strcasecmp(ext, "psd") ||
|
||||
!Q_strcasecmp(ext, "astc")|| !Q_strcasecmp(ext, "htga")|| !Q_strcasecmp(ext, "exr") ||
|
||||
!Q_strcasecmp(ext, "astc")|| !Q_strcasecmp(ext, "htga")|| !Q_strcasecmp(ext, "exr") || !Q_strcasecmp(ext, "xcf") ||
|
||||
!Q_strcasecmp(ext, "pbm") || !Q_strcasecmp(ext, "ppm") || !Q_strcasecmp(ext, "pgm") || !Q_strcasecmp(ext, "pam") || !Q_strcasecmp(ext, "pfm") || !Q_strcasecmp(ext, "hdr") )
|
||||
{
|
||||
//FIXME: image replacements are getting in the way here.
|
||||
|
@ -3877,7 +3877,7 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags)
|
|||
{
|
||||
searchpath_t *oldpaths;
|
||||
searchpath_t *next;
|
||||
int i;
|
||||
int i, j;
|
||||
int orderkey;
|
||||
|
||||
COM_AssertMainThread("FS_ReloadPackFilesFlags");
|
||||
|
@ -3912,7 +3912,7 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags)
|
|||
#ifdef NQPROT
|
||||
standard_quake = true;
|
||||
#endif
|
||||
for (i = 0; i < sizeof(fs_manifest->gamepath) / sizeof(fs_manifest->gamepath[0]); i++)
|
||||
for (i = 0; i < countof(fs_manifest->gamepath); i++)
|
||||
{
|
||||
char *dir = fs_manifest->gamepath[i].path;
|
||||
if (dir && fs_manifest->gamepath[i].base)
|
||||
|
@ -3973,7 +3973,7 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags)
|
|||
next->flags |= SPF_BASEPATH;
|
||||
com_base_searchpaths = com_searchpaths;
|
||||
|
||||
for (i = 0; i < sizeof(fs_manifest->gamepath) / sizeof(fs_manifest->gamepath[0]); i++)
|
||||
for (i = 0; i < countof(fs_manifest->gamepath); i++)
|
||||
{
|
||||
char *dir = fs_manifest->gamepath[i].path;
|
||||
if (dir && !fs_manifest->gamepath[i].base)
|
||||
|
@ -3987,6 +3987,15 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags)
|
|||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < countof(fs_manifest->gamepath); j++)
|
||||
{
|
||||
char *dir2 = fs_manifest->gamepath[j].path;
|
||||
if (dir2 && fs_manifest->gamepath[j].base && !strcmp(dir, dir2))
|
||||
break;
|
||||
}
|
||||
if (j < countof(fs_manifest->gamepath))
|
||||
continue; //already loaded above. don't mess up gameonly_gamedir.
|
||||
|
||||
if (*dir == '*')
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1338,11 +1338,11 @@ static unsigned int Q1BSP_TranslateContents(int contents)
|
|||
case Q1CONTENTS_LAVA:
|
||||
return FTECONTENTS_LAVA;
|
||||
case Q1CONTENTS_SKY:
|
||||
return FTECONTENTS_SKY;
|
||||
return FTECONTENTS_SKY|FTECONTENTS_PLAYERCLIP|FTECONTENTS_MONSTERCLIP;
|
||||
case Q1CONTENTS_LADDER:
|
||||
return FTECONTENTS_LADDER;
|
||||
case Q1CONTENTS_CLIP:
|
||||
return FTECONTENTS_PLAYERCLIP;
|
||||
return FTECONTENTS_PLAYERCLIP|FTECONTENTS_MONSTERCLIP;
|
||||
case Q1CONTENTS_TRANS:
|
||||
return FTECONTENTS_SOLID;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
// world.h
|
||||
|
||||
#include "quakedef.h"
|
||||
|
||||
typedef struct plane_s
|
||||
{
|
||||
vec3_t normal;
|
||||
|
|
|
@ -221,7 +221,9 @@ qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mi
|
|||
case PTI_E5BGR9:
|
||||
tdesc.Format = DXGI_FORMAT_R9G9B9E5_SHAREDEXP;
|
||||
break;
|
||||
|
||||
case PTI_B10G11R11F:
|
||||
tdesc.Format = DXGI_FORMAT_R11G11B10_FLOAT;
|
||||
break;
|
||||
case PTI_RGBA8_SRGB:
|
||||
tdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
break;
|
||||
|
@ -299,6 +301,9 @@ qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mi
|
|||
case PTI_RGBA32F:
|
||||
tdesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
break;
|
||||
case PTI_RGB32F:
|
||||
tdesc.Format = DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
break;
|
||||
case PTI_L8: //UNSUPPORTED
|
||||
case PTI_P8: //R8, but different usage.
|
||||
case PTI_R8:
|
||||
|
|
|
@ -163,9 +163,12 @@ void GL_SetupFormats(void)
|
|||
// glfmtc(PTI_RGBA5551,(ver>=3)?GL_RGB555A1:0, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, tc_rgba1);
|
||||
}
|
||||
if (GL_CheckExtension("GL_OES_texture_half_float"))
|
||||
glfmtc(PTI_RGBA16F, (ver>=3)?GL_RGBA16F:0, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES, 0); //not to be confused with GL_HALF_FLOAT[_ARB] which has a different value
|
||||
glfmt(PTI_RGBA16F, (ver>=3)?GL_RGBA16F:0, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES); //not to be confused with GL_HALF_FLOAT[_ARB] which has a different value
|
||||
if (GL_CheckExtension("GL_OES_texture_float"))
|
||||
glfmtc(PTI_RGBA32F, (ver>=3)?GL_RGBA32F:0, GL_RGBA, GL_RGBA, GL_FLOAT, 0);
|
||||
{
|
||||
glfmt(PTI_RGBA32F, (ver>=3)?GL_RGBA32F:0, GL_RGBA, GL_RGBA, GL_FLOAT);
|
||||
glfmt(PTI_RGB32F, (ver>=3)?GL_RGB32F:0, GL_RGB, GL_RGB, GL_FLOAT);
|
||||
}
|
||||
|
||||
if (GL_CheckExtension("GL_WEBGL_depth_texture"))
|
||||
{ //24bit is okay with this one.
|
||||
|
@ -236,6 +239,8 @@ void GL_SetupFormats(void)
|
|||
}
|
||||
if (ver >= 3.0 || GL_CheckExtension("GL_EXT_texture_shared_exponent"))
|
||||
glfmt(PTI_E5BGR9, GL_RGB9_E5, GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV);
|
||||
if (ver >= 3.0 || GL_CheckExtension("GL_EXT_packed_float"))
|
||||
glfmt(PTI_B10G11R11F, GL_R11F_G11F_B10F, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV);
|
||||
if (ver >= 3.0 || GL_CheckExtension("GL_EXT_packed_pixels")) //so gl1.2 then.
|
||||
glfmt(PTI_A2BGR10, GL_RGB10_A2, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
|
||||
if (ver >= 3.0 || GL_CheckExtension("GL_ARB_texture_rg"))
|
||||
|
@ -260,6 +265,8 @@ void GL_SetupFormats(void)
|
|||
|
||||
glfmtc(PTI_RGBA16F, GL_RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT, 0);
|
||||
glfmtc(PTI_RGBA32F, GL_RGBA32F, GL_RGBA, GL_RGBA, GL_FLOAT, 0);
|
||||
|
||||
glfmt(PTI_RGB32F, GL_RGB32F, GL_RGB, GL_RGB, GL_FLOAT);
|
||||
}
|
||||
if (ver >= 1.2 && !gl_config_gles)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@ void R_SetSky(const char *sky)
|
|||
const char *shadername;
|
||||
extern cvar_t r_skyboxname;
|
||||
Q_strncpyz(cl.skyname, sky, sizeof(cl.skyname));
|
||||
if (qrenderer <= QR_NONE)
|
||||
return; //not ready yet...
|
||||
if (*r_skyboxname.string) //override it with the user's preference
|
||||
sky = r_skyboxname.string;
|
||||
|
||||
|
|
|
@ -696,6 +696,11 @@ typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei
|
|||
#define GL_RG8_SNORM 0x8F95 /*opengl 3.1*/
|
||||
#endif
|
||||
|
||||
#ifndef GL_R11F_G11F_B10F
|
||||
#define GL_R11F_G11F_B10F 0x8C3A
|
||||
#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
|
||||
#endif
|
||||
|
||||
#ifndef GL_TEXTURE_SWIZZLE_R
|
||||
#define GL_TEXTURE_SWIZZLE_R 0x8E42
|
||||
#define GL_TEXTURE_SWIZZLE_G 0x8E43
|
||||
|
|
|
@ -10842,7 +10842,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"crossproduct", PF_crossproduct, 0, 0, 0, 0, D("#define dotproduct(v1,v2) ((vector)(v1)*(vector)(v2))\nvector(vector v1, vector v2)", "Small helper function to calculate the crossproduct of two vectors.")},
|
||||
{"pushmove", PF_pushmove, 0, 0, 0, 0, "float(entity pusher, vector move, vector amove)"},
|
||||
#ifdef TERRAIN
|
||||
{"terrain_edit", PF_terrain_edit, 0, 0, 0, 278, D("void(float action, optional vector pos, optional float radius, optional float quant, ...)", "Realtime terrain editing. Actions are the TEREDIT_ constants.")},// (??FTE_TERRAIN_EDIT??
|
||||
{"terrain_edit", PF_terrain_edit, 0, 0, 0, 278, D("__variant(float action, optional vector pos, optional float radius, optional float quant, ...)", "Realtime terrain editing. Actions are the TEREDIT_ constants.")},// (??FTE_TERRAIN_EDIT??
|
||||
|
||||
#define qcbrushface \
|
||||
"typedef struct\n{\n" \
|
||||
|
@ -10924,8 +10924,8 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"drawline", PF_Fixme, 0, 0, 0, 315, D("void(float width, vector pos1, vector pos2, vector rgb, float alpha, optional float drawflag)", "Draws a 2d line between the two 2d points.")},// (EXT_CSQC)
|
||||
{"iscachedpic", PF_Fixme, 0, 0, 0, 316, D("float(string name)", "Checks to see if the image is currently loaded. Engines might lie, or cache between maps.")},// (EXT_CSQC)
|
||||
{"precache_pic", PF_Fixme, 0, 0, 0, 317, D("string(string name, optional float trywad)", "Forces the engine to load the named image. If trywad is specified, the specified name must any lack path and extension.")},// (EXT_CSQC)
|
||||
{"r_uploadimage", PF_Fixme, 0, 0, 0, 0, D("void(string imagename, int width, int height, void *pixeldata, optional int datasize, optional int format)", "Updates a texture with the specified rgba data. Will be created if needed. If blobsize is specified then the image is decoded (eg .ktx or .dds data) instead of being raw R8G8B8A data. You'll typically want shaderforname to also generate a shader to use the texture.")},
|
||||
{"r_readimage", PF_Fixme, 0, 0, 0, 0, D("int*(string filename, __out int width, __out int height)", "Reads and decodes an image from disk, providing raw R8G8B8A pixel data. Should not be used for dds or ktx etc formats. Returns __NULL__ if the image could not be read for any reason. Use memfree to free the data once you're done with it.")},
|
||||
{"r_uploadimage", PF_Fixme, 0, 0, 0, 0, D("void(string imagename, int width, int height, void *pixeldata, optional int datasize, optional int format)", "Updates a texture with the specified rgba data (uploading it to the gpu). Will be created if needed. If datasize is specified then the image is decoded (eg .ktx or .dds data) instead of being raw R8G8B8A data. You'll typically want shaderforname to also generate a shader to use the texture.")},
|
||||
{"r_readimage", PF_Fixme, 0, 0, 0, 0, D("int*(string filename, __out int width, __out int height)", "Reads and decodes an image from disk, providing raw R8G8B8A8 pixel data. Should not be used for dds or ktx etc formats. Returns __NULL__ if the image could not be read for any reason. Use memfree to free the data once you're done with it.")},
|
||||
{"drawgetimagesize",PF_Fixme, 0, 0, 0, 318, D("#define draw_getimagesize drawgetimagesize\nvector(string picname)", "Returns the dimensions of the named image. Images specified with .lmp should give the original .lmp's dimensions even if texture replacements use a different resolution.")},// (EXT_CSQC)
|
||||
{"freepic", PF_Fixme, 0, 0, 0, 319, D("void(string name)", "Tells the engine that the image is no longer needed. The image will appear to be new the next time its needed.")},// (EXT_CSQC)
|
||||
//320
|
||||
|
@ -12544,6 +12544,7 @@ void PR_DumpPlatform_f(void)
|
|||
{"IMGFMT_R5G6B5", "const float", CS|MENU, D("Packed 16-bit colour pixel format."), 11},
|
||||
{"IMGFMT_R4G4B4A4", "const float", CS|MENU, D("Packed 16-bit colour pixel format, with alpha"), 12},
|
||||
{"IMGFMT_R8G8", "const float", CS|MENU, D("16-bit two-channel pixel format."), 13},
|
||||
{"IMGFMT_R32G32B32F", "const float", CS|MENU, D("A pixel format that matches QC's vector type."), 14},
|
||||
|
||||
{"RF_VIEWMODEL", "const float", CS, D("Specifies that the entity is a view model, and that its origin is relative to the current view position. These entities are also subject to viewweapon bob."), CSQCRF_VIEWMODEL},
|
||||
{"RF_EXTERNALMODEL", "const float", CS, D("Specifies that this entity should be displayed in mirrors (and may still cast shadows), but will not otherwise be visible."), CSQCRF_EXTERNALMODEL},
|
||||
|
|
|
@ -1366,6 +1366,7 @@ vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t lay
|
|||
case PTI_RG8_SNORM: format = VK_FORMAT_R8G8_SNORM; break;
|
||||
case PTI_A2BGR10: format = VK_FORMAT_A2B10G10R10_UNORM_PACK32; break;
|
||||
case PTI_E5BGR9: format = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; break;
|
||||
case PTI_B10G11R11F: format = VK_FORMAT_B10G11R11_UFLOAT_PACK32; break;
|
||||
//swizzled/legacy formats
|
||||
case PTI_L8: format = VK_FORMAT_R8_UNORM; break;
|
||||
case PTI_L8A8: format = VK_FORMAT_R8G8_UNORM; break;
|
||||
|
@ -1478,6 +1479,7 @@ vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t lay
|
|||
//misaligned formats
|
||||
case PTI_RGB8: format = VK_FORMAT_R8G8B8_UNORM; break;
|
||||
case PTI_BGR8: format = VK_FORMAT_B8G8R8_UNORM; break;
|
||||
case PTI_RGB32F: format = VK_FORMAT_R32G32B32_SFLOAT; break;
|
||||
|
||||
case PTI_RGB8_SRGB: format = VK_FORMAT_R8G8B8_SRGB; break;
|
||||
case PTI_BGR8_SRGB: format = VK_FORMAT_B8G8R8_SRGB; break;
|
||||
|
@ -4126,6 +4128,7 @@ void VK_CheckTextureFormats(void)
|
|||
{PTI_ARGB1555, VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT},
|
||||
{PTI_RGBA16F, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT},
|
||||
{PTI_RGBA32F, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT},
|
||||
{PTI_RGB32F, VK_FORMAT_R32G32B32_SFLOAT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT},
|
||||
{PTI_L8, VK_FORMAT_R8_UNORM, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT},
|
||||
{PTI_L8A8, VK_FORMAT_R8G8_UNORM, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT},
|
||||
{PTI_L8_SRGB, VK_FORMAT_R8_SRGB, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT},
|
||||
|
|
366
imgtool.c
366
imgtool.c
|
@ -3,6 +3,7 @@
|
|||
#undef stderr
|
||||
#define stderr stdout
|
||||
|
||||
#include <limits.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -97,7 +98,7 @@ void FS_CreatePath(const char *pname, enum fs_relative relativeto)
|
|||
}
|
||||
free(t);
|
||||
}
|
||||
qboolean Sys_remove (const char *path)
|
||||
qboolean FS_Remove (const char *path, enum fs_relative relativeto)
|
||||
{
|
||||
//remove is part of c89.
|
||||
if (remove(path) == -1)
|
||||
|
@ -293,7 +294,7 @@ void Image_GenerateMips(struct pendingtextureinfo *mips, unsigned int flags);
|
|||
int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compression, void **buffers, int numbuffers, qintptr_t bufferstride, int width, int height, enum uploadfmt fmt, qboolean writemetadata);
|
||||
qboolean WriteTGA(const char *filename, enum fs_relative fsroot, const qbyte *fte_restrict rgb_buffer, qintptr_t bytestride, int width, int height, enum uploadfmt fmt);
|
||||
|
||||
static qboolean ImgTool_ASTCToLDR(uploadfmt_t fmt)
|
||||
static enum uploadfmt ImgTool_ASTCToLDR(uploadfmt_t fmt)
|
||||
{
|
||||
if (fmt >= PTI_ASTC_FIRST && fmt <= PTI_ASTC_LAST)
|
||||
{
|
||||
|
@ -302,6 +303,8 @@ static qboolean ImgTool_ASTCToLDR(uploadfmt_t fmt)
|
|||
if (fmt >= PTI_ASTC_4X4_SRGB)
|
||||
return (fmt-PTI_ASTC_4X4_SRGB)+PTI_ASTC_4X4_LDR;
|
||||
}
|
||||
if (fmt == PTI_BC1_RGB)
|
||||
return PTI_BC1_RGBA;
|
||||
return fmt;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
@ -330,7 +333,7 @@ static void FS_MakeTempName(char *out, size_t outsize, char *prefix, char *suffi
|
|||
close(mkstemps(out, strlen(suffix))); //bsd4.3/posix1-2001
|
||||
}
|
||||
#endif
|
||||
static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname, struct pendingtextureinfo *mips)
|
||||
static qboolean ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname, struct pendingtextureinfo *mips)
|
||||
{
|
||||
struct pendingtextureinfo tmp, *ret;
|
||||
size_t m;
|
||||
|
@ -344,6 +347,10 @@ static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname,
|
|||
qboolean canktx = false;
|
||||
uploadfmt_t targfmt = args->newpixelformat;
|
||||
|
||||
//force it to bc1 if bc2 or bc3 with no alpha channel.
|
||||
if ((targfmt == PTI_BC2_RGBA || targfmt == PTI_BC3_RGBA) && !Image_FormatHasAlpha(mips->encoding))
|
||||
targfmt = PTI_BC1_RGB;
|
||||
|
||||
if (targfmt >= PTI_ASTC_FIRST && targfmt <= PTI_ASTC_LAST)
|
||||
{
|
||||
Q_snprintfz(command, sizeof(command), "astcenc -c");
|
||||
|
@ -361,8 +368,12 @@ static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname,
|
|||
Q_snprintfz(command, sizeof(command), "nvcompress -bc4");
|
||||
else if (targfmt == PTI_BC5_RG8)
|
||||
Q_snprintfz(command, sizeof(command), "nvcompress -bc5");
|
||||
else if (targfmt == PTI_BC6_RGB_SFLOAT || targfmt == PTI_BC6_RGB_UFLOAT)
|
||||
Q_snprintfz(command, sizeof(command), "nvcompress -bc6");
|
||||
else if (targfmt == PTI_BC7_RGBA)
|
||||
Q_snprintfz(command, sizeof(command), "nvcompress -bc7");
|
||||
else
|
||||
return;
|
||||
return false;
|
||||
if (canktx)
|
||||
FS_MakeTempName(raw, sizeof(raw), "itr", ".ktx");
|
||||
else
|
||||
|
@ -382,6 +393,8 @@ static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname,
|
|||
Q_strncatz(command, " -srgb", sizeof(command));
|
||||
if (targfmt >= PTI_ASTC_4X4_HDR && targfmt <= PTI_ASTC_12X12_HDR)
|
||||
Q_strncatz(command, " -hdr", sizeof(command));
|
||||
if (targfmt >= PTI_BC1_RGB && targfmt <= PTI_BC7_RGBA_SRGB && (strstr(inname, "_n.")||strstr(inname, "_norm.")))
|
||||
Q_strncatz(command, " -normal", sizeof(command)); //looks like a normalmap... tweak metrics to favour normalised results.
|
||||
Q_strncatz(command, ">> /dev/null", sizeof(command));
|
||||
|
||||
Image_BlockSizeForEncoding(mips->encoding, &bb, &bw, &bh);
|
||||
|
@ -389,10 +402,13 @@ static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname,
|
|||
{
|
||||
tmp.mip[0] = mips->mip[m];
|
||||
tmp.mip[0].needfree = false;
|
||||
(void)tmp;
|
||||
|
||||
if (canktx)
|
||||
{
|
||||
#ifdef IMAGEFMT_KTX
|
||||
if (!Image_WriteKTXFile(raw, FS_SYSTEM, &tmp))
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -426,11 +442,12 @@ static void ImgTool_ConvertPixelFormat(struct opts_s *args, const char *inname,
|
|||
//do not warn for astc files, their block sizes are too weird.
|
||||
Image_BlockSizeForEncoding(targfmt, &bb, &bw, &bh);
|
||||
if (mips->mip[0].width%bw || mips->mip[0].height%bh)
|
||||
Con_Printf("%s: d3d warning: %i*%i is not a multiple of %i*%i\n", inname, mips->mip[0].width, mips->mip[0].height, bw, bh);
|
||||
Con_Printf("%s: mip0 of %i*%i is not a multiple of %i*%i (d3d warning)\n", inname, mips->mip[0].width, mips->mip[0].height, bw, bh);
|
||||
}
|
||||
|
||||
Sys_remove(raw);
|
||||
Sys_remove(comp);
|
||||
FS_Remove(raw, FS_SYSTEM);
|
||||
FS_Remove(comp, FS_SYSTEM);
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *COM_GetFileExtension (const char *in, const char *term)
|
||||
|
@ -453,11 +470,15 @@ static void ImgTool_Convert(struct opts_s *args, const char *inname, const char
|
|||
size_t fsize;
|
||||
struct pendingtextureinfo *in;
|
||||
const char *outext = COM_GetFileExtension(outname, NULL);
|
||||
qboolean allowcompressed = false;
|
||||
|
||||
if (!strcmp(outext, ".dds") || !strcmp(outext, ".ktx"))
|
||||
allowcompressed = true;
|
||||
|
||||
indata = FS_LoadMallocFile(inname, &fsize);
|
||||
if (indata)
|
||||
{
|
||||
in = Image_LoadMipsFromMemory(args->flags, inname, inname, indata, fsize);
|
||||
in = Image_LoadMipsFromMemory(args->flags|(allowcompressed?0:IF_NOMIPMAP), inname, inname, indata, fsize);
|
||||
if (in)
|
||||
{
|
||||
printf("%s: %s, %i*%i, %i mips\n", inname, Image_FormatName(in->encoding), in->mip[0].width, in->mip[0].height, in->mipcount);
|
||||
|
@ -468,8 +489,8 @@ static void ImgTool_Convert(struct opts_s *args, const char *inname, const char
|
|||
if (!(args->flags & IF_NOMIPMAP) && in->mipcount == 1)
|
||||
Image_GenerateMips(in, args->flags);
|
||||
|
||||
if (args->newpixelformat != PTI_INVALID)
|
||||
ImgTool_ConvertPixelFormat(args, inname, in);
|
||||
if (args->newpixelformat != PTI_INVALID && allowcompressed && ImgTool_ConvertPixelFormat(args, inname, in))
|
||||
printf("\t(Converted to %s)\n", Image_FormatName(in->encoding));
|
||||
}
|
||||
|
||||
if (!in->mipcount)
|
||||
|
@ -478,28 +499,40 @@ static void ImgTool_Convert(struct opts_s *args, const char *inname, const char
|
|||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(outext, ".ktx"))
|
||||
if (0)
|
||||
;
|
||||
#ifdef IMAGEFMT_KTX
|
||||
else if (!strcmp(outext, ".ktx"))
|
||||
Image_WriteKTXFile(outname, FS_SYSTEM, in);
|
||||
#endif
|
||||
#ifdef IMAGEFMT_DDS
|
||||
else if (!strcmp(outext, ".dds"))
|
||||
Image_WriteDDSFile(outname, FS_SYSTEM, in);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
int bb,bw,bh;
|
||||
Image_BlockSizeForEncoding(in->encoding, &bb, &bw,&bh);
|
||||
if (args->mipnum < in->mipcount)
|
||||
{
|
||||
if (!strcmp(outext, ".png"))
|
||||
if (0)
|
||||
;
|
||||
#ifdef IMAGEFMT_PNG
|
||||
else if (!strcmp(outext, ".png"))
|
||||
{
|
||||
#ifdef AVAIL_PNGLIB
|
||||
if (!Image_WritePNG(outname, FS_SYSTEM, 0, &in->mip[args->mipnum].data, 1, in->mip[args->mipnum].width*bb, in->mip[args->mipnum].width, in->mip[args->mipnum].height, in->encoding, false))
|
||||
#endif
|
||||
Con_Printf("%s(%s): Write failed\n", outname, Image_FormatName(in->encoding));
|
||||
}
|
||||
#endif
|
||||
#ifdef IMAGEFMT_TGA
|
||||
else if (!strcmp(outext, ".tga"))
|
||||
{
|
||||
if (!WriteTGA(outname, FS_SYSTEM, in->mip[args->mipnum].data, in->mip[args->mipnum].width*bb, in->mip[args->mipnum].width, in->mip[args->mipnum].height, in->encoding))
|
||||
Con_Printf("%s(%s): Write failed\n", outname, Image_FormatName(in->encoding));
|
||||
}
|
||||
#endif
|
||||
else
|
||||
Con_Printf("%s: Unknown output file format\n", outname);
|
||||
}
|
||||
|
@ -543,25 +576,77 @@ static void ImgTool_Info(struct opts_s *args, const char *inname)
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static void ImgTool_TreeConvert(struct opts_s *args, const char *srcpath, const char *destpath)
|
||||
struct filelist_s
|
||||
{
|
||||
Con_Printf("ImgTool_TreeConvert not implemented on windows.\n");
|
||||
const char **exts;
|
||||
size_t numfiles;
|
||||
struct {
|
||||
char *name;
|
||||
size_t baselen; //length up to but not including the filename extension.
|
||||
} *file;
|
||||
size_t maxfiles; //to avoid reallocs
|
||||
};
|
||||
static void FileList_Release(struct filelist_s *list)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < list->numfiles; i++)
|
||||
free(list->file[i].name);
|
||||
free(list->file);
|
||||
list->numfiles = 0;
|
||||
list->maxfiles = 0;
|
||||
}
|
||||
static void FileList_Add(struct filelist_s *list, char *fname)
|
||||
{
|
||||
size_t i;
|
||||
size_t baselen;
|
||||
const char *ext = COM_GetFileExtension(fname, NULL);
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (!list->exts[i])
|
||||
return; //extension wasn't in the list.
|
||||
if (!strcmp(list->exts[i], ext))
|
||||
break; //one of the accepted extensions
|
||||
}
|
||||
baselen = ext?ext-fname:strlen(fname);
|
||||
for (i = 0; i < list->numfiles; i++)
|
||||
{
|
||||
if (list->file[i].baselen == baselen && !strncasecmp(list->file[i].name, fname, baselen))
|
||||
{
|
||||
Con_Printf("Ignoring dupe file %s (using %s)\n", fname, list->file[i].name);
|
||||
return; //file already listed, but maybe with a different extension
|
||||
}
|
||||
}
|
||||
if (i == list->maxfiles)
|
||||
{
|
||||
list->maxfiles += 64;
|
||||
list->file = realloc(list->file, sizeof(*list->file)*list->maxfiles);
|
||||
}
|
||||
list->file[i].name = strdup(fname);
|
||||
list->file[i].baselen = baselen;
|
||||
list->numfiles++;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
static void ImgTool_TreeScan(struct filelist_s *list, const char *basepath, const char *subpath)
|
||||
{
|
||||
Con_Printf("ImgTool_TreeScan not implemented on windows.\n");
|
||||
}
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#include <fnmatch.h>
|
||||
static void ImgTool_TreeConvert(struct opts_s *args, const char *srcpath, const char *destpath)
|
||||
static void ImgTool_TreeScan(struct filelist_s *list, const char *basepath, const char *subpath)
|
||||
{
|
||||
DIR *dir;
|
||||
char file[MAX_OSPATH];
|
||||
char dest[MAX_OSPATH];
|
||||
struct dirent *ent;
|
||||
|
||||
dir = opendir(srcpath);
|
||||
if (subpath && *subpath)
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", basepath, subpath);
|
||||
else
|
||||
Q_snprintfz(file, sizeof(file), "%s", basepath);
|
||||
dir = opendir(file);
|
||||
if (!dir)
|
||||
{
|
||||
Con_Printf("Failed to open dir %s\n", srcpath);
|
||||
Con_Printf("Failed to open dir %s\n", file);
|
||||
return;
|
||||
}
|
||||
for (;;)
|
||||
|
@ -573,43 +658,200 @@ static void ImgTool_TreeConvert(struct opts_s *args, const char *srcpath, const
|
|||
continue;
|
||||
else if (ent->d_type == DT_DIR)
|
||||
{
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", srcpath, ent->d_name);
|
||||
Q_snprintfz(dest, sizeof(dest), "%s/%s", destpath, ent->d_name);
|
||||
Con_Printf("Recurse %s -> %s\n", file, dest);
|
||||
ImgTool_TreeConvert(args, file, dest);
|
||||
if (!subpath)
|
||||
continue;
|
||||
if (*subpath)
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", subpath, ent->d_name);
|
||||
else
|
||||
Q_snprintfz(file, sizeof(file), "%s", ent->d_name);
|
||||
ImgTool_TreeScan(list, basepath, file);
|
||||
}
|
||||
else if (ent->d_type == DT_REG)
|
||||
{
|
||||
const char *ext = COM_GetFileExtension(ent->d_name, NULL);
|
||||
if (!strcmp(ext, ".png")||!strcmp(ext, ".bmp")||!strcmp(ext, ".tga")||!strcmp(ext, ".jpg")||!strcmp(ext, ".exr")||!strcmp(ext, ".hdr"))
|
||||
{
|
||||
struct stat statsrc, statdst;
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", srcpath, ent->d_name);
|
||||
Q_snprintfz(dest, sizeof(dest), "%s/%s", destpath, ent->d_name);
|
||||
Q_snprintfz(dest+strlen(dest)-strlen(ext), sizeof(dest)-(strlen(dest)-strlen(ext)), ".ktx");
|
||||
|
||||
if (stat(file, &statsrc) < 0)
|
||||
{
|
||||
Con_Printf("stat(\"%s\") failed...\n", file);
|
||||
continue;
|
||||
}
|
||||
if (stat(dest, &statdst) < 0)
|
||||
statdst.st_mtim.tv_sec = INT_MIN; //make it look old
|
||||
if (statdst.st_mtim.tv_sec <= statsrc.st_mtim.tv_sec)
|
||||
{
|
||||
Con_Printf("Image file %s -> %s\n", file, dest);
|
||||
FS_CreatePath(dest, FS_SYSTEM);
|
||||
ImgTool_Convert(args, file, dest);
|
||||
}
|
||||
else
|
||||
Con_Printf("Unmodified image file %s -> %s\n", file, dest);
|
||||
}
|
||||
if (subpath && *subpath)
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", subpath, ent->d_name);
|
||||
else
|
||||
Q_snprintfz(file, sizeof(file), "%s", ent->d_name);
|
||||
FileList_Add(list, file);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
static void ImgTool_TreeConvert(struct opts_s *args, const char *srcpath, const char *destpath)
|
||||
{
|
||||
size_t newfiles=0, skippedfiles=0, processedfiles=0;
|
||||
char file[MAX_OSPATH];
|
||||
char dest[MAX_OSPATH];
|
||||
const char *exts[] = {".png", ".bmp", ".tga", ".jpg", ".exr", ".hdr", NULL};
|
||||
struct filelist_s list = {exts};
|
||||
size_t i, destlen = strlen(destpath)+1;
|
||||
ImgTool_TreeScan(&list, srcpath, "");
|
||||
|
||||
if (!list.numfiles)
|
||||
Con_Printf("No suitable files found in directory: %s\n", srcpath);
|
||||
|
||||
for (i = 0; i < list.numfiles; i++)
|
||||
{
|
||||
struct stat statsrc, statdst;
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", srcpath, list.file[i].name);
|
||||
Q_snprintfz(dest, sizeof(dest), "%s/%s", destpath, list.file[i].name);
|
||||
Q_snprintfz(dest+destlen+list.file[i].baselen, sizeof(dest)-destlen-list.file[i].baselen, ".dds");
|
||||
|
||||
if (stat(file, &statsrc) < 0)
|
||||
{
|
||||
Con_Printf("stat(\"%s\") failed...\n", file);
|
||||
continue;
|
||||
}
|
||||
if (stat(dest, &statdst) < 0)
|
||||
{
|
||||
statdst.st_mtim.tv_sec = INT_MIN; //make it look old
|
||||
newfiles++;
|
||||
}
|
||||
if (statdst.st_mtim.tv_sec <= statsrc.st_mtim.tv_sec)
|
||||
{
|
||||
processedfiles++;
|
||||
// Con_Printf("Image file %s -> %s\n", file, dest);
|
||||
FS_CreatePath(dest, FS_SYSTEM);
|
||||
ImgTool_Convert(args, file, dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
skippedfiles++;
|
||||
// Con_Printf("Unmodified image file %s -> %s\n", file, dest);
|
||||
}
|
||||
}
|
||||
Con_Printf("found: %u, processed: %u, skipped: %u, new: %u\n", (unsigned int)list.numfiles, (unsigned int)processedfiles, (unsigned int)skippedfiles, (unsigned int)newfiles);
|
||||
FileList_Release(&list);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
long offset; // Position of the entry in WAD
|
||||
long dsize; // Size of the entry in WAD file
|
||||
long size; // Size of the entry in memory
|
||||
char type; // type of entry
|
||||
char cmprs; // Compression. 0 if none.
|
||||
short dummy; // Not used
|
||||
char name[16]; // we use only first 8
|
||||
} wad2entry_t;
|
||||
typedef struct
|
||||
{
|
||||
char magic[4]; //should be WAD2
|
||||
long num; //number of entries
|
||||
long offset; //location of directory
|
||||
} wad2_t;
|
||||
static void ImgTool_WadConvert(struct opts_s *args, const char *srcpath, const char *destpath)
|
||||
{
|
||||
char file[MAX_OSPATH];
|
||||
const char *exts[] = {".png", ".bmp", ".tga", ".jpg", ".exr", ".hdr", NULL};
|
||||
struct filelist_s list = {exts};
|
||||
size_t i, u;
|
||||
vfsfile_t *f;
|
||||
char *inname;
|
||||
qbyte *indata;
|
||||
size_t fsize;
|
||||
wad2_t wad2;
|
||||
wad2entry_t *wadentries = NULL, *entry;
|
||||
size_t maxentries;
|
||||
miptex_t mip;
|
||||
ImgTool_TreeScan(&list, srcpath, NULL);
|
||||
|
||||
f = FS_OpenVFS(destpath, "wb", FS_SYSTEM);
|
||||
wad2.magic[0] = 'W';
|
||||
wad2.magic[1] = 'A';
|
||||
wad2.magic[2] = 'D';
|
||||
wad2.magic[3] = '3'; //wad3 instead of 2, so we can include a palette for tools to validate against
|
||||
VFS_WRITE(f, &wad2, 12);
|
||||
|
||||
//try to decompress everything to a nice friendly palletizable range.
|
||||
for (u = 1; u < countof(sh_config.texfmt); u++)
|
||||
sh_config.texfmt[u] = (u==PTI_RGBA8)||(u==PTI_RGBX8)||(u==PTI_P8);
|
||||
|
||||
for (i = 0; i < list.numfiles; i++)
|
||||
{
|
||||
Q_snprintfz(file, sizeof(file), "%s/%s", srcpath, list.file[i].name);
|
||||
inname = list.file[i].name;
|
||||
if (list.file[i].baselen > 15)
|
||||
{
|
||||
Con_Printf("Path too long for wad - %s\n", inname);
|
||||
continue;
|
||||
}
|
||||
indata = FS_LoadMallocFile(file, &fsize);
|
||||
if (indata)
|
||||
{
|
||||
struct pendingtextureinfo *in = Image_LoadMipsFromMemory(args->flags|IF_PALETTIZE, inname, file, indata, fsize);
|
||||
Image_GenerateMips(in, args->flags);
|
||||
if (in)
|
||||
{
|
||||
if (in->mipcount == 1)
|
||||
Image_GenerateMips(in, args->flags);
|
||||
|
||||
if (!in->mipcount)
|
||||
{
|
||||
printf("%s: unable to load any mips\n", inname);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (args->mipnum >= in->mipcount)
|
||||
{
|
||||
printf("%s: not enough mips\n", inname);
|
||||
continue;
|
||||
}
|
||||
if ((in->mip[args->mipnum].width|in->mip[args->mipnum].height) & 15)
|
||||
printf("%s(%i): WARNING: not multiple of 16 - %i*%i\n", inname, args->mipnum, in->mip[args->mipnum].width, in->mip[args->mipnum].height);
|
||||
|
||||
if (wad2.num == maxentries)
|
||||
{
|
||||
maxentries += 64;
|
||||
wadentries = realloc(wadentries, sizeof(*wadentries)*maxentries);
|
||||
}
|
||||
entry = &wadentries[wad2.num++];
|
||||
Q_strncpyz(entry->name, inname, 16);
|
||||
entry->name[list.file[i].baselen] = 0; //kill any .tga
|
||||
entry->type = TYP_MIPTEX;
|
||||
entry->cmprs = 0;
|
||||
entry->dummy = 0;
|
||||
entry->offset = VFS_TELL(f);
|
||||
|
||||
memcpy(mip.name, entry->name, sizeof(mip.name));
|
||||
mip.width = in->mip[args->mipnum].width;
|
||||
mip.height = in->mip[args->mipnum].height;
|
||||
mip.offsets[0] = in->mip[args->mipnum+0].datasize?sizeof(mip):0;
|
||||
mip.offsets[1] = in->mip[args->mipnum+1].datasize?mip.offsets[args->mipnum+0]+in->mip[args->mipnum+0].datasize:0;
|
||||
mip.offsets[2] = in->mip[args->mipnum+2].datasize?mip.offsets[args->mipnum+1]+in->mip[args->mipnum+1].datasize:0;
|
||||
mip.offsets[3] = in->mip[args->mipnum+3].datasize?mip.offsets[args->mipnum+2]+in->mip[args->mipnum+2].datasize:0;
|
||||
|
||||
VFS_WRITE(f, &mip, sizeof(mip));
|
||||
VFS_WRITE(f, in->mip[args->mipnum+0].data, in->mip[args->mipnum+0].datasize);
|
||||
VFS_WRITE(f, in->mip[args->mipnum+1].data, in->mip[args->mipnum+1].datasize);
|
||||
VFS_WRITE(f, in->mip[args->mipnum+2].data, in->mip[args->mipnum+2].datasize);
|
||||
VFS_WRITE(f, in->mip[args->mipnum+3].data, in->mip[args->mipnum+3].datasize);
|
||||
if (wad2.magic[3] == '3')
|
||||
{
|
||||
VFS_WRITE(f, "\x00\x01", 2);
|
||||
VFS_WRITE(f, host_basepal, 256*3);
|
||||
}
|
||||
|
||||
entry->size = entry->dsize = VFS_TELL(f)-entry->offset;
|
||||
}
|
||||
}
|
||||
wad2.offset = VFS_TELL(f);
|
||||
VFS_WRITE(f, wadentries, sizeof(*wadentries)*wad2.num);
|
||||
VFS_SEEK(f, 0);
|
||||
VFS_WRITE(f, &wad2, sizeof(wad2));
|
||||
VFS_CLOSE(f);
|
||||
|
||||
FileList_Release(&list);
|
||||
}
|
||||
*/
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
|
@ -617,7 +859,8 @@ int main(int argc, const char **argv)
|
|||
{
|
||||
mode_info,
|
||||
mode_convert,
|
||||
mode_autotree
|
||||
mode_autotree,
|
||||
mode_genwad
|
||||
} mode = mode_info;
|
||||
size_t u, f;
|
||||
struct opts_s args;
|
||||
|
@ -652,9 +895,10 @@ int main(int argc, const char **argv)
|
|||
showhelp:
|
||||
Con_Printf("show info : %s -i *.ktx\n", argv[0]);
|
||||
Con_Printf("compress : %s --astc_6x6_ldr [--nomips] in.png out.ktx [in2.png out2.ktx]\n", argv[0]);
|
||||
Con_Printf("compress : %s --bc3_rgba [--nomips] in.png out.dds\n", argv[0]);
|
||||
Con_Printf("convert : %s -c in.exr out.dds\n", argv[0]);
|
||||
Con_Printf("decompress: %s -d [--exportmip 0] [--nomips] in.ktx out.png\n", argv[0]);
|
||||
Con_Printf("compress : %s --bc3_rgba [--premul] [--nomips] in.png out.dds\n\tConvert pixel format (to bc3 aka dxt5) before writing to output file.\n", argv[0]);
|
||||
Con_Printf("convert : %s --convert in.exr out.dds\n\tConvert to different file format, while trying to preserve pixel formats.\n", argv[0]);
|
||||
Con_Printf("decompress: %s --decompress [--exportmip 0] [--nomips] in.ktx out.png\n\tDecompresses any block-compressed pixel data.\n", argv[0]);
|
||||
// Con_Printf("gen wad : %s --genwad [--exportmip 2] srcdir out.wad\n", argv[0]);
|
||||
// Con_Printf("auto : %s --astc_6x6_ldr -r _postfix.png srcdir destdir\n", argv[0]);
|
||||
|
||||
Image_PrintInputFormatVersions();
|
||||
|
@ -667,13 +911,15 @@ showhelp:
|
|||
Con_Printf(" --%-15s %.2fbpp (requires astcenc)\n", Image_FormatName(f), 8*(float)bb/(bw*bh));
|
||||
else if (f==PTI_BC1_RGB||f==PTI_BC1_RGBA||f==PTI_BC2_RGBA||f==PTI_BC3_RGBA||f==PTI_BC4_R8||f==PTI_BC5_RG8)
|
||||
Con_Printf(" --%-15s %.2fbpp (requires nvcompress)\n", Image_FormatName(f), 8*(float)bb/(bw*bh));
|
||||
else if (f==PTI_BC6_RGB_UFLOAT || f==PTI_BC6_RGB_SFLOAT || f==PTI_BC7_RGBA)
|
||||
Con_Printf(" --%-15s %.2fbpp (requires nvcompress 2.1+)\n", Image_FormatName(f), 8*(float)bb/(bw*bh));
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (!strcmp(argv[u], "-c") || !strcmp(argv[u], "--convert"))
|
||||
mode = mode_convert;
|
||||
else if (!strcmp(argv[u], "-d") || !strcmp(argv[u], "--decompress"))
|
||||
{
|
||||
{ //remove any (weird) gpu formats
|
||||
for (f = PTI_BC1_RGB; f < PTI_ASTC_LAST; f++)
|
||||
sh_config.texfmt[f] = false;
|
||||
mode = mode_convert;
|
||||
|
@ -682,10 +928,16 @@ showhelp:
|
|||
mode = mode_autotree;
|
||||
else if (!strcmp(argv[u], "-i") || !strcmp(argv[u], "--info"))
|
||||
mode = mode_info;
|
||||
else if (!strcmp(argv[u], "-w") || !strcmp(argv[u], "--genwad"))
|
||||
mode = mode_genwad;
|
||||
else if (!strcmp(argv[u], "--nomips") )
|
||||
args.flags |= IF_NOMIPMAP;
|
||||
else if (!strcmp(argv[u], "--mips"))
|
||||
args.flags &= ~IF_NOMIPMAP;
|
||||
else if (!strcmp(argv[u], "--premul") )
|
||||
args.flags |= IF_PREMULTIPLYALPHA;
|
||||
else if (!strcmp(argv[u], "--nopremul"))
|
||||
args.flags &= ~IF_PREMULTIPLYALPHA;
|
||||
else if (!strcmp(argv[u], "--exportmip"))
|
||||
{
|
||||
char *e = "erk";
|
||||
|
@ -737,6 +989,14 @@ showhelp:
|
|||
u++;
|
||||
}
|
||||
}
|
||||
else if (mode == mode_genwad)
|
||||
{
|
||||
if (u+1 < argc)
|
||||
{
|
||||
//ImgTool_WadConvert(&args, argv[u], argv[u+1]);
|
||||
u++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define Plug_Init Plug_Bullet_Init
|
||||
#pragma comment(lib,"../../plugins/bullet/libs/bullet_dbg.lib")
|
||||
#endif
|
||||
|
||||
#include "quakedef.h"
|
||||
#include "../plugin.h"
|
||||
#include "../engine.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue