Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
c784e18
refactor(rhythmengine): adjusted delay
albertfrengki Apr 10, 2024
10bd83d
refactor some codes
albertfrengki Apr 12, 2024
97a87a6
Rebase
albertfrengki Apr 10, 2024
28ad7ae
fix: note has render glitching and inconsistent frame index
albertfrengki Apr 13, 2024
96f0a3e
albertfrengki Apr 13, 2024
3f75ebf
fix
albertfrengki Apr 13, 2024
0f10ed2
feat: move background option to settings
albertfrengki Apr 13, 2024
b10e6a1
fix(songselectscene): fix switch case modifier
albertfrengki Apr 13, 2024
684b273
feat: open file feature inside game
albertfrengki Apr 14, 2024
46c5b05
albertfrengki Apr 14, 2024
0b2c6e2
feat: open file now can load selected mod
albertfrengki Apr 15, 2024
cfa9984
refactor(songselectscene): added difficulty to saved selected mod aft…
albertfrengki Apr 15, 2024
9df2a24
albertfrengki Apr 15, 2024
5747db7
feat: added new settings and fix
albertfrengki Apr 19, 2024
044e9ee
refactor(gameplayscene): The true O2Jam Combo animation
albertfrengki Apr 20, 2024
664e095
fix: antivirus false detection
albertfrengki Apr 21, 2024
8848758
refactor: fix Lv. 0 on Title and stuff
albertfrengki May 14, 2024
349a76e
refactor: improve framelimit and scenemanager
albertfrengki May 16, 2024
139af50
fix(texture2d): fixed half white line
albertfrengki May 17, 2024
339a9c5
albertfrengki May 17, 2024
1b6c364
albertfrengki May 19, 2024
c034d80
Revert ""
albertfrengki May 19, 2024
5605858
refactor: better approach for white line issues, added game version i…
albertfrengki May 21, 2024
3b135fd
albertfrengki May 21, 2024
57941c6
albertfrengki May 21, 2024
2e6f25a
AlberttFrgk May 21, 2024
f86a4cf
refactor(ojm): add handler for unencoded audio data
AlberttFrgk May 21, 2024
f689acc
refactor: better solution for half white line issue (2)
AlberttFrgk May 22, 2024
5acf404
refactor: better solution for half white line issue
AlberttFrgk May 22, 2024
3c77949
AlberttFrgk May 22, 2024
bb787ac
refactor(ojm): fix no sound in few OJM
AlberttFrgk May 22, 2024
93fa479
added comment
AlberttFrgk May 22, 2024
cab75a7
AlberttFrgk May 22, 2024
7e566b7
refactor(ojm): game now can read the other mask ojm files
AlberttFrgk May 23, 2024
88c4cb1
refactor: fix everything
AlberttFrgk May 24, 2024
a5f61da
refactor: fix everything (2)
AlberttFrgk May 24, 2024
bf00f6b
AlberttFrgk May 24, 2024
23cddeb
refactor(sprite2d): fix for drawstop
AlberttFrgk May 24, 2024
50e2e70
refactor: hide directx11 due weird framedrop (instead use vulkan lmao)
AlberttFrgk May 24, 2024
45720a3
refactor(game): changed some code
AlberttFrgk May 25, 2024
87b20fa
refactor(setting): now game grab refresh rate and make values by mult…
AlberttFrgk May 26, 2024
3f6f057
AlberttFrgk May 27, 2024
8df764c
refactor(note): forget to add trail on tail Long Note, fix crash in r…
AlberttFrgk May 29, 2024
5a04bbb
refactor(scoremanager): make code easiest to read
AlberttFrgk May 30, 2024
19babe4
AlberttFrgk May 30, 2024
bcb6c63
refactor(chart): fix game not read event and audio sample properly on…
AlberttFrgk May 31, 2024
01bf097
AlberttFrgk May 31, 2024
298e2e2
refactor: fix missing font and panic mod causing overlapped
AlberttFrgk Jun 1, 2024
cf9183e
refactor: idk what i'm doing
AlberttFrgk Jun 2, 2024
b490187
test
AlberttFrgk Jun 2, 2024
35479d4
this ok
AlberttFrgk Jun 2, 2024
f1d0383
AlberttFrgk Jun 2, 2024
545b822
refactor(note): adjust code a little bit
AlberttFrgk Jun 2, 2024
b5c115a
refactor: optimize
AlberttFrgk Jun 5, 2024
add34b1
refactor: new Resources, new note type option, optimized code on Font…
AlberttFrgk Jun 6, 2024
c40bc1d
refactor(LuaScripting): fix config doesn't load Notes.ini and Notes.l…
AlberttFrgk Jun 7, 2024
6c24e1e
fix later
AlberttFrgk Jun 12, 2024
1d59ff3
apalah
AlberttFrgk Jun 16, 2024
785cfb5
refactor(gameplayscene): refactor combo animation
AlberttFrgk Jun 19, 2024
162316c
AlberttFrgk Jun 19, 2024
3d5b64e
refactor: ez2on look like hold note (note percy option)
AlberttFrgk Jun 21, 2024
87b5879
refactor(note):readjusted lnbody height and pos so it will in the mid…
AlberttFrgk Jun 21, 2024
151f319
remove percy option
AlberttFrgk Jun 21, 2024
e6b399d
refactor: add new measure line type, remove useless options
AlberttFrgk Jun 22, 2024
3c2bce7
refactor(note):add option Long Note Body On Top for few skins and ref…
AlberttFrgk Jun 22, 2024
2c62539
AlberttFrgk Jun 22, 2024
06891f2
AlberttFrgk Jun 22, 2024
ecf3474
AlberttFrgk Jun 22, 2024
11ff090
refactor(chart): fix stupid vector subscript out of range and adjustL…
AlberttFrgk Jun 27, 2024
aa5b13e
refector(noteimagecachemanaher): remove useless code
AlberttFrgk Jun 27, 2024
edcac05
AlberttFrgk Jul 4, 2024
dd3b7ae
refactor(note): code now easier to read
AlberttFrgk Jul 4, 2024
3f7121f
AlberttFrgk Jul 4, 2024
8c6030a
refactor(gameplayscene): O2JAM COMBO ANIMATION (FINAL)
AlberttFrgk Jul 7, 2024
8c2e057
AlberttFrgk Jul 8, 2024
944f85c
stupid github desktop
AlberttFrgk Jul 8, 2024
c61e1f7
Merge branch 'o2jamsimulator' of https://github.com/AlberttFrgk/O2Gam…
AlberttFrgk Jul 8, 2024
ad95640
refactor(gameplayscene): added code
AlberttFrgk Jul 9, 2024
2105090
refactor(gameplayscene): o2jam combo animation should be like this
AlberttFrgk Jul 9, 2024
292f2eb
AlberttFrgk Jul 14, 2024
dde950e
remove problematic feature
AlberttFrgk Aug 27, 2024
d95baac
improve game experience
AlberttFrgk Aug 27, 2024
8a20b88
remove option other than 7K
AlberttFrgk Aug 27, 2024
0e2f06f
AlberttFrgk Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "GameResources"]
path = GameResources
url = https://github.com/Estrol/O2GameResources
url = https://github.com/AlberttFrgk/O2GameResources
2 changes: 1 addition & 1 deletion Engine/include/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ class Game
GameThread mLocalThread;

std::mutex m_mutex;
std::condition_variable m_conditionVariable;
std::condition_variable m_cv;
};
2 changes: 1 addition & 1 deletion Engine/include/Rendering/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GameWindow
float GetHeightScale();

void SetScaleOutput(bool value);
bool IsScaleOutput();
bool IsScaleOutput() const;

void SetWindowTitle(std::string &title);
void SetWindowSubTitle(std::string &subTitle);
Expand Down
15 changes: 9 additions & 6 deletions Engine/include/Texture/Sprite2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Sprite2D
public:
Sprite2D() = default;

Sprite2D(std::vector<Texture2D *> textures, float delay = 1.0f);
Sprite2D(std::vector<std::string> textures, float delay = 1.0f);
Sprite2D(std::vector<std::filesystem::path> textures, float delay = 1.0f);
Sprite2D(std::vector<SDL_Texture *> textures, float delay = 1.0f);
Sprite2D(std::vector<Texture2D *> textures, double delay = 1.0);
Sprite2D(std::vector<std::string> textures, double delay = 1.0);
Sprite2D(std::vector<std::filesystem::path> textures, double delay = 1.0);
Sprite2D(std::vector<SDL_Texture *> textures, double delay = 1.0);

~Sprite2D();

Expand All @@ -37,15 +37,18 @@ class Sprite2D
void DrawOnce(double delta, bool manual = false);

Texture2D *GetTexture();
void SetFPS(float fps);
void SetFPS(double fps);
void Reset();

private:
double m_spritespeed = 1.0;

private:
float m_currentTime = 0;
int m_currentIndex = 0;

bool m_drawOnce = false;

std::vector<Texture2D *> m_textures;

void DrawInternal(double delta, bool playOnce, Rect* rect, bool manual);
};
8 changes: 4 additions & 4 deletions Engine/include/Texture/Texture2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Texture2D

public:
Texture2D();
Texture2D(std::string fileName);
Texture2D(std::filesystem::path path);
Texture2D(uint8_t *fileData, size_t size);
Texture2D(const std::string& fileName);
Texture2D(const std::filesystem::path& path);
Texture2D(const uint8_t *fileData, size_t size);
Texture2D(SDL_Texture *texture);
Texture2D(Texture2D_Vulkan *texture);
~Texture2D();
Expand Down Expand Up @@ -51,7 +51,7 @@ class Texture2D
Rect GetOriginalRECT();
void SetOriginalRECT(Rect size);

static Texture2D *FromTexture2D(Texture2D *tex);
// static Texture2D *FromTexture2D(Texture2D *tex);

static Texture2D *FromBMP(uint8_t *fileData, size_t size);
static Texture2D *FromBMP(std::string fileName);
Expand Down
2 changes: 1 addition & 1 deletion Engine/src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void Configuration::Set(std::string key, std::string prop, std::string value)

void Configuration::Font_SetPath(std::filesystem::path path)
{
FontPath = path;
FontPath = std::filesystem::current_path() / "Resources";
}

std::filesystem::path Configuration::Font_GetPath()
Expand Down
41 changes: 32 additions & 9 deletions Engine/src/Fonts/FontResources.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma warning(disable : 4838) // Goddamit
#pragma warning(disable : 4838) // Goddamit
#pragma warning(disable : 4309)

#include <Misc/md5.h>
Expand All @@ -25,9 +25,9 @@
// BEGIN FONT FALLBACK

#include "FallbackFonts/arial.ttf.h"
#include "FallbackFonts/ch.ttf.h"
#include "FallbackFonts/jp.ttf.h"
#include "FallbackFonts/kr.ttf.h"
//#include "FallbackFonts/ch.ttf.h"
//#include "FallbackFonts/jp.ttf.h"
//#include "FallbackFonts/kr.ttf.h"
#include <Logs.h>

// END FONT FALLBACK
Expand Down Expand Up @@ -92,14 +92,37 @@ void FontResources::PreloadFontCaches()

GameWindow *wnd = GameWindow::GetInstance();

auto skinPath = Configuration::Font_GetPath();
auto fontPath = skinPath / "Fonts";
auto path = Configuration::Font_GetPath();
auto fontPath = path / "Fonts";

auto normalfont = fontPath / "normal.ttf";
auto jpFont = fontPath / "jp.ttf";
auto krFont = fontPath / "kr.ttf";
auto chFont = fontPath / "ch.ttf";

static const ImWchar glyphRanges[] = { // Optimized
(ImWchar)0x0020, (ImWchar)0x052F,
(ImWchar)0x2000, (ImWchar)0x27BF,
(ImWchar)0x2E80, (ImWchar)0x2FA1,
(ImWchar)0x1F300, (ImWchar)0x1FAFF,
(ImWchar)0x2660, (ImWchar)0x2663,
(ImWchar)0x2665, (ImWchar)0x2666,
(ImWchar)0x2600, (ImWchar)0x2606,
(ImWchar)0x2618, (ImWchar)0x2619,
(ImWchar)0x263A, (ImWchar)0x263B,
(ImWchar)0x2708, (ImWchar)0x2714,
(ImWchar)0x2728, (ImWchar)0x2734,
(ImWchar)0x2740, (ImWchar)0x274B,
(ImWchar)0x2756, (ImWchar)0x2758,
(ImWchar)0x2764, (ImWchar)0x2767,
(ImWchar)0x2794, (ImWchar)0x27BE,
(ImWchar)0x27F0, (ImWchar)0x27FF,
(ImWchar)0x2900, (ImWchar)0x297F,
(ImWchar)0x2A00, (ImWchar)0x2AFF,
(ImWchar)0x0000, (ImWchar)0x0000
};


{
float originScale = (wnd->GetBufferWidth() + wnd->GetBufferHeight()) / 15.6f;
float targetScale = (wnd->GetWidth() + wnd->GetHeight()) / 15.6f;
Expand All @@ -118,9 +141,9 @@ void FontResources::PreloadFontCaches()

{
if (std::filesystem::exists(normalfont)) {
Font.Font = io.Fonts->AddFontFromFileTTF((const char *)normalfont.u8string().c_str(), fontSize, &conf);
Font.Font = io.Fonts->AddFontFromFileTTF((const char *)normalfont.u8string().c_str(), fontSize, &conf, glyphRanges); // glyphRanges, fixing missing fonts
} else {
Font.Font = io.Fonts->AddFontFromMemoryTTF((void *)get_arial_font_data(), get_arial_font_size(), fontSize, &conf);
Font.Font = io.Fonts->AddFontFromMemoryTTF((void *)get_arial_font_data(), get_arial_font_size(), fontSize, &conf, glyphRanges);
}
}

Expand Down Expand Up @@ -151,7 +174,7 @@ void FontResources::PreloadFontCaches()
case TextRegion::Chinese:
{
if (std::filesystem::exists(chFont)) {
io.Fonts->AddFontFromFileTTF((const char *)chFont.u8string().c_str(), fontSize, &conf, io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
io.Fonts->AddFontFromFileTTF((const char *)chFont.u8string().c_str(), fontSize, &conf, io.Fonts->GetGlyphRangesChineseFull());
}

break;
Expand Down
16 changes: 8 additions & 8 deletions Engine/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

constexpr auto kInputDefaultRate = 1000.0;
constexpr auto kMenuDefaultRate = 60.0;
constexpr auto kAudioDefaultRate = 24.0;
constexpr auto kAudioDefaultRate = 60.0;

namespace {

Expand All @@ -42,13 +42,14 @@ namespace {
{
const double targetFrameTime = 1000.0 / MaxFrameRate;

double newTick = SDL_GetTicks();
double newTick = static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count());
double frameTime = newTick - curTick;

if (frameTime < targetFrameTime)
{
double delayTime = targetFrameTime - frameTime;
SDL_Delay(static_cast<Uint32>(delayTime));
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<long long>(delayTime)));
std::this_thread::yield();
newTick += delayTime;
}

Expand Down Expand Up @@ -83,7 +84,7 @@ Game::~Game()

if (m_notify) {
std::unique_lock<std::mutex> lock(m_mutex);
m_conditionVariable.wait(lock, [this] { return !m_notify; });
m_cv.wait(lock, [this] { return !m_notify; });
}
}

Expand Down Expand Up @@ -369,13 +370,12 @@ void Game::CheckFont()
void Game::Stop()
{
if (m_running) {
m_running = false;

{
std::lock_guard<std::mutex> lock(m_mutex); // TODO: Fix game does not properly exit while crash (if not just revert back to SDL_Delay Sleep)
std::unique_lock<std::mutex> lock(m_mutex);
m_running = false;
m_notify = true;
}
m_conditionVariable.notify_one();
m_cv.notify_one();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Engine/src/Rendering/GameWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void GameWindow::SetScaleOutput(bool value)
m_scaleOutput = value;
}

bool GameWindow::IsScaleOutput()
bool GameWindow::IsScaleOutput() const
{
return m_scaleOutput;
}
Expand Down
8 changes: 4 additions & 4 deletions Engine/src/Rendering/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ bool Renderer::Create(RendererMode mode, GameWindow *window, bool failed)
break;
}

case RendererMode::DIRECTX11:
/*case RendererMode::DIRECTX11:
{
rendererName = "direct3d11";
break;
}
}*/

case RendererMode::DIRECTX12:
{
Expand Down Expand Up @@ -96,10 +96,10 @@ bool Renderer::Create(RendererMode mode, GameWindow *window, bool failed)
}

SDL_SetHint(SDL_HINT_RENDER_DRIVER, rendererName.c_str());
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); // STOP CHANGING THIS, LEAVE IT "as is"
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");
}

m_renderer = SDL_CreateRenderer(window->GetWindow(), -1, SDL_RENDERER_ACCELERATED);
m_renderer = SDL_CreateRenderer(window->GetWindow(), -1, SDL_RENDERER_ACCELERATED /*| SDL_RENDERER_PRESENTVSYNC*/);
if (!m_renderer) {
throw SDLException();
}
Expand Down
46 changes: 27 additions & 19 deletions Engine/src/Rendering/Vulkan/Texture2DVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static int m_textureCount
static std::mutex m_textureMutex;
static std::unique_ptr<Texture2D_Vulkan> m_dummyTexture;

Texture2D_Vulkan *CreateTexture()
Texture2D_Vulkan* CreateTexture()
{
// find the empty slot
for (int i = 0; i < m_textureCount; i++) {
Expand Down Expand Up @@ -53,7 +53,7 @@ uint32_t vkTexture::FindMemoryType(uint32_t type_filter, uint32_t properties)
return findMemoryType(VulkanEngine::GetInstance()->_chosenGPU, type_filter, properties);
}

Texture2D_Vulkan *vkTexture::TexLoadImage(std::filesystem::path imagePath)
Texture2D_Vulkan* vkTexture::TexLoadImage(std::filesystem::path imagePath)
{
std::fstream fs(imagePath, std::ios::binary | std::ios::in);
if (!fs.is_open()) {
Expand All @@ -79,6 +79,14 @@ void InternalLoad(

size_t image_size = static_cast<size_t>(tex_data->Width) * static_cast<size_t>(tex_data->Height) * tex_data->Channels;

// Premultiply alpha
for (size_t i = 0; i < image_size; i += tex_data->Channels) { // Fix white line issue
float alpha = image_data[i + 3] / 255.0f;
image_data[i] = static_cast<unsigned char>(image_data[i] * alpha);
image_data[i + 1] = static_cast<unsigned char>(image_data[i + 1] * alpha);
image_data[i + 2] = static_cast<unsigned char>(image_data[i + 2] * alpha);
}

VkResult err;
{
VkImageCreateInfo info = {};
Expand Down Expand Up @@ -135,8 +143,8 @@ void InternalLoad(
{
VkSamplerCreateInfo samplerInfo = {};
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
samplerInfo.magFilter = VK_FILTER_NEAREST;
samplerInfo.minFilter = VK_FILTER_NEAREST;
samplerInfo.magFilter = VK_FILTER_LINEAR;
samplerInfo.minFilter = VK_FILTER_LINEAR;
samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
Expand Down Expand Up @@ -184,7 +192,7 @@ void InternalLoad(
}

{
void *map = NULL;
void* map = NULL;
err = vkMapMemory(vulkan_driver->_device, tex_data->UploadBufferMemory, 0, image_size, 0, &map);
if (err != VK_SUCCESS) {
throw std::runtime_error("Vulkan: Failed to create mapped image memory");
Expand Down Expand Up @@ -240,17 +248,17 @@ void InternalLoad(
use_barrier[0].subresourceRange.levelCount = 1;
use_barrier[0].subresourceRange.layerCount = 1;
vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, use_barrier);
});
});
}

Texture2D_Vulkan *vkTexture::TexLoadImage(void *buffer, size_t size)
Texture2D_Vulkan* vkTexture::TexLoadImage(void* buffer, size_t size)
{
auto vulkan_driver = VulkanEngine::GetInstance();
auto tex_data = CreateTexture();
tex_data->Channels = 4;

unsigned char *image_data = stbi_load_from_memory(
(uint8_t *)buffer,
unsigned char* image_data = stbi_load_from_memory(
(uint8_t*)buffer,
(int)size,
&tex_data->Width,
&tex_data->Height,
Expand All @@ -265,7 +273,7 @@ Texture2D_Vulkan *vkTexture::TexLoadImage(void *buffer, size_t size)
return tex_data;
}

Texture2D_Vulkan *vkTexture::GetDummyImage()
Texture2D_Vulkan* vkTexture::GetDummyImage()
{
if (m_dummyTexture) {
return m_dummyTexture.get();
Expand All @@ -278,8 +286,8 @@ Texture2D_Vulkan *vkTexture::GetDummyImage()
// Generate file 1 Pixel Bitmap Image, with header
std::vector<uint8_t> buffer = ImageGenerator::GenerateImage(40, 40, { 255, 255, 255, 255 });

unsigned char *image_data = stbi_load_from_memory(
(uint8_t *)buffer.data(),
unsigned char* image_data = stbi_load_from_memory(
(uint8_t*)buffer.data(),
(int)buffer.size(),
&m_dummyTexture->Width,
&m_dummyTexture->Height,
Expand All @@ -297,18 +305,18 @@ Texture2D_Vulkan *vkTexture::GetDummyImage()
return m_dummyTexture.get();
}

VkDescriptorSet vkTexture::GetVkDescriptorSet(Texture2D_Vulkan *handle)
VkDescriptorSet vkTexture::GetVkDescriptorSet(Texture2D_Vulkan* handle)
{
return handle->DS;
}

void vkTexture::QueryTexture(Texture2D_Vulkan *handle, int &outWidth, int &outHeight)
void vkTexture::QueryTexture(Texture2D_Vulkan* handle, int& outWidth, int& outHeight)
{
outWidth = handle->Width;
outHeight = handle->Height;
}

void vkTexture::ReleaseTexture(Texture2D_Vulkan *tex_data)
void vkTexture::ReleaseTexture(Texture2D_Vulkan* tex_data)
{
if (tex_data == nullptr) {
return;
Expand All @@ -326,14 +334,14 @@ void vkTexture::ReleaseTexture(Texture2D_Vulkan *tex_data)

ImGui_ImplVulkan_RemoveTexture(tex_data->DS);

auto it = std::find_if(m_textures.begin(), m_textures.end(), [&](auto &pair) {
auto it = std::find_if(m_textures.begin(), m_textures.end(), [&](auto& pair) {
return pair.second != nullptr && pair.second->Id == tex_data->Id;
});
});

if (it != m_textures.end()) {
it->second.reset();
}
});
});
}

// This must be called from VulkanEngine!
Expand All @@ -344,7 +352,7 @@ void vkTexture::Cleanup()

std::cout << "[Info] Cleaning up Vulkan textures: " << m_textures.size() << std::endl;

for (auto &[id, tex_data] : m_textures) {
for (auto& [id, tex_data] : m_textures) {
if (tex_data == nullptr) {
continue;
}
Expand Down
Loading