Skip to content

Commit

Permalink
update for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
beaumanvienna committed Sep 27, 2024
1 parent c35e79f commit f22d7da
Show file tree
Hide file tree
Showing 50 changed files with 451 additions and 430 deletions.
45 changes: 45 additions & 0 deletions .vscode_MacOS/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"configurations": [
{
"name": "macOS",
"includePath": [
"application",
"application/lucre",
"engine",
"vendor",
"vendor/imgui",
"resources",
"vendor/spdlog/include",
"vendor/yaml-cpp/include",
"vendor/fastgltf/include",
".",
"engine/platform/Vulkan",
"vendor/assetImporter/include",
"vendor/tinyObjLoader",
"vendor/fastgltf/include/",
"vendor/box2d/include",
"vendor/entt/include",
"vendor/simdjson",
"vendor/json",
"vendor/glm",
"vendor/stb",
"vendor/pamanager/libpamanager/src",
"vendor/sdl/include",
"vendor/thread-pool/include",
"resources/atlas",
"/usr/local/include",
"/opt/homebrew/Cellar/glib/2.80.4/include/glib-2.0",
"/opt/homebrew/Cellar/glib/2.80.4/lib/glib-2.0/include",
"/opt/homebrew/include/SDL2",
"/opt/homebrew/include",
"vendor/tracy/include"
],
"defines": [
"MACOSX"
],
"cStandard": "c17",
"cppStandard": "c++20"
}
],
"version": 4
}
16 changes: 2 additions & 14 deletions .vscode_MacOS/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "./bin/Debug/lucre",
"program": "${workspaceFolder}/bin/Debug/lucre",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
"MIMode": "lldb"
}

]
}
1 change: 0 additions & 1 deletion application/lucre/UI/settingsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ namespace LucreApp
private:
InfoMessage* m_SettingsInfo;
SCREEN_UI::TabHolder* m_TabHolder = nullptr;
SCREEN_UI::Choice* m_BackButton;
int m_LastTab;

SpriteSheet* m_Spritesheet;
Expand Down
2 changes: 0 additions & 2 deletions application/lucre/UI/settingsTabs/credits.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,5 @@ namespace LucreApp

private:
SpriteSheet* m_Spritesheet;

SCREEN_UI::TextView* m_TextSetup1;
};
} // namespace LucreApp
1 change: 1 addition & 0 deletions application/lucre/animation/easingAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace LucreApp
m_RangeLow = rangeLow < rangeHigh ? rangeLow : rangeHigh;
m_RangeHigh = rangeLow < rangeHigh ? rangeHigh : rangeLow;
}
virtual ~EasingAnimation() {};

void Run(float time, float& speed)
{
Expand Down
1 change: 0 additions & 1 deletion application/lucre/gamepadInputController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ namespace LucreApp
float yaw = transform.GetRotation().y;
const glm::vec3 forwardDir{std::sin(yaw), 0.f, std::cos(yaw)};
const glm::vec3 rightDir{forwardDir.z, 0.f, -forwardDir.x};
const glm::vec3 upDir{0.f, -1.f, 0.f};

glm::vec3 moveDir{0.0f};
moveDir -= forwardDir * m_Momentum.Get(translate, timestep);
Expand Down
1 change: 0 additions & 1 deletion application/lucre/scenes/beachScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ namespace LucreApp
entt::entity m_Camera, m_Skybox, m_NonPlayableCharacter, m_Lightbulb0, m_Lightbulb1;
std::vector<DirectionalLightComponent*> m_DirectionalLights;
entt::entity m_DirectionalLight0, m_DirectionalLight1;
entt::entity m_PointLight[MAX_LIGHTS];

// some game objects can be controlled with a gamepad
std::unique_ptr<GamepadInputController> m_GamepadInputController;
Expand Down
4 changes: 2 additions & 2 deletions application/lucre/scenes/nightScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ namespace LucreApp
{1.0f, 1.0f, 1.0f, 1.0f}, // glm::vec4 m_StartColor
{1.0f, 1.0f, 1.0f, 0.0f}, // glm::vec4 m_EndColor

{0.005f}, // float m_StartSize
{0.07f}, // float m_FinalSize
0.005f, // float m_StartSize
0.07f, // float m_FinalSize

{6s}, // Timestep m_LifeTime
};
Expand Down
1 change: 0 additions & 1 deletion application/lucre/scenes/terrainScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ namespace LucreApp
entt::entity m_Camera, m_Skybox, m_Lightbulb0, m_Lightbulb1, m_Terrain, m_Water, m_Guybrush;
std::vector<DirectionalLightComponent*> m_DirectionalLights;
entt::entity m_DirectionalLight0, m_DirectionalLight1;
entt::entity m_PointLight[MAX_LIGHTS];

//------
void LoadTerrain();
Expand Down
20 changes: 7 additions & 13 deletions application/lucre/scripts/duck/duckScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,24 @@
namespace LucreApp
{

DuckScript::DuckScript(entt::entity entity, Scene* scene)
: NativeScript(entity, scene), m_Health(10), m_BloodThirstiness(10000)
{
}
DuckScript::DuckScript(entt::entity entity, Scene* scene) : NativeScript(entity, scene) {}

void DuckScript::Start()
{
m_Transform.SetTranslationY(3.5f);
}
void DuckScript::Start() { m_Transform.SetTranslationY(3.5f); }

void DuckScript::OnUpdate(const Timestep& timestep)
{
static constexpr float MOVE_UP = 1.0f;
static constexpr float MOVE_UP = 1.0f;
static constexpr float MOVE_DOWN = -1.0f;
static float move = MOVE_DOWN;

if ((m_Translation.y > 1.5f) && (move==MOVE_UP))
if ((m_Translation.y > 1.5f) && (move == MOVE_UP))
{
move = MOVE_DOWN;
}
else if ((m_Translation.y < 1.0f) && (move==MOVE_DOWN))
else if ((m_Translation.y < 1.0f) && (move == MOVE_DOWN))
{
move = MOVE_UP;
}
m_Transform.AddTranslation({0.0f, timestep*move, 0.0f});
m_Transform.AddTranslation({0.0f, timestep * move, 0.0f});
}
}
} // namespace LucreApp
2 changes: 0 additions & 2 deletions application/lucre/scripts/duck/duckScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,5 @@ namespace LucreApp

private:

uint m_Health, m_BloodThirstiness;

};
}
1 change: 1 addition & 0 deletions engine/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace GfxRenderEngine
OPEN_AL,
FFMPEG
};
virtual ~Audio() {};

public:
virtual void Start() = 0;
Expand Down
95 changes: 62 additions & 33 deletions engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "gtx/hash.hpp"

#ifdef TRACY_ENABLE
#include "tracy/Tracy.hpp"
#include "tracy/Tracy.hpp"
#endif

typedef uint8_t uchar;
Expand Down Expand Up @@ -68,39 +68,68 @@ int engine(int argc, char* argv[]);

// logging
#ifndef DISTRIBUTION_BUILD
#define LOGGING_AND_ASSERTS
#define LOGGING_AND_ASSERTS
#endif
#ifdef LOGGING_AND_ASSERTS
#define CORE_ASSERT(x, str) \
if (!(x)) \
LOG_CORE_CRITICAL("ASSERT on line number {0} in file {1}: {2} (error)", __LINE__, __FILE__, str)

#define APP_ASSERT(x, str) \
if (!(x)) \
LOG_APP_CRITICAL("ASSERT on line number {0} in file {1}: {2} (error)", __LINE__, __FILE__, str)

#define LOG_CORE_TRACE(...) GfxRenderEngine::Log::GetLogger()->trace(__VA_ARGS__)
#define LOG_CORE_INFO(...) GfxRenderEngine::Log::GetLogger()->info(__VA_ARGS__)
#define LOG_CORE_WARN(...) GfxRenderEngine::Log::GetLogger()->warn(__VA_ARGS__)
#define LOG_CORE_ERROR(...) GfxRenderEngine::Log::GetLogger()->error(__VA_ARGS__)
#define LOG_CORE_CRITICAL(...) GfxRenderEngine::Log::GetLogger()->critical(__VA_ARGS__)

#define LOG_APP_TRACE(...) GfxRenderEngine::Log::GetAppLogger()->trace(__VA_ARGS__)
#define LOG_APP_INFO(...) GfxRenderEngine::Log::GetAppLogger()->info(__VA_ARGS__)
#define LOG_APP_WARN(...) GfxRenderEngine::Log::GetAppLogger()->warn(__VA_ARGS__)
#define LOG_APP_ERROR(...) GfxRenderEngine::Log::GetAppLogger()->error(__VA_ARGS__)
#define LOG_APP_CRITICAL(...) GfxRenderEngine::Log::GetAppLogger()->critical(__VA_ARGS__)
#define CORE_ASSERT(x, str) \
if (!(x)) \
LOG_CORE_CRITICAL("ASSERT on line number {0} in file {1}: {2} (error)", __LINE__, __FILE__, str)

#define CORE_HARD_STOP(str) \
LOG_CORE_CRITICAL("hard stop on line number {0} in file {1}: {2} (error)", __LINE__, __FILE__, str); \
std::cout << "terminating because of " << str << std::endl; \
exit(1)

#define APP_ASSERT(x, str) \
if (!(x)) \
LOG_APP_CRITICAL("ASSERT on line number {0} in file {1}: {2} (error)", __LINE__, __FILE__, str)

#define LOG_CORE_TRACE(...) GfxRenderEngine::Log::GetLogger()->trace(__VA_ARGS__)
#define LOG_CORE_INFO(...) GfxRenderEngine::Log::GetLogger()->info(__VA_ARGS__)
#define LOG_CORE_WARN(...) GfxRenderEngine::Log::GetLogger()->warn(__VA_ARGS__)
#define LOG_CORE_ERROR(...) GfxRenderEngine::Log::GetLogger()->error(__VA_ARGS__)
#define LOG_CORE_CRITICAL(...) GfxRenderEngine::Log::GetLogger()->critical(__VA_ARGS__)

#define LOG_APP_TRACE(...) GfxRenderEngine::Log::GetAppLogger()->trace(__VA_ARGS__)
#define LOG_APP_INFO(...) GfxRenderEngine::Log::GetAppLogger()->info(__VA_ARGS__)
#define LOG_APP_WARN(...) GfxRenderEngine::Log::GetAppLogger()->warn(__VA_ARGS__)
#define LOG_APP_ERROR(...) GfxRenderEngine::Log::GetAppLogger()->error(__VA_ARGS__)
#define LOG_APP_CRITICAL(...) GfxRenderEngine::Log::GetAppLogger()->critical(__VA_ARGS__)
#else
#define CORE_ASSERT(x, str) {}
#define APP_ASSERT(x, str) {}
#define LOG_CORE_TRACE(...) {}
#define LOG_CORE_INFO(...) {}
#define LOG_CORE_WARN(...) {}
#define LOG_CORE_ERROR(...) {}
#define LOG_CORE_CRITICAL(...) {}
#define LOG_APP_TRACE(...) {}
#define LOG_APP_INFO(...) {}
#define LOG_APP_WARN(...) {}
#define LOG_APP_ERROR(...) {}
#define LOG_APP_CRITICAL(...) {}
#define CORE_ASSERT(x, str) \
{ \
}
#define APP_ASSERT(x, str) \
{ \
}
#define LOG_CORE_TRACE(...) \
{ \
}
#define LOG_CORE_INFO(...) \
{ \
}
#define LOG_CORE_WARN(...) \
{ \
}
#define LOG_CORE_ERROR(...) \
{ \
}
#define LOG_CORE_CRITICAL(...) \
{ \
}
#define LOG_APP_TRACE(...) \
{ \
}
#define LOG_APP_INFO(...) \
{ \
}
#define LOG_APP_WARN(...) \
{ \
}
#define LOG_APP_ERROR(...) \
{ \
}
#define LOG_APP_CRITICAL(...) \
{ \
}
#endif
1 change: 1 addition & 0 deletions engine/events/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace GfxRenderEngine
friend class EventDispatcher;

public:
virtual ~Event() {};
virtual EventType GetEventType() const = 0;
virtual const char* GetName() const = 0;
virtual int GetCategoryFlags() const = 0;
Expand Down
4 changes: 2 additions & 2 deletions engine/layer/layer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Engine Copyright (c) 2022 Engine Development Team
/* Engine Copyright (c) 2024 Engine Development Team
https://github.com/beaumanvienna/vulkan
Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -29,7 +29,7 @@

namespace GfxRenderEngine
{
Layer::Layer(const std::string& name) : m_DebugName(name), m_Enabled(true) {}
Layer::Layer(const std::string& name) : m_DebugName{name} {}

Layer::~Layer() {}
} // namespace GfxRenderEngine
1 change: 0 additions & 1 deletion engine/layer/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace GfxRenderEngine
inline const std::string& GetName() const { return m_DebugName; }

private:
bool m_Enabled;
std::string m_DebugName;
};
} // namespace GfxRenderEngine
7 changes: 3 additions & 4 deletions engine/platform/Vulkan/VKcubemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ namespace GfxRenderEngine
{

VK_Cubemap::VK_Cubemap(bool nearestFilter)
: m_NearestFilter(nearestFilter), m_MipLevels(1), m_FileNames({""}), m_Type(0), m_Width(0), m_Height(0),
m_BytesPerPixel(0), m_InternalFormat(0), m_DataFormat(0), m_sRGB(false)
: m_NearestFilter{nearestFilter}, m_MipLevels{1}, m_Width{0}, m_Height{0}, m_BytesPerPixel{0}, m_sRGB{false}
{
}

Expand All @@ -58,7 +57,7 @@ namespace GfxRenderEngine

void VK_Cubemap::TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout)
{
VkCommandBuffer commandBuffer = VK_Core::m_Device->BeginSingleTimeCommands(QueueTypes::GRAPHICS);
VkCommandBuffer commandBuffer = VK_Core::m_Device->BeginSingleTimeCommands();

VkImageMemoryBarrier barrier{};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
Expand Down Expand Up @@ -99,7 +98,7 @@ namespace GfxRenderEngine

vkCmdPipelineBarrier(commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier);

VK_Core::m_Device->EndSingleTimeCommands(commandBuffer, QueueTypes::GRAPHICS);
VK_Core::m_Device->EndSingleTimeCommands(commandBuffer);
m_ImageLayout = newLayout;
}

Expand Down
19 changes: 8 additions & 11 deletions engine/platform/Vulkan/VKcubemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,18 @@ namespace GfxRenderEngine
private:
static constexpr int NUMBER_OF_CUBEMAP_IMAGES = 6;

std::vector<std::string> m_FileNames;
std::vector<std::string> m_FileNames{};
int m_Width, m_Height, m_BytesPerPixel;
uint m_MipLevels;

bool m_NearestFilter, m_sRGB;
int m_InternalFormat, m_DataFormat;
int m_Type;

VkFormat m_ImageFormat;
VkImage m_CubemapImage;
VkDeviceMemory m_CubemapImageMemory;
VkImageLayout m_ImageLayout;
VkImageView m_ImageView;
VkSampler m_Sampler;
VkFormat m_ImageFormat{VkFormat::VK_FORMAT_UNDEFINED};
VkImage m_CubemapImage{nullptr};
VkDeviceMemory m_CubemapImageMemory{nullptr};
VkImageLayout m_ImageLayout{VkImageLayout::VK_IMAGE_LAYOUT_UNDEFINED};
VkImageView m_ImageView{nullptr};
VkSampler m_Sampler{nullptr};

VkDescriptorImageInfo m_DescriptorImageInfo;
VkDescriptorImageInfo m_DescriptorImageInfo{};
};
} // namespace GfxRenderEngine
Loading

0 comments on commit f22d7da

Please sign in to comment.