Merge branch 'wip'
This commit is contained in:
17
3rdParty/opencv/CMakeLists.txt
vendored
17
3rdParty/opencv/CMakeLists.txt
vendored
@@ -1,17 +0,0 @@
|
||||
Find_Package(OpenCV)
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT DEFINED OPENCV_REPO)
|
||||
set(OPENCV_REPO https://github.com/opencv/opencv.git)
|
||||
endif ()
|
||||
|
||||
if (NOT OpenCV_FOUND)
|
||||
FetchContent_Declare(
|
||||
opencv
|
||||
EXCLUDE_FROM_ALL
|
||||
GIT_REPOSITORY ${OPENCV_REPO}
|
||||
GIT_TAG v4.8.1
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(opencv)
|
||||
endif()
|
||||
@@ -109,6 +109,7 @@ namespace OpenVulkano::AR
|
||||
}
|
||||
}
|
||||
tjFree(outBuffer);
|
||||
tjDestroy(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenVulkano
|
||||
EngineConfiguration::EngineConfiguration()
|
||||
{
|
||||
const std::string filePath = (AppFolders::GetAppConfigHomeDir() / "EngineConfig.yml").string();
|
||||
Array<char> fileContents = Utils::ReadFile(filePath, true);
|
||||
Array<char> fileContents = Utils::ReadFile(filePath, true, true);
|
||||
if(fileContents.Size() == 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenVulkano
|
||||
if (GetCamera()->IsOrtho())
|
||||
{
|
||||
HandleMovementOrtho();
|
||||
if (GetCamera()->GetZoom() > 50)
|
||||
/*if (GetCamera()->GetZoom() > 50)
|
||||
{
|
||||
float nDist = std::max<float>(((ZOOM_RANGE - sqrt(GetCamera()->GetZoom())) / ZOOM_RANGE) * m_distance, 0.1f);
|
||||
if (nDist != m_frameDistance)
|
||||
@@ -116,7 +116,7 @@ namespace OpenVulkano
|
||||
m_distUpated = true;
|
||||
m_frameDistance = nDist;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
#include <thread>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
#if __has_include("tracy/Tracy.hpp")
|
||||
#include <tracy/Tracy.hpp>
|
||||
#define HAS_TRACY
|
||||
#endif
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
@@ -25,7 +28,10 @@ namespace OpenVulkano
|
||||
: app(app), renderApi(renderApi)
|
||||
{
|
||||
Utils::SetThreadName("Main");
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
|
||||
|
||||
Logger::SetupLogger();
|
||||
if (!app)
|
||||
@@ -53,7 +59,9 @@ namespace OpenVulkano
|
||||
: app(app), renderApi(renderApi)
|
||||
{
|
||||
Utils::SetThreadName("Main");
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
|
||||
Logger::SetupLogger();
|
||||
if (!app)
|
||||
@@ -136,7 +144,9 @@ namespace OpenVulkano
|
||||
|
||||
void GraphicsAppManager::StartUp()
|
||||
{
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
Logger::MANAGER->info("Initializing ...");
|
||||
@@ -169,8 +179,11 @@ namespace OpenVulkano
|
||||
|
||||
void GraphicsAppManager::LoopTick()
|
||||
{
|
||||
#ifdef HAS_TRACY
|
||||
FrameMark;
|
||||
ZoneScoped;
|
||||
#endif
|
||||
|
||||
if (platform) platform->Tick();
|
||||
if (paused)
|
||||
{ // The rendering is paused
|
||||
@@ -197,7 +210,9 @@ namespace OpenVulkano
|
||||
|
||||
void GraphicsAppManager::ShutDown()
|
||||
{
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
Logger::MANAGER->info("Shutting down ...");
|
||||
app->Close();
|
||||
renderer->Close();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
#include "ImageLoaderJpeg.hpp"
|
||||
#include "Base/Utils.hpp"
|
||||
#include <Data/Containers/Array.hpp>
|
||||
#include "Base/Logger.hpp"
|
||||
#include "Data/Containers/Array.hpp"
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
@@ -21,8 +22,8 @@ namespace OpenVulkano::Image
|
||||
{
|
||||
std::unique_ptr<Image> ImageLoaderJpeg::loadFromFile(const std::string& filePath)
|
||||
{
|
||||
Array<char> buffer = OpenVulkano::Utils::ReadFile(filePath);
|
||||
return loadJpeg(reinterpret_cast<uint8_t*>(buffer.Data()), buffer.Size());
|
||||
const auto file = Utils::ReadFile(filePath);
|
||||
return loadJpeg(reinterpret_cast<const uint8_t*>(file.Data()), file.Size());
|
||||
}
|
||||
|
||||
std::unique_ptr<Image> ImageLoaderJpeg::loadFromMemory(const std::vector<uint8_t>& buffer)
|
||||
@@ -36,19 +37,29 @@ namespace OpenVulkano::Image
|
||||
{
|
||||
Image result;
|
||||
|
||||
int rows, cols;
|
||||
int rows = 0, cols = 0;
|
||||
unsigned char* compressedImage = const_cast<uint8_t*>(data);
|
||||
|
||||
int jpegSubsamp;
|
||||
int jpegSubsamp = 0;
|
||||
tjhandle jpegDecompressor = tjInitDecompress();
|
||||
tjDecompressHeader2(jpegDecompressor, compressedImage, size, &cols, &rows, &jpegSubsamp);
|
||||
if (!jpegDecompressor)
|
||||
{
|
||||
Logger::FILESYS->error("Failed to read jpeg header. Error: {}", tjGetErrorStr());
|
||||
return nullptr;
|
||||
}
|
||||
int status = tjDecompressHeader2(jpegDecompressor, compressedImage, size, &cols, &rows, &jpegSubsamp);
|
||||
if (status != 0)
|
||||
{
|
||||
Logger::FILESYS->error("Failed to read jpeg header. Error: {}", tjGetErrorStr());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const int channels = 4;
|
||||
result.data = OpenVulkano::Array<uint8_t>(cols * rows * channels);
|
||||
result.dataFormat = OpenVulkano::DataFormat::R8G8B8A8_UINT;
|
||||
result.dataFormat = OpenVulkano::DataFormat::B8G8R8A8_UINT;
|
||||
|
||||
tjDecompress2(jpegDecompressor, compressedImage, size, result.data.Data(), cols, 0 /*pitch*/, rows,
|
||||
TJPF_RGBA, TJFLAG_FASTDCT);
|
||||
TJPF_BGRA, TJFLAG_FASTDCT);
|
||||
tjDestroy(jpegDecompressor);
|
||||
result.resolution.x = cols;
|
||||
result.resolution.y = rows;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math.hpp"
|
||||
#include <fmt/format.h>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
@@ -109,9 +110,14 @@ namespace OpenVulkano::Math
|
||||
data = (data & !(BITMASK << BITS)) | ((z & BITMASK) << BITS);
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string ToString(const std::string& separator = ", ") const
|
||||
[[nodiscard]] std::string ToString(const std::string& separator) const
|
||||
{
|
||||
return std::to_string(X()) + "," + std::to_string(Y()) + "," + std::to_string(Z());
|
||||
return std::to_string(X()) + separator + std::to_string(Y()) + separator + std::to_string(Z());
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string ToString() const
|
||||
{
|
||||
return fmt::format("{},{},{}", X(), Y(), Z());
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr operator T() const { return data; }
|
||||
|
||||
Reference in New Issue
Block a user