updated shaders and some other stuff
This commit is contained in:
parent
6fb78ed4c8
commit
11bad26b38
12
imgui.ini
12
imgui.ini
@ -43,7 +43,7 @@ DockId=0x0000000F,0
|
|||||||
|
|
||||||
[Window][Console]
|
[Window][Console]
|
||||||
Pos=344,680
|
Pos=344,680
|
||||||
Size=1500,326
|
Size=1497,326
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000013,0
|
DockId=0x00000013,0
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ DockId=0x00000017,1
|
|||||||
|
|
||||||
[Window][Profiler]
|
[Window][Profiler]
|
||||||
Pos=344,1008
|
Pos=344,1008
|
||||||
Size=1500,169
|
Size=1497,169
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000014,0
|
DockId=0x00000014,0
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ Collapsed=0
|
|||||||
DockId=0x0000000E,0
|
DockId=0x0000000E,0
|
||||||
|
|
||||||
[Window][Audio Output]
|
[Window][Audio Output]
|
||||||
Pos=1846,680
|
Pos=1843,680
|
||||||
Size=74,497
|
Size=77,497
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000012,0
|
DockId=0x00000012,0
|
||||||
|
|
||||||
@ -136,10 +136,10 @@ DockSpace ID=0x11111111 Window=0x1BBC0F80 Pos=0,19 Size=1920,1158 Sp
|
|||||||
DockNode ID=0x00000018 Parent=0x00000007 SizeRef=367,860 HiddenTabBar=1 Selected=0x36DC96AB
|
DockNode ID=0x00000018 Parent=0x00000007 SizeRef=367,860 HiddenTabBar=1 Selected=0x36DC96AB
|
||||||
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=606,497 Split=X Selected=0xEA83D666
|
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=606,497 Split=X Selected=0xEA83D666
|
||||||
DockNode ID=0x00000015 Parent=0x00000008 SizeRef=1291,172 Split=X Selected=0xEA83D666
|
DockNode ID=0x00000015 Parent=0x00000008 SizeRef=1291,172 Split=X Selected=0xEA83D666
|
||||||
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=1500,168 Split=Y Selected=0x9B5D3198
|
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=1497,168 Split=Y Selected=0x9B5D3198
|
||||||
DockNode ID=0x00000013 Parent=0x00000011 SizeRef=1449,326 HiddenTabBar=1 Selected=0xEA83D666
|
DockNode ID=0x00000013 Parent=0x00000011 SizeRef=1449,326 HiddenTabBar=1 Selected=0xEA83D666
|
||||||
DockNode ID=0x00000014 Parent=0x00000011 SizeRef=1449,169 HiddenTabBar=1 Selected=0x9B5D3198
|
DockNode ID=0x00000014 Parent=0x00000011 SizeRef=1449,169 HiddenTabBar=1 Selected=0x9B5D3198
|
||||||
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=74,168 HiddenTabBar=1 Selected=0x56009A08
|
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=77,168 HiddenTabBar=1 Selected=0x56009A08
|
||||||
DockNode ID=0x00000016 Parent=0x00000008 SizeRef=283,172 Split=X Selected=0x56009A08
|
DockNode ID=0x00000016 Parent=0x00000008 SizeRef=283,172 Split=X Selected=0x56009A08
|
||||||
DockNode ID=0x0000000F Parent=0x00000016 SizeRef=140,296 HiddenTabBar=1 Selected=0x3FC1A724
|
DockNode ID=0x0000000F Parent=0x00000016 SizeRef=140,296 HiddenTabBar=1 Selected=0x3FC1A724
|
||||||
DockNode ID=0x00000010 Parent=0x00000016 SizeRef=148,296 HiddenTabBar=1 Selected=0xA873C17F
|
DockNode ID=0x00000010 Parent=0x00000016 SizeRef=148,296 HiddenTabBar=1 Selected=0xA873C17F
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
[COMPILE] g++ -std=c++20 -Wall -g -Isrc/include -Isrc/include/lua -Isrc/vendor -Isrc/vendor/imgui -Isrc/vendor/box2d -Isrc/vendor/xxhash -Isrc/vendor/miniaudio -IC:/msys64/mingw64/include -IC:\msys64\mingw64\lib\libyaml-cpp.a -Isrc\vendor\imgui -MMD -MP -c src\src\Engine.cpp -o src\build\Engine.o
|
[COMPILE] g++ -std=c++20 -Wall -g -Isrc/include -Isrc/include/lua -Isrc/vendor -Isrc/vendor/imgui -Isrc/vendor/box2d -Isrc/vendor/xxhash -Isrc/vendor/miniaudio -IC:/msys64/mingw64/include -Isrc\vendor\imgui -IC:\msys64\mingw64\lib\libyaml-cpp.a -MMD -MP -c src\src\utils\Shader.cpp -o src\build\utils\Shader.o
|
||||||
|
[COMPILE] g++ -std=c++20 -Wall -g -Isrc/include -Isrc/include/lua -Isrc/vendor -Isrc/vendor/imgui -Isrc/vendor/box2d -Isrc/vendor/xxhash -Isrc/vendor/miniaudio -IC:/msys64/mingw64/include -Isrc\vendor\imgui -IC:\msys64\mingw64\lib\libyaml-cpp.a -MMD -MP -c src\src\core\utils\utils.cpp -o src\build\core\utils\utils.o
|
||||||
|
[COMPILE] g++ -std=c++20 -Wall -g -Isrc/include -Isrc/include/lua -Isrc/vendor -Isrc/vendor/imgui -Isrc/vendor/box2d -Isrc/vendor/xxhash -Isrc/vendor/miniaudio -IC:/msys64/mingw64/include -Isrc\vendor\imgui -IC:\msys64\mingw64\lib\libyaml-cpp.a -MMD -MP -c src\src\Engine.cpp -o src\build\Engine.o
|
||||||
[LINK] g++ src\build\Engine.o src\build\main.o src\build\Renderer.o src\build\Components\AnimationComponent.o src\build\Components\AudioPlayerComponent.o src\build\Components\CameraComponent.o src\build\Components\LightComponent.o src\build\Components\ParticleComponent.o src\build\Components\PhysicsComponent.o src\build\Components\ScriptComponent.o src\build\Components\SpriteComponent.o src\build\Components\TextComonent.o src\build\Components\TilemapComponent.o src\build\core\audio\AudioEngine.o src\build\core\utils\AssetManager.o src\build\core\utils\EngineConfig.o src\build\core\utils\ExceptionHandler.o src\build\core\utils\FileDialog.o src\build\core\utils\input.o src\build\core\utils\LoadingWindow.o src\build\core\utils\Logging.o src\build\core\utils\Profiler.o src\build\core\utils\Texture.o src\build\core\utils\utils.o src\build\editor\windows\AssetBrowser.o src\build\editor\windows\AudioInfo.o src\build\editor\windows\Inspector.o src\build\Entitys\Object.o src\build\utils\GameObjectsList.o src\build\utils\Shader.o src\build\utils\UID.o src\build\lapi.o src\build\lauxlib.o src\build\lbaselib.o src\build\lcode.o src\build\lcorolib.o src\build\lctype.o src\build\ldblib.o src\build\ldebug.o src\build\ldo.o src\build\ldump.o src\build\lfunc.o src\build\lgc.o src\build\linit.o src\build\liolib.o src\build\llex.o src\build\lmathlib.o src\build\lmem.o src\build\loadlib.o src\build\lobject.o src\build\lopcodes.o src\build\loslib.o src\build\lparser.o src\build\lstate.o src\build\lstring.o src\build\lstrlib.o src\build\ltable.o src\build\ltablib.o src\build\ltm.o src\build\lua.o src\build\luac.o src\build\lundump.o src\build\lutf8lib.o src\build\lvm.o src\build\lzio.o src\build\imgui.o src\build\imgui_demo.o src\build\imgui_draw.o src\build\imgui_impl_glfw.o src\build\imgui_impl_opengl3.o src\build\imgui_tables.o src\build\imgui_widgets.o src\build\aabb.o src\build\arena_allocator.o src\build\array.o src\build\bitset.o src\build\body.o src\build\broad_phase.o src\build\constraint_graph.o src\build\contact.o src\build\contact_solver.o src\build\core.o src\build\distance.o src\build\distance_joint.o src\build\dynamic_tree.o src\build\geometry.o src\build\hull.o src\build\id_pool.o src\build\island.o src\build\joint.o src\build\manifold.o src\build\math_functions.o src\build\motor_joint.o src\build\mouse_joint.o src\build\mover.o src\build\prismatic_joint.o src\build\revolute_joint.o src\build\sensor.o src\build\shape.o src\build\solver.o src\build\solver_set.o src\build\table.o src\build\timer.o src\build\types.o src\build\weld_joint.o src\build\wheel_joint.o src\build\world.o src\build\xxhash.o src\build\miniaudio.o -o src\build\app.exe -LC:\msys64\mingw64\lib -lglfw3 -lglew32 -lopengl32 -lgdi32 -lyaml-cpp -lcomdlg32 -lssl -lcrypto -ldbghelp
|
[LINK] g++ src\build\Engine.o src\build\main.o src\build\Renderer.o src\build\Components\AnimationComponent.o src\build\Components\AudioPlayerComponent.o src\build\Components\CameraComponent.o src\build\Components\LightComponent.o src\build\Components\ParticleComponent.o src\build\Components\PhysicsComponent.o src\build\Components\ScriptComponent.o src\build\Components\SpriteComponent.o src\build\Components\TextComonent.o src\build\Components\TilemapComponent.o src\build\core\audio\AudioEngine.o src\build\core\utils\AssetManager.o src\build\core\utils\EngineConfig.o src\build\core\utils\ExceptionHandler.o src\build\core\utils\FileDialog.o src\build\core\utils\input.o src\build\core\utils\LoadingWindow.o src\build\core\utils\Logging.o src\build\core\utils\Profiler.o src\build\core\utils\Texture.o src\build\core\utils\utils.o src\build\editor\windows\AssetBrowser.o src\build\editor\windows\AudioInfo.o src\build\editor\windows\Inspector.o src\build\Entitys\Object.o src\build\utils\GameObjectsList.o src\build\utils\Shader.o src\build\utils\UID.o src\build\lapi.o src\build\lauxlib.o src\build\lbaselib.o src\build\lcode.o src\build\lcorolib.o src\build\lctype.o src\build\ldblib.o src\build\ldebug.o src\build\ldo.o src\build\ldump.o src\build\lfunc.o src\build\lgc.o src\build\linit.o src\build\liolib.o src\build\llex.o src\build\lmathlib.o src\build\lmem.o src\build\loadlib.o src\build\lobject.o src\build\lopcodes.o src\build\loslib.o src\build\lparser.o src\build\lstate.o src\build\lstring.o src\build\lstrlib.o src\build\ltable.o src\build\ltablib.o src\build\ltm.o src\build\lua.o src\build\luac.o src\build\lundump.o src\build\lutf8lib.o src\build\lvm.o src\build\lzio.o src\build\imgui.o src\build\imgui_demo.o src\build\imgui_draw.o src\build\imgui_impl_glfw.o src\build\imgui_impl_opengl3.o src\build\imgui_tables.o src\build\imgui_widgets.o src\build\aabb.o src\build\arena_allocator.o src\build\array.o src\build\bitset.o src\build\body.o src\build\broad_phase.o src\build\constraint_graph.o src\build\contact.o src\build\contact_solver.o src\build\core.o src\build\distance.o src\build\distance_joint.o src\build\dynamic_tree.o src\build\geometry.o src\build\hull.o src\build\id_pool.o src\build\island.o src\build\joint.o src\build\manifold.o src\build\math_functions.o src\build\motor_joint.o src\build\mouse_joint.o src\build\mover.o src\build\prismatic_joint.o src\build\revolute_joint.o src\build\sensor.o src\build\shape.o src\build\solver.o src\build\solver_set.o src\build\table.o src\build\timer.o src\build\types.o src\build\weld_joint.o src\build\wheel_joint.o src\build\world.o src\build\xxhash.o src\build\miniaudio.o -o src\build\app.exe -LC:\msys64\mingw64\lib -lglfw3 -lglew32 -lopengl32 -lgdi32 -lyaml-cpp -lcomdlg32 -lssl -lcrypto -ldbghelp
|
||||||
[RUN] Executed app.exe successfully.
|
[RUN] Executed app.exe successfully.
|
||||||
|
@ -8,6 +8,7 @@ AudioPlayerComponent::AudioPlayerComponent(Object* owner)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void AudioPlayerComponent::SetAudio(uint64_t uaid) {
|
void AudioPlayerComponent::SetAudio(uint64_t uaid) {
|
||||||
|
Stop();
|
||||||
m_UAID = uaid;
|
m_UAID = uaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ void AudioPlayerComponent::Stop() {
|
|||||||
void AudioPlayerComponent::Update()
|
void AudioPlayerComponent::Update()
|
||||||
{
|
{
|
||||||
Logger::LogDepricatedWithStackTrace("AudioPlayerComponent::Update()");
|
Logger::LogDepricatedWithStackTrace("AudioPlayerComponent::Update()");
|
||||||
// This is never called. Its useless
|
// This is never called. Its useless, Depricated, Use AudioEngine
|
||||||
|
|
||||||
AudioEngine::Update();
|
AudioEngine::Update();
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "LightComponent.h"
|
#include "LightComponent.h"
|
||||||
|
|
||||||
|
//TODO: Lua API
|
||||||
|
|
||||||
|
|
||||||
LightComponent::LightComponent(Object* owner)
|
LightComponent::LightComponent(Object* owner)
|
||||||
: Component(owner) {}
|
: Component(owner) {}
|
||||||
|
|
||||||
|
@ -537,6 +537,8 @@ void Engine::Init()
|
|||||||
m_animationsUpdates.reserve(512); // ~500 animated objects (characters, FX, etc.)
|
m_animationsUpdates.reserve(512); // ~500 animated objects (characters, FX, etc.)
|
||||||
|
|
||||||
Logger::LogOk("Engine Core");
|
Logger::LogOk("Engine Core");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core::types::Vec2 ScreenToWorld(const core::types::Vec2 &screenPos, const core::types::Vec2 &viewportSize, const core::types::Vec2 &cameraPos, float zoom)
|
core::types::Vec2 ScreenToWorld(const core::types::Vec2 &screenPos, const core::types::Vec2 &viewportSize, const core::types::Vec2 &cameraPos, float zoom)
|
||||||
|
@ -110,6 +110,8 @@ std::vector<SortedDrawEntry> sortedDrawList;
|
|||||||
|
|
||||||
void Renderer::InitQuad()
|
void Renderer::InitQuad()
|
||||||
{
|
{
|
||||||
|
Logger::LogVerbose("[Renderer] Init Quads");
|
||||||
|
|
||||||
float vertices[] = {
|
float vertices[] = {
|
||||||
// pos // uv
|
// pos // uv
|
||||||
-1.f, -1.f, 0.f, 0.f,
|
-1.f, -1.f, 0.f, 0.f,
|
||||||
@ -134,6 +136,9 @@ void Renderer::InitQuad()
|
|||||||
|
|
||||||
void Renderer::InitQuadBatch()
|
void Renderer::InitQuadBatch()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Logger::LogVerbose("[Renderer] Create Quads");
|
||||||
|
|
||||||
float quadVerts[] = {
|
float quadVerts[] = {
|
||||||
-0.5f, -0.5f,
|
-0.5f, -0.5f,
|
||||||
0.5f, -0.5f,
|
0.5f, -0.5f,
|
||||||
@ -191,6 +196,8 @@ void Renderer::InitQuadBatch()
|
|||||||
void Renderer::Init()
|
void Renderer::Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Logger::LogVerbose("[Renderer] Create Primary");
|
||||||
|
|
||||||
glGenFramebuffers(1, &fbo);
|
glGenFramebuffers(1, &fbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
|
|
||||||
@ -235,6 +242,8 @@ void Renderer::Init()
|
|||||||
|
|
||||||
InitQuadBatch();
|
InitQuadBatch();
|
||||||
|
|
||||||
|
Logger::LogVerbose("[Renderer] Color Correction Init");
|
||||||
|
|
||||||
SetColorCorrection(std::make_unique<ColorCorrection>());
|
SetColorCorrection(std::make_unique<ColorCorrection>());
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -244,7 +253,8 @@ void Renderer::Init()
|
|||||||
|
|
||||||
glGenBuffers(1, &s_ClusterSSBO);
|
glGenBuffers(1, &s_ClusterSSBO);
|
||||||
|
|
||||||
// Bloom textures and framebuffers
|
Logger::LogVerbose("[Renderer] Bloom Init");
|
||||||
|
|
||||||
glGenFramebuffers(1, &extractFBO);
|
glGenFramebuffers(1, &extractFBO);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, extractFBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, extractFBO);
|
||||||
glGenTextures(1, &extractTexture);
|
glGenTextures(1, &extractTexture);
|
||||||
@ -284,7 +294,8 @@ void Renderer::Init()
|
|||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
// Create a 1x1 flat normal map (RGB: 128,128,255)
|
Logger::LogVerbose("[Renderer] Creating Default Normal");
|
||||||
|
|
||||||
unsigned char flatNormal[3] = {128, 128, 255};
|
unsigned char flatNormal[3] = {128, 128, 255};
|
||||||
glGenTextures(1, &defaultNormalMap);
|
glGenTextures(1, &defaultNormalMap);
|
||||||
glBindTexture(GL_TEXTURE_2D, defaultNormalMap);
|
glBindTexture(GL_TEXTURE_2D, defaultNormalMap);
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#include "AudioEngine.h"
|
#include "AudioEngine.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Lua API
|
||||||
|
|
||||||
|
|
||||||
// Static member definitions
|
// Static member definitions
|
||||||
ma_engine AudioEngine::s_Engine;
|
ma_engine AudioEngine::s_Engine;
|
||||||
std::unordered_map<uint64_t, ma_sound*> AudioEngine::s_SoundMap;
|
std::unordered_map<uint64_t, ma_sound*> AudioEngine::s_SoundMap;
|
||||||
@ -39,17 +43,14 @@ void AudioEngine::Shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioEngine::Play(uint64_t uaid, bool loop) {
|
void AudioEngine::Play(uint64_t uaid, bool loop) {
|
||||||
// 1) Tear down existing instance (if any)
|
|
||||||
Cleanup(uaid);
|
Cleanup(uaid);
|
||||||
|
|
||||||
// 2) Fetch and validate asset
|
|
||||||
const AssetInfo* asset = AssetManager::GetAssetByID(uaid);
|
const AssetInfo* asset = AssetManager::GetAssetByID(uaid);
|
||||||
if (!asset || !asset->loaded || asset->type != AssetType::Audio) {
|
if (!asset || !asset->loaded || asset->type != AssetType::Audio) {
|
||||||
Logger::LogError("AudioEngine::Play invalid asset %llu", uaid);
|
Logger::LogError("AudioEngine::Play invalid asset %llu", uaid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) Heap-allocate and init the sound from file
|
|
||||||
ma_sound* sound = new ma_sound;
|
ma_sound* sound = new ma_sound;
|
||||||
if (ma_sound_init_from_file(
|
if (ma_sound_init_from_file(
|
||||||
&s_Engine,
|
&s_Engine,
|
||||||
@ -65,17 +66,14 @@ void AudioEngine::Play(uint64_t uaid, bool loop) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4) Store and start playback
|
|
||||||
s_SoundMap[uaid] = sound;
|
s_SoundMap[uaid] = sound;
|
||||||
ma_sound_set_looping(sound, loop ? MA_TRUE : MA_FALSE);
|
ma_sound_set_looping(sound, loop ? MA_TRUE : MA_FALSE);
|
||||||
ma_sound_start(sound);
|
ma_sound_start(sound);
|
||||||
|
|
||||||
// 5) Compute totalTime
|
|
||||||
ma_uint64 frames = 0;
|
ma_uint64 frames = 0;
|
||||||
ma_sound_get_length_in_pcm_frames(sound, &frames);
|
ma_sound_get_length_in_pcm_frames(sound, &frames);
|
||||||
double sampleRate = ma_engine_get_sample_rate(&s_Engine);
|
double sampleRate = ma_engine_get_sample_rate(&s_Engine);
|
||||||
|
|
||||||
// 6) Push PlayingInfo
|
|
||||||
PlayingInfo info;
|
PlayingInfo info;
|
||||||
info.uaid = uaid;
|
info.uaid = uaid;
|
||||||
info.name = asset->filename;
|
info.name = asset->filename;
|
||||||
@ -115,6 +113,10 @@ void AudioEngine::CleanupSound(uint64_t uaid)
|
|||||||
delete itSound->second;
|
delete itSound->second;
|
||||||
s_SoundMap.erase(itSound);
|
s_SoundMap.erase(itSound);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::LogError("[AudioEngine] Invalid Asset ID");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,12 +157,20 @@ void AudioEngine::SetVolume(uint64_t uaid, float v) {
|
|||||||
if (auto it = s_SoundMap.find(uaid); it != s_SoundMap.end()) {
|
if (auto it = s_SoundMap.find(uaid); it != s_SoundMap.end()) {
|
||||||
ma_sound_set_volume(it->second, v);
|
ma_sound_set_volume(it->second, v);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::LogError("[AudioEngine] Invalid Asset ID");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEngine::SetLooping(uint64_t uaid, bool loop) {
|
void AudioEngine::SetLooping(uint64_t uaid, bool loop) {
|
||||||
if (auto it = s_SoundMap.find(uaid); it != s_SoundMap.end()) {
|
if (auto it = s_SoundMap.find(uaid); it != s_SoundMap.end()) {
|
||||||
ma_sound_set_looping(it->second, loop ? MA_TRUE : MA_FALSE);
|
ma_sound_set_looping(it->second, loop ? MA_TRUE : MA_FALSE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::LogError("[AudioEngine] Invalid Asset ID");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEngine::Cleanup(uint64_t uaid) {
|
void AudioEngine::Cleanup(uint64_t uaid) {
|
||||||
@ -169,6 +179,10 @@ void AudioEngine::Cleanup(uint64_t uaid) {
|
|||||||
delete it->second;
|
delete it->second;
|
||||||
s_SoundMap.erase(it);
|
s_SoundMap.erase(it);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
Logger::LogError("[AudioEngine] Invalid Asset ID");
|
||||||
|
|
||||||
|
}
|
||||||
s_PlayingInfoMap.erase(uaid);
|
s_PlayingInfoMap.erase(uaid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ std::unordered_map<std::string, ImageCacheEntry> engineTextureCache;
|
|||||||
|
|
||||||
ImageCacheEntry LoadImageCache(const std::string& path)
|
ImageCacheEntry LoadImageCache(const std::string& path)
|
||||||
{
|
{
|
||||||
|
Logger::LogDepricatedWithStackTrace("LoadImageCache()");
|
||||||
Logger::LogWarning(
|
Logger::LogWarning(
|
||||||
"[LoadImageCache] This function is **deprecated**.\n"
|
"[LoadImageCache] This function is **deprecated**.\n"
|
||||||
"Please use one of the following AssetManager functions instead:\n"
|
"Please use one of the following AssetManager functions instead:\n"
|
||||||
|
@ -10,7 +10,7 @@ Shader::~Shader() { Clear(); }
|
|||||||
|
|
||||||
void Shader::Clear() {
|
void Shader::Clear() {
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
Logger::LogVerbose("[Shader] Deleting program ID: %u", id);
|
Logger::LogVerbose("[Shader] Clearing shader program (ID: %u)", id);
|
||||||
glDeleteProgram(id);
|
glDeleteProgram(id);
|
||||||
id = 0;
|
id = 0;
|
||||||
}
|
}
|
||||||
@ -23,15 +23,15 @@ std::string Shader::ReadFile(const std::string& path) {
|
|||||||
buffer << stream.rdbuf();
|
buffer << stream.rdbuf();
|
||||||
|
|
||||||
std::string filename = GetFilenameFromPath(path);
|
std::string filename = GetFilenameFromPath(path);
|
||||||
Logger::LogVerbose("[Shader] ReadFile: %s", filename.c_str());
|
Logger::LogVerbose("[Shader] Reading file: %s", filename.c_str());
|
||||||
Logger::LogVerbose("[Shader] Size (%zu bytes)", buffer.str().size());
|
Logger::LogVerbose("[Shader] File size: %zu bytes", buffer.str().size());
|
||||||
|
|
||||||
return buffer.str();
|
return buffer.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Shader::Compile(GLenum type, const std::string& source) {
|
GLuint Shader::Compile(GLenum type, const std::string& source) {
|
||||||
Logger::LogVerbose("[Shader] Compiling %s shader...",
|
const char* typeStr = type == GL_VERTEX_SHADER ? "Vertex" : "Fragment";
|
||||||
type == GL_VERTEX_SHADER ? "Vertex" : "Fragment");
|
Logger::LogVerbose("[Shader] Compiling %s shader...", typeStr);
|
||||||
|
|
||||||
GLuint shader = glCreateShader(type);
|
GLuint shader = glCreateShader(type);
|
||||||
const char* src = source.c_str();
|
const char* src = source.c_str();
|
||||||
@ -43,25 +43,26 @@ GLuint Shader::Compile(GLenum type, const std::string& source) {
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
char info[512];
|
char info[512];
|
||||||
glGetShaderInfoLog(shader, 512, nullptr, info);
|
glGetShaderInfoLog(shader, 512, nullptr, info);
|
||||||
Logger::LogError("[Shader] Type %s:\n%s",
|
Logger::LogError("[Shader] %s Shader Compilation Failed:\n%s", typeStr, info);
|
||||||
type == GL_VERTEX_SHADER ? "Vertex" : "Fragment", info);
|
|
||||||
} else {
|
} else {
|
||||||
Logger::LogVerbose("[Shader] Compiled %s shader successfully.",
|
Logger::LogVerbose("[Shader] %s shader compiled successfully.", typeStr);
|
||||||
type == GL_VERTEX_SHADER ? "Vertex" : "Fragment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Shader::LoadFromFile(const std::string& vertexPath, const std::string& fragmentPath) {
|
bool Shader::LoadFromFile(const std::string& vertexPath, const std::string& fragmentPath) {
|
||||||
Logger::LogVerbose("[Shader] Loading from file: %s + %s", vertexPath.c_str(), fragmentPath.c_str());
|
Logger::LogVerbose("[Shader] Loading shaders from files:");
|
||||||
|
Logger::LogVerbose(" Vertex: %s", vertexPath.c_str());
|
||||||
|
Logger::LogVerbose(" Fragment: %s", fragmentPath.c_str());
|
||||||
return LoadFromSource(ReadFile(vertexPath), ReadFile(fragmentPath));
|
return LoadFromSource(ReadFile(vertexPath), ReadFile(fragmentPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Shader::LoadFromSource(const std::string& vertexSrc, const std::string& fragmentSrc) {
|
bool Shader::LoadFromSource(const std::string& vertexSrc, const std::string& fragmentSrc) {
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
|
Logger::LogVerbose("[Shader] Compiling and linking shader program...");
|
||||||
|
|
||||||
GLuint vertex = Compile(GL_VERTEX_SHADER, vertexSrc);
|
GLuint vertex = Compile(GL_VERTEX_SHADER, vertexSrc);
|
||||||
GLuint fragment = Compile(GL_FRAGMENT_SHADER, fragmentSrc);
|
GLuint fragment = Compile(GL_FRAGMENT_SHADER, fragmentSrc);
|
||||||
|
|
||||||
@ -78,11 +79,11 @@ bool Shader::LoadFromSource(const std::string& vertexSrc, const std::string& fra
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
char info[512];
|
char info[512];
|
||||||
glGetProgramInfoLog(id, 512, nullptr, info);
|
glGetProgramInfoLog(id, 512, nullptr, info);
|
||||||
Logger::LogError("[Shader]]:\n%s", info);
|
Logger::LogError("[Shader] Shader Program Linking Failed:\n%s", info);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::LogVerbose("[Shader] Linked shader program successfully (ID: %u)", id);
|
Logger::LogVerbose("[Shader] Shader program linked successfully (ID: %u)", id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +102,13 @@ GLint Shader::GetUniformLocation(const std::string& name) {
|
|||||||
|
|
||||||
GLint loc = glGetUniformLocation(id, name.c_str());
|
GLint loc = glGetUniformLocation(id, name.c_str());
|
||||||
if (loc == -1)
|
if (loc == -1)
|
||||||
Logger::LogWarning("[Shader] Uniform not found: %s", name.c_str());
|
Logger::LogWarning("[Shader] Uniform not found: '%s'", name.c_str());
|
||||||
|
|
||||||
uniformCache[name] = loc;
|
uniformCache[name] = loc;
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user