project(NetRadiant C CXX)
option(BUILD_RADIANT "Build the GUI" ON)
+option(BUILD_CRUNCH "Build Crunch image support" OFF)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "..." FORCE)
add_subdirectory(cmdlib)
add_subdirectory(container)
-add_subdirectory(crnrgba)
+if (BUILD_CRUNCH)
+ add_subdirectory(crnrgba)
+endif ()
add_subdirectory(ddslib)
add_subdirectory(debugging)
add_subdirectory(etclib)
add_subdirectory(archivezip)
add_subdirectory(entity)
add_subdirectory(image)
+
+if(BUILD_CRUNCH)
+ add_subdirectory(imagecrn)
+endif()
+
add_subdirectory(imagehl)
add_subdirectory(imagepng)
add_subdirectory(imageq2)
ktx.cpp ktx.h
pcx.cpp pcx.h
tga.cpp tga.h
- crn.cpp crn.h
)
find_package(JPEG REQUIRED)
-target_include_directories(image PRIVATE ${JPEG_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libs/crnrgba)
-target_link_libraries(image PRIVATE crnrgba ddslib etclib ${JPEG_LIBRARIES})
+target_include_directories(image PRIVATE ${JPEG_INCLUDE_DIR})
+target_link_libraries(image PRIVATE ddslib etclib ${JPEG_LIBRARIES})
target_compile_options(image PRIVATE -fexceptions)
+++ /dev/null
-/*
- Copyright (C) 2018, Unvanquished Developers
- All Rights Reserved.
-
- This file is part of NetRadiant.
-
- NetRadiant is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- NetRadiant is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with NetRadiant; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "crn.h"
-
-#include <stdlib.h>
-
-#include "ifilesystem.h"
-#include "iarchive.h"
-#include "idatastream.h"
-
-#include "crn_rgba.h"
-#include "ddslib.h"
-#include "imagelib.h"
-
-Image *LoadCRNBuff(const byte *buffer, int length)
-{
- int width, height;
- if (!GetCRNImageSize(buffer, length, &width, &height)) {
- globalErrorStream() << "ERROR: Error getting crn imag dimensions.\n";
- return nullptr;
- }
- RGBAImage *image = new RGBAImage(width, height);
- if (!ConvertCRNtoRGBA(buffer, length, width * height, image->getRGBAPixels())) {
- globalErrorStream() << "ERROR: Error decoding crn image.\n";
- image->release();
- return nullptr;
- }
- return image;
-}
-
-Image *LoadCRN(ArchiveFile &file)
-{
- ScopedArchiveBuffer buffer(file);
- return LoadCRNBuff(buffer.buffer, buffer.length);
-}
+++ /dev/null
-/*
- Copyright (C) 2018, Unvanquished Developers
- All Rights Reserved.
-
- This file is part of NetRadiant.
-
- NetRadiant is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- NetRadiant is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with NetRadiant; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if !defined( INCLUDED_CRN_H )
-#define INCLUDED_CRN_H
-
-class Image;
-
-class ArchiveFile;
-
-Image *LoadCRN(ArchiveFile &file);
-
-#endif
-
#include "pcx.h"
#include "dds.h"
#include "ktx.h"
-#include "crn.h"
#include "modulesystem/singletonmodule.h"
ImageKTXModule g_ImageKTXModule;
-class ImageCRNAPI {
- _QERPlugImageTable m_imagecrn;
-public:
- typedef _QERPlugImageTable Type;
-
- STRING_CONSTANT(Name, "crn");
-
- ImageCRNAPI()
- {
- m_imagecrn.loadImage = LoadCRN;
- }
-
- _QERPlugImageTable *getTable()
- {
- return &m_imagecrn;
- }
-};
-
-typedef SingletonModule<ImageCRNAPI, ImageDependencies> ImageCRNModule;
-
-ImageCRNModule g_ImageCRNModule;
-
-
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
{
initialiseModule(server);
g_ImagePCXModule.selfRegister();
g_ImageDDSModule.selfRegister();
g_ImageKTXModule.selfRegister();
- g_ImageCRNModule.selfRegister();
}
--- /dev/null
+radiant_plugin(imagecrn
+ imagecrn.cpp
+ crn.cpp crn.h
+ )
+
+target_include_directories(imagecrn PRIVATE ${CMAKE_SOURCE_DIR}/libs/crnrgba)
+target_link_libraries(imagecrn PRIVATE crnrgba)
--- /dev/null
+/*
+ Copyright (C) 2018, Unvanquished Developers
+ All Rights Reserved.
+
+ This file is part of NetRadiant.
+
+ NetRadiant is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ NetRadiant is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with NetRadiant; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "crn.h"
+
+#include <stdlib.h>
+
+#include "ifilesystem.h"
+#include "iarchive.h"
+#include "idatastream.h"
+
+#include "crn_rgba.h"
+#include "ddslib.h"
+#include "imagelib.h"
+
+Image *LoadCRNBuff(const byte *buffer, int length)
+{
+ int width, height;
+ if (!GetCRNImageSize(buffer, length, &width, &height)) {
+ globalErrorStream() << "ERROR: Error getting crn imag dimensions.\n";
+ return nullptr;
+ }
+ RGBAImage *image = new RGBAImage(width, height);
+ if (!ConvertCRNtoRGBA(buffer, length, width * height, image->getRGBAPixels())) {
+ globalErrorStream() << "ERROR: Error decoding crn image.\n";
+ image->release();
+ return nullptr;
+ }
+ return image;
+}
+
+Image *LoadCRN(ArchiveFile &file)
+{
+ ScopedArchiveBuffer buffer(file);
+ return LoadCRNBuff(buffer.buffer, buffer.length);
+}
--- /dev/null
+/*
+ Copyright (C) 2018, Unvanquished Developers
+ All Rights Reserved.
+
+ This file is part of NetRadiant.
+
+ NetRadiant is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ NetRadiant is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with NetRadiant; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if !defined( INCLUDED_CRN_H )
+#define INCLUDED_CRN_H
+
+class Image;
+
+class ArchiveFile;
+
+Image *LoadCRN(ArchiveFile &file);
+
+#endif
+
--- /dev/null
+/*
+ Copyright (C) 2001-2006, William Joseph.
+ All Rights Reserved.
+
+ This file is part of GtkRadiant.
+
+ GtkRadiant is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GtkRadiant is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GtkRadiant; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "ifilesystem.h"
+#include "iimage.h"
+
+#include "crn.h"
+
+
+#include "modulesystem/singletonmodule.h"
+
+class ImageDependencies : public GlobalFileSystemModuleRef {
+};
+
+class ImageCRNAPI {
+ _QERPlugImageTable m_imagecrn;
+public:
+ typedef _QERPlugImageTable Type;
+
+ STRING_CONSTANT(Name, "crn");
+
+ ImageCRNAPI()
+ {
+ m_imagecrn.loadImage = LoadCRN;
+ }
+
+ _QERPlugImageTable *getTable()
+ {
+ return &m_imagecrn;
+ }
+};
+
+typedef SingletonModule<ImageCRNAPI, ImageDependencies> ImageCRNModule;
+
+ImageCRNModule g_ImageCRNModule;
+
+
+extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
+{
+ initialiseModule(server);
+
+ g_ImageCRNModule.selfRegister();
+}
--- /dev/null
+; imagepng.def : Declares the module parameters for the DLL.
+
+LIBRARY "IMAGECRN"
+
+EXPORTS
+ ; Explicit exports can go here
+ Radiant_RegisterModules @1
q3map2/writebsp.c
)
+if (BUILD_CRUNCH)
+ set(OPTIONAL_IMAGE_LIBRARIES crnrgba)
+ set(OPTIONAL_IMAGE_DEFINES BUILD_CRUNCH=1)
+endif ()
+
+target_compile_definitions(q3map2
+ PRIVATE
+ ${OPTIONAL_IMAGE_DEFINES}
+ )
+
target_link_libraries(q3map2
${GLIB_LIBRARIES}
${JPEG_LIBRARIES}
${LIBXML2_LIBRARIES}
${Minizip_LIBRARIES}
${ZLIB_LIBRARIES}
- crnrgba
+ ${OPTIONAL_IMAGE_LIBRARIES}
ddslib
etclib
filematch
DDSDecompress( (ddsBuffer_t*) buffer, *pixels );
}
+#ifdef BUILD_CRUNCH
/*
LoadCRNBuffer
loads a crn image into a valid rgba image
return;
}
}
+#endif // BUILD_CRUNCH
/*
if ( size > 0 ) {
LoadKTXBufferFirstImage( buffer, size, &image->pixels, &image->width, &image->height );
}
+ #ifdef BUILD_CRUNCH
else
{
/* attempt to load crn */
LoadCRNBuffer( buffer, size, &image->pixels, &image->width, &image->height );
}
}
+ #endif // BUILD_CRUNCH
}
}
}