Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/orbweaver/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jun 11, 2021
2 parents 8ba0626 + 58d3475 commit 27b503c
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 17 deletions.
Binary file modified install/bitmaps/select_mouserotate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified install/bitmaps/select_mousetranslate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified install/bitmaps/view_clipper.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions libs/wxutil/ConsoleView.cpp
Expand Up @@ -10,8 +10,8 @@ namespace wxutil
ConsoleView::ConsoleView(wxWindow* parent) :
wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH2|wxTE_READONLY),
_errorAttr(*wxRED),
_warningAttr(wxColour(128, 128, 0)),
_standardAttr(*wxBLACK)
_warningAttr(wxColour(255, 96, 0)),
_standardAttr(wxNullColour)
{
_lineBuffer.reserve(512);
}
Expand Down Expand Up @@ -54,7 +54,7 @@ void ConsoleView::flushLine()

void ConsoleView::onIdle()
{
// Idle events occur in the main thread - prevent interrupting
// Idle events occur in the main thread - prevent interrupting
// threads in the middle of a line
std::lock_guard<std::mutex> idleLock(GlobalRadiantCore().getLogWriter().getStreamLock());

Expand Down Expand Up @@ -87,7 +87,7 @@ void ConsoleView::onIdle()
// Insert at the end of the text buffer
AppendText(pair.second);
}

_lineBuffer.clear();

// Scroll to bottom
Expand Down
5 changes: 5 additions & 0 deletions plugins/dm.objectives/CMakeLists.txt
Expand Up @@ -42,3 +42,8 @@ add_library(dm_objectives MODULE
SpecifierType.cpp)
target_compile_options(dm_objectives PUBLIC ${SIGC_CFLAGS})
target_link_libraries(dm_objectives PUBLIC wxutil)

# Enable precompiled header for dm_objectives
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(dm_objectives PRIVATE "precompiled.h")
endif()
5 changes: 5 additions & 0 deletions plugins/dm.stimresponse/CMakeLists.txt
Expand Up @@ -17,3 +17,8 @@ add_library(dm_stimresponse MODULE
StimTypes.cpp)
target_compile_options(dm_stimresponse PUBLIC ${SIGC_CFLAGS})
target_link_libraries(dm_stimresponse PUBLIC wxutil)

# Enable precompiled header for dm_stimresponse
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(dm_stimresponse PRIVATE "precompiled.h")
endif()
5 changes: 5 additions & 0 deletions plugins/script/CMakeLists.txt
Expand Up @@ -34,3 +34,8 @@ target_include_directories(script SYSTEM PUBLIC
target_link_libraries(script PUBLIC
math
${Python_LIBRARIES} ${SIGC_LIBRARIES})

# Enable precompiled header for script plugin
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(script PRIVATE "precompiled.h")
endif()
7 changes: 6 additions & 1 deletion radiant/CMakeLists.txt
Expand Up @@ -16,7 +16,6 @@ add_executable(darkradiant
main.cpp
map/AutoSaver.cpp
map/StartupMapLoader.cpp
precompiled.cpp
RadiantApp.cpp
selection/ManipulateMouseTool.cpp
selection/SelectionMouseTools.cpp
Expand Down Expand Up @@ -183,3 +182,9 @@ target_include_directories(darkradiant PRIVATE .)
target_link_libraries(darkradiant PRIVATE
math xmlutil scenegraph wxutil module
${GLIB_LIBRARIES})

# Enable precompiled header for radiant
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(darkradiant PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:precompiled.h>")
endif()
7 changes: 6 additions & 1 deletion radiantcore/CMakeLists.txt
Expand Up @@ -203,7 +203,6 @@ add_library(radiantcore MODULE
patch/PatchNode.cpp
patch/PatchRenderables.cpp
patch/PatchTesselation.cpp
precompiled.cpp
Radiant.cpp
rendersystem/backend/GLProgramFactory.cpp
rendersystem/backend/glprogram/GenericVFPProgram.cpp
Expand Down Expand Up @@ -291,3 +290,9 @@ target_include_directories(radiantcore PRIVATE .)
target_link_libraries(radiantcore PUBLIC
math xmlutil scenegraph wxutil module
${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})

# Enable precompiled header for radiantcore
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(radiantcore PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:precompiled.h>")
endif()
6 changes: 3 additions & 3 deletions radiantcore/model/picomodel/PicoModelModule.h
Expand Up @@ -53,13 +53,13 @@ class PicoModelModule :
// Register all importers available through picomodel
const picoModule_t** modules = PicoModuleList(0);

while (*modules != nullptr)
while (*modules != nullptr)
{
const picoModule_t* module = *modules++;

if (module->canload && module->load)
if (module->canload && module->load)
{
for (char* const* ext = module->defaultExts; *ext != 0; ++ext)
for (char* const* ext = module->defaultExts; *ext != 0; ++ext)
{
// greebo: File extension is expected to be UPPERCASE
std::string extension(*ext);
Expand Down
55 changes: 47 additions & 8 deletions test/ImageLoading.cpp
Expand Up @@ -3,24 +3,45 @@
#include "iimage.h"
#include "RGBAImage.h"

// Helpers for examining pixel data
using RGB8 = BasicVector3<uint8_t>;

// Override operator<< to print RGB8 components as numbers, rather than random
// ASCII characters
std::ostream& operator<< (std::ostream& os, const RGB8& rgb)
{
return os << "[" << int(rgb.x()) << ", " << int(rgb.y()) << ", "
<< int(rgb.z()) << "]";
}

namespace test
{

using ImageLoadingTest = RadiantTest;
// Test fixture for image loading. Provides a convenient method to load an image
// relative to the test project path.
class ImageLoadingTest: public RadiantTest
{
protected:

// Load an image from the given path
ImagePtr loadImage(const std::string& path)
{
auto filePath = _context.getTestProjectPath() + path;
return GlobalImageLoader().imageFromFile(filePath);
}
};

TEST_F(ImageLoadingTest, LoadPng8Bit)
{
auto filePath = _context.getTestProjectPath() + "textures/pngs/twentyone_8bit.png";
auto img = GlobalImageLoader().imageFromFile(filePath);
auto img = loadImage("textures/pngs/twentyone_8bit.png");

EXPECT_EQ(img->getWidth(), 32);
EXPECT_EQ(img->getHeight(), 32);
}

TEST_F(ImageLoadingTest, LoadPng16Bit)
{
auto filePath = _context.getTestProjectPath() + "textures/pngs/twentyone_16bit.png";
auto img = GlobalImageLoader().imageFromFile(filePath);
auto img = loadImage("textures/pngs/twentyone_16bit.png");

EXPECT_EQ(img->getWidth(), 32);
EXPECT_EQ(img->getHeight(), 32);
Expand All @@ -29,16 +50,15 @@ TEST_F(ImageLoadingTest, LoadPng16Bit)
TEST_F(ImageLoadingTest, LoadPngGreyscaleWithAlpha)
{
// This is a 8-Bit Greyscale PNG with Alpha channel, so pixel depth is 16 bits
auto filePath = _context.getTestProjectPath() + "textures/pngs/transparent_greyscale.png";
auto img = GlobalImageLoader().imageFromFile(filePath);
auto img = loadImage("textures/pngs/transparent_greyscale.png");

EXPECT_EQ(img->getWidth(), 32);
EXPECT_EQ(img->getHeight(), 32);
EXPECT_FALSE(img->isPrecompressed());

// If the image loader interprets the file correctly, we should have an RGBA
// image with the colour values being the same for R, G and B.
// If the image loader didn't convert grey to RGB, the grey value is
// If the image loader didn't convert grey to RGB, the grey value is
// smeared across the whole RGB channels and they are not uniform

EXPECT_TRUE(std::dynamic_pointer_cast<RGBAImage>(img));
Expand All @@ -57,4 +77,23 @@ TEST_F(ImageLoadingTest, LoadPngGreyscaleWithAlpha)
}
}

TEST_F(ImageLoadingTest, LoadDDSUncompressed)
{
auto img = loadImage("textures/dds/test_16x16_uncomp.dds");

// Check size is correct
EXPECT_EQ(img->getWidth(), 16);
EXPECT_EQ(img->getHeight(), 16);

// Examine pixel data
uint8_t* bytes = img->getPixels();
RGB8* pixels = reinterpret_cast<RGB8*>(bytes);

EXPECT_EQ(pixels[0], RGB8(0, 0, 0)); // border
EXPECT_EQ(pixels[18], RGB8(255, 255, 255)); // background
EXPECT_EQ(pixels[113], RGB8(0, 255, 0)); // green band
EXPECT_EQ(pixels[119], RGB8(0, 0, 255)); // red centre (but BGR)
EXPECT_EQ(pixels[255], RGB8(0, 0, 0)); // border
}

}
Binary file not shown.

0 comments on commit 27b503c

Please sign in to comment.