From ee61c9c82ea9e1627ec0f0e049d4fa0ce8805954 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 21 Jun 2026 21:34:30 +0200 Subject: [PATCH 1/5] Introduce behavior tree --- src/runtime/CMakeLists.txt | 13 +++- src/runtime/ai/.behavior_tree.cpp.un~ | Bin 0 -> 523 bytes src/runtime/ai/.behavior_tree.h.un~ | Bin 0 -> 523 bytes src/runtime/ai/behavior_tree.cpp | 24 +++++++ src/runtime/ai/behavior_tree.h | 96 ++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 src/runtime/ai/.behavior_tree.cpp.un~ create mode 100644 src/runtime/ai/.behavior_tree.h.un~ create mode 100644 src/runtime/ai/behavior_tree.cpp create mode 100644 src/runtime/ai/behavior_tree.h diff --git a/src/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt index bc9beb6..b56e5bc 100644 --- a/src/runtime/CMakeLists.txt +++ b/src/runtime/CMakeLists.txt @@ -26,16 +26,23 @@ SET(segfault_renderer_src renderer/vulkantypes.h ) +SET(segfault_ai_src + ai/behavior_tree.h + ai/behavior_tree.cpp +) + SET(segfault_application_src application/app.h application/app.cpp ) -SOURCE_GROUP(core FILES ${segfault_core_src} ) -SOURCE_GROUP(application FILES ${segfault_application_src} ) -SOURCE_GROUP(renderer FILES ${segfault_renderer_src} ) +source_group(ai FILES ${segfault_ai_src} ) +source_group(core FILES ${segfault_core_src} ) +source_group(application FILES ${segfault_application_src} ) +source_group(renderer FILES ${segfault_renderer_src} ) ADD_LIBRARY(segfault_runtime SHARED + ${segfault_ai_src} ${segfault_core_src} ${segfault_renderer_src} ${segfault_application_src} diff --git a/src/runtime/ai/.behavior_tree.cpp.un~ b/src/runtime/ai/.behavior_tree.cpp.un~ new file mode 100644 index 0000000000000000000000000000000000000000..c95342c976d2db59fd17b850f9ac21e910a61cd1 GIT binary patch literal 523 zcmWH`%$*;a=aT=FfobBKC6U|hwZeV43<91AnVi_M>t6dzd5P}Jw;K*<28ehwFfcF! zF*0BTazGdaU~Diy%e2aj1tJoE0V0n=!W4rA{{sPr(J0DCIh2I}Fgi@3(eYIR%_wku JnKnLO1puLy9uNQk literal 0 HcmV?d00001 diff --git a/src/runtime/ai/.behavior_tree.h.un~ b/src/runtime/ai/.behavior_tree.h.un~ new file mode 100644 index 0000000000000000000000000000000000000000..7e2292059a3f025249e4e920358ad9b427299b51 GIT binary patch literal 523 zcmWH`%$*;a=aT=Ff$8KI{p3aEhlSL>n@BA7c`aZaClnS|RuXZ#Fmh`7`!ZVw1_mY| zMh1*P4hVw)j1A^znO14DKt$p%K;%(Km}0Qte;{CBMv))oP&EXA(V+#6j;|7ECWGV4 IwDI{W00rP3v;Y7A literal 0 HcmV?d00001 diff --git a/src/runtime/ai/behavior_tree.cpp b/src/runtime/ai/behavior_tree.cpp new file mode 100644 index 0000000..fd9fc60 --- /dev/null +++ b/src/runtime/ai/behavior_tree.cpp @@ -0,0 +1,24 @@ +#include "behavior_tree.h" + +namespace segfault::ai { + + BehaviorTree::BehaviorTree() { + // Constructor implementation (if needed) + } + + BehaviorTree::~BehaviorTree() { + // Destructor implementation (if needed) + } + + bool BehaviorTree::init(const char* configFile) { + // Initialization logic for the behavior tree using the provided configuration file + // This could involve parsing the config file and constructing the tree structure + return true; // Return true if initialization is successful + } + + void BehaviorTree::update() { + // Update logic for the behavior tree, which would typically involve traversing the tree + // and executing nodes based on their conditions and actions + } + +} // namespace segfault::ai diff --git a/src/runtime/ai/behavior_tree.h b/src/runtime/ai/behavior_tree.h new file mode 100644 index 0000000..850893f --- /dev/null +++ b/src/runtime/ai/behavior_tree.h @@ -0,0 +1,96 @@ +#pragma once + +#include "core/segfault.h" + +namespace segfault::ai { + enum class NodeStatus { + IDLE = 0, + RUNNING = 1, + SUCCESS = 2, + FAILURE = 3, + SKIPPED = 4, + }; + + //--------------------------------------------------------------------------------------------- + /// @class BehaviorTreeNode + /// @brief The BehaviorTreeNode class represents a single node in a behavior tree, which is a + /// hierarchical structure used to model the decision-making process of an AI agent. Each node + /// can represent an action, condition, or control flow, allowing for complex behaviors to be + /// defined in a modular and reusable way. + //--------------------------------------------------------------------------------------------- + class BehaviorTreeNode { + public: + // No copying + BehaviorTreeNode(const BehaviorTreeNode& rhs) = delete; + + + BehaviorTreeNode() = default; + virtual ~BehaviorTreeNode() = default; + + /// @brief Pure virtual function to be implemented by derived classes + virtual NodeStatus tick() = 0; + }; + + class LeafNode : public BehaviorTreeNode { + public: + void tick() override { + // Implementation of the leaf node's behavior + } + }; + + class SequenceNode : public BehaviorTreeNode { + public: + NodeStatus tick() override { + // Implementation of the sequence node's behavior + return NodeStatus::IDLE; + } + }; + + class ConditionNode : public LeafNode { + public: + NodeStatus tick() override { + // Implementation of the condition node's behavior + return NodeStatus::IDLE; + } + }; + + class ActionNode : public LeafNode { + public: + NodeStatus tick() override { + // Implementation of the action node's behavior + return NodeStatus::IDLE; + } + }; + + //--------------------------------------------------------------------------------------------- + /// @class BehaviorTree + /// @brief The BehaviorTree class represents a behavior tree, which is a hierarchical structure + /// used to model the decision-making process of an AI agent. It consists of nodes that + /// represent actions, conditions, and control flow, allowing for complex behaviors to be + /// defined in a modular and reusable way. + //--------------------------------------------------------------------------------------------- + class SEGFAULT_EXPORT BehaviorTree final { + public: + // No copying + BehaviorTree(const BehaviorTree& rhs) = delete; + BehaviorTree& operator = (const BehaviorTree& rhs) = delete; + + /// @brief The class constructor. + BehaviorTree(); + + /// @brief The class destructor. + ~BehaviorTree(); + + /// @brief Initializes the behavior tree with the specified parameters. + /// @param[ in ] configFile The path to the configuration file that defines the behavior tree structure. + /// @return True if initialization was successful, false otherwise. + bool init(const char* configFile); + + /// @brief Updates the behavior tree, processing the nodes and executing actions as needed. + void update(); + + private: + // Private members for managing the behavior tree structure and state would go here + }; + +} // namespace segfault::ai From 2847435478d45f00f89f9cd84ac014c977cdd61f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 23 Jun 2026 21:40:58 +0200 Subject: [PATCH 2/5] Add loading of bt jsons --- src/examples/hello_world/hello_world.cpp | 22 +++++ src/runtime/ai/behavior_tree.cpp | 55 ++++++++++-- src/runtime/ai/behavior_tree.h | 29 +++++- src/runtime/application/app.cpp | 22 +++++ src/runtime/application/app.h | 22 +++++ src/runtime/core/argumentparser.cpp | 2 +- src/runtime/core/argumentparser.h | 2 +- src/runtime/core/filearchive.h | 107 ++++++++++++++++++++++- src/runtime/core/genericfilemanager.cpp | 22 +++++ src/runtime/core/genericfilemanager.h | 22 +++++ src/runtime/core/ifilemanager.h | 22 +++++ src/runtime/core/segfault.h | 22 +++++ src/runtime/core/segfaultexception.h | 22 +++++ src/runtime/core/tokenizer.cpp | 22 +++++ src/runtime/core/tokenizer.h | 22 +++++ src/runtime/renderer/RHI.h | 22 +++++ src/runtime/renderer/RHIVulkan.cpp | 22 +++++ src/runtime/renderer/rendercore.h | 22 +++++ src/runtime/renderer/renderthread.cpp | 22 +++++ src/runtime/renderer/renderthread.h | 22 +++++ src/runtime/renderer/vulkanbuffer.cpp | 22 +++++ src/runtime/renderer/vulkanbuffer.h | 22 +++++ src/runtime/renderer/vulkandevice.cpp | 29 ++++-- src/runtime/renderer/vulkandevice.h | 22 +++++ src/runtime/renderer/vulkanutils.cpp | 22 +++++ src/runtime/renderer/vulkanutils.h | 36 +++++++- src/tools/assetbaker/main.cpp | 22 +++++ 27 files changed, 680 insertions(+), 20 deletions(-) diff --git a/src/examples/hello_world/hello_world.cpp b/src/examples/hello_world/hello_world.cpp index 7c27ce1..040738b 100644 --- a/src/examples/hello_world/hello_world.cpp +++ b/src/examples/hello_world/hello_world.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "core/segfault.h" #include "application/app.h" diff --git a/src/runtime/ai/behavior_tree.cpp b/src/runtime/ai/behavior_tree.cpp index fd9fc60..cff3bf9 100644 --- a/src/runtime/ai/behavior_tree.cpp +++ b/src/runtime/ai/behavior_tree.cpp @@ -1,6 +1,35 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "behavior_tree.h" +#include "core/filearchive.h" + +#include + +using json = ::nlohmann::json; namespace segfault::ai { + + using namespace segfault::core; BehaviorTree::BehaviorTree() { // Constructor implementation (if needed) @@ -11,14 +40,30 @@ namespace segfault::ai { } bool BehaviorTree::init(const char* configFile) { - // Initialization logic for the behavior tree using the provided configuration file - // This could involve parsing the config file and constructing the tree structure - return true; // Return true if initialization is successful + if (configFile == nullptr) { + return false; + } + + FileArchive archive(configFile, "r", true, false); + if (!archive.isValid()) { + return false; + } + + // Read the entire file into a string + size_t size = archive.getSize(); + std::string content(size, '\0'); + archive.read(reinterpret_cast(&content[0]), size); + json Doc{ json::parse(content) }; + + return true; } void BehaviorTree::update() { - // Update logic for the behavior tree, which would typically involve traversing the tree - // and executing nodes based on their conditions and actions + if (mRootNode == nullptr) { + return; + } + + mRootNode->tick(); } } // namespace segfault::ai diff --git a/src/runtime/ai/behavior_tree.h b/src/runtime/ai/behavior_tree.h index 850893f..c401b1c 100644 --- a/src/runtime/ai/behavior_tree.h +++ b/src/runtime/ai/behavior_tree.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" @@ -22,7 +44,7 @@ namespace segfault::ai { public: // No copying BehaviorTreeNode(const BehaviorTreeNode& rhs) = delete; - + BehaviorTreeNode& operator = (const BehaviorTreeNode& rhs) = delete; BehaviorTreeNode() = default; virtual ~BehaviorTreeNode() = default; @@ -33,8 +55,9 @@ namespace segfault::ai { class LeafNode : public BehaviorTreeNode { public: - void tick() override { + NodeStatus tick() override { // Implementation of the leaf node's behavior + return NodeStatus::IDLE; } }; @@ -90,7 +113,7 @@ namespace segfault::ai { void update(); private: - // Private members for managing the behavior tree structure and state would go here + BehaviorTreeNode* mRootNode{ nullptr }; }; } // namespace segfault::ai diff --git a/src/runtime/application/app.cpp b/src/runtime/application/app.cpp index 8b44f66..c3e4e52 100644 --- a/src/runtime/application/app.cpp +++ b/src/runtime/application/app.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "application/app.h" #include "core/segfault.h" #include diff --git a/src/runtime/application/app.h b/src/runtime/application/app.h index ee3f0bf..bc60586 100644 --- a/src/runtime/application/app.h +++ b/src/runtime/application/app.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/core/argumentparser.cpp b/src/runtime/core/argumentparser.cpp index f1a63b9..7e280c0 100644 --- a/src/runtime/core/argumentparser.cpp +++ b/src/runtime/core/argumentparser.cpp @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2015-2025 OSRE ( Open Source Render Engine ) by Kim Kulling +Copyright (c) 2015-2026 Segfault by Kim Kulling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/src/runtime/core/argumentparser.h b/src/runtime/core/argumentparser.h index 7e018f6..87b2134 100644 --- a/src/runtime/core/argumentparser.h +++ b/src/runtime/core/argumentparser.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2015-2025 OSRE ( Open Source Render Engine ) by Kim Kulling +Copyright (c) 2015-2026 Segfault by Kim Kulling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/src/runtime/core/filearchive.h b/src/runtime/core/filearchive.h index 324ca5b..31f0f62 100644 --- a/src/runtime/core/filearchive.h +++ b/src/runtime/core/filearchive.h @@ -1,18 +1,94 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include #include #include +#include namespace segfault::core { class FileArchive { public: + // No copying + FileArchive() = delete; + FileArchive(const FileArchive& rhs) = delete; + FileArchive& operator=(const FileArchive& rhs) = delete; + + /// @brief Constructs a FileArchive object by opening a file with the specified filename and mode. + /// @param filename The name of the file to open. + /// @param mode The mode in which to open the file (e.g., "r") + /// @param canRead Indicates whether the archive can be read from. + /// @param canWrite Indicates whether the archive can be written to. + FileArchive(const char* filename, const char* mode, bool canRead, bool canWrite); + + /// @brief Constructs a FileArchive object using an existing FILE stream. + /// @param mStream The FILE stream to use for the archive. + /// @param canRead Indicates whether the archive can be read from. + /// @param canWrite Indicates whether the archive can be written to. FileArchive(FILE *mStream, bool canRead, bool canWrite); + + /// @brief Destroys the FileArchive object and closes the underlying file stream. virtual ~FileArchive(); + + /// @brief Checks if the archive is readable. + /// @return True if the archive can be read from; otherwise, false. + virtual bool isReadable() const { return mCanRead; } + + /// @brief Checks if the archive is writable. + /// @return True if the archive can be written to; otherwise, false. + virtual bool isWritable() const { return mCanWrite; } + + /// @brief Checks if the archive is valid (i.e., the underlying file stream is open). + /// @return True if the archive is valid; otherwise, false. + virtual bool isValid() const { return mStream != nullptr; } + + /// @brief Gets the size of the archive in bytes. + /// @return The size of the archive in bytes. + virtual size_t getSize() const; + + /// @brief Seeks to a specific position in the archive. + /// @param offset The offset to seek to. + /// @param origin The origin of the seek operation. + /// @return True if the seek operation was successful; otherwise, false. + virtual bool seek(size_t offset, int origin); + + /// @brief Reads data from the archive into a buffer. + /// @param buffer The buffer to read data into. + /// @param size The number of bytes to read. + /// @return The number of bytes actually read. virtual size_t read(uint8_t *buffer, size_t size); + + /// @brief Writes data from a buffer to the archive. + /// @param buffer The buffer containing the data to write. + /// @param size The number of bytes to write. + /// @return The number of bytes actually written. virtual size_t write(const uint8_t *buffer, size_t size); - virtual FILE *getStream() const; + + /// @brief Gets the underlying FILE stream of the archive. + /// @return A pointer to the underlying FILE stream. + virtual FILE *getStream() const; private: FILE *mStream{nullptr}; @@ -20,6 +96,15 @@ class FileArchive { bool mCanWrite{false}; }; +inline FileArchive::FileArchive(const char* filename, const char* mode, bool canRead, bool canWrite) : + mCanRead(canRead), + mCanWrite(canWrite) { + assert(filename != nullptr); + assert(mode != nullptr); + + mStream = fopen(filename, mode); +} + inline FileArchive::FileArchive(FILE *stream, bool canRead, bool canWrite) : mStream(stream), mCanRead(canRead), @@ -31,6 +116,26 @@ inline FileArchive::~FileArchive() { fclose(mStream); } +inline size_t FileArchive::getSize() const { + if (!isValid()) { + return 0; + } + long currentPos = ftell(mStream); + fseek(mStream, 0, SEEK_END); + long size = ftell(mStream); + fseek(mStream, currentPos, SEEK_SET); + + return static_cast(size); +} + +inline bool FileArchive::seek(size_t offset, int origin) { + if (!isValid()) { + return false; + } + + return fseek(mStream, offset, origin) == 0; +} + inline size_t FileArchive::read(uint8_t *buffer, size_t size) { return fread(buffer, 1, size, mStream); } diff --git a/src/runtime/core/genericfilemanager.cpp b/src/runtime/core/genericfilemanager.cpp index ec63624..22d4f00 100644 --- a/src/runtime/core/genericfilemanager.cpp +++ b/src/runtime/core/genericfilemanager.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "core/genericfilemanager.h" #include "core/filearchive.h" diff --git a/src/runtime/core/genericfilemanager.h b/src/runtime/core/genericfilemanager.h index e6ae72b..03c0ff9 100644 --- a/src/runtime/core/genericfilemanager.h +++ b/src/runtime/core/genericfilemanager.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/ifilemanager.h" diff --git a/src/runtime/core/ifilemanager.h b/src/runtime/core/ifilemanager.h index 70b8002..0add03c 100644 --- a/src/runtime/core/ifilemanager.h +++ b/src/runtime/core/ifilemanager.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/core/segfault.h b/src/runtime/core/segfault.h index 463acf6..acc309c 100644 --- a/src/runtime/core/segfault.h +++ b/src/runtime/core/segfault.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/config.h" diff --git a/src/runtime/core/segfaultexception.h b/src/runtime/core/segfaultexception.h index da2d3e9..f1a4310 100644 --- a/src/runtime/core/segfaultexception.h +++ b/src/runtime/core/segfaultexception.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include diff --git a/src/runtime/core/tokenizer.cpp b/src/runtime/core/tokenizer.cpp index ce35b2a..b7b3214 100644 --- a/src/runtime/core/tokenizer.cpp +++ b/src/runtime/core/tokenizer.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "core/tokenizer.h" namespace segfault::core { diff --git a/src/runtime/core/tokenizer.h b/src/runtime/core/tokenizer.h index c26b38c..be26b5f 100644 --- a/src/runtime/core/tokenizer.h +++ b/src/runtime/core/tokenizer.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/renderer/RHI.h b/src/runtime/renderer/RHI.h index 6449f1a..7d6cf22 100644 --- a/src/runtime/renderer/RHI.h +++ b/src/runtime/renderer/RHI.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/renderer/RHIVulkan.cpp b/src/runtime/renderer/RHIVulkan.cpp index f33b9e2..1a99e72 100644 --- a/src/runtime/renderer/RHIVulkan.cpp +++ b/src/runtime/renderer/RHIVulkan.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "RHI.h" #include "rendercore.h" #include "vulkanutils.h" diff --git a/src/runtime/renderer/rendercore.h b/src/runtime/renderer/rendercore.h index 9879b8c..7ebf6f8 100644 --- a/src/runtime/renderer/rendercore.h +++ b/src/runtime/renderer/rendercore.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/renderer/renderthread.cpp b/src/runtime/renderer/renderthread.cpp index ffd307a..b42ed76 100644 --- a/src/runtime/renderer/renderthread.cpp +++ b/src/runtime/renderer/renderthread.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "renderer/renderthread.h" namespace segfault::renderer { diff --git a/src/runtime/renderer/renderthread.h b/src/runtime/renderer/renderthread.h index 105bbc6..8fc40c9 100644 --- a/src/runtime/renderer/renderthread.h +++ b/src/runtime/renderer/renderthread.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "core/segfault.h" diff --git a/src/runtime/renderer/vulkanbuffer.cpp b/src/runtime/renderer/vulkanbuffer.cpp index 46ad5a9..319dd1d 100644 --- a/src/runtime/renderer/vulkanbuffer.cpp +++ b/src/runtime/renderer/vulkanbuffer.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "vulkanbuffer.h" #include #include diff --git a/src/runtime/renderer/vulkanbuffer.h b/src/runtime/renderer/vulkanbuffer.h index 0ab6d94..944e06c 100644 --- a/src/runtime/renderer/vulkanbuffer.h +++ b/src/runtime/renderer/vulkanbuffer.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "volk.h" diff --git a/src/runtime/renderer/vulkandevice.cpp b/src/runtime/renderer/vulkandevice.cpp index 8d63c1d..2128d94 100644 --- a/src/runtime/renderer/vulkandevice.cpp +++ b/src/runtime/renderer/vulkandevice.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "vulkandevice.h" namespace segfault::renderer { @@ -50,12 +72,9 @@ namespace segfault::renderer { VkCommandBuffer copyCmd = createCommandBuffer(pool); VkBufferCopy bufferCopy{}; - if (size == 0) - { + if (size == 0) { bufferCopy.size = source->getSize(); - } - else - { + } else { bufferCopy.size = size; } diff --git a/src/runtime/renderer/vulkandevice.h b/src/runtime/renderer/vulkandevice.h index f85df84..3c119e6 100644 --- a/src/runtime/renderer/vulkandevice.h +++ b/src/runtime/renderer/vulkandevice.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "volk.h" diff --git a/src/runtime/renderer/vulkanutils.cpp b/src/runtime/renderer/vulkanutils.cpp index 9d48d6d..2ff1aa8 100644 --- a/src/runtime/renderer/vulkanutils.cpp +++ b/src/runtime/renderer/vulkanutils.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "vulkanutils.h" #include "core/segfaultexception.h" #include "volk.h" diff --git a/src/runtime/renderer/vulkanutils.h b/src/runtime/renderer/vulkanutils.h index d0f682f..e8236ba 100644 --- a/src/runtime/renderer/vulkanutils.h +++ b/src/runtime/renderer/vulkanutils.h @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #pragma once #include "volk.h" @@ -10,12 +32,18 @@ namespace segfault::renderer { - struct Vertex { - glm::vec3 pos{}; - glm::vec3 color{}; - glm::vec2 texCoord{}; + /// @brief Represents a vertex with position, color, and texture coordinates. + struct Vertex { + glm::vec3 pos{}; ///< Position of the vertex in 3D space. + glm::vec3 color{}; ///< Color of the vertex (RGB). + glm::vec2 texCoord{}; ///< Texture coordinates for the vertex. + /// @brief Returns the attribute descriptions for the vertex. + /// @return An array of VkVertexInputAttributeDescription for the vertex attributes. static std::array getAttributeDescriptions(); + + /// @brief Returns the binding description for the vertex. + /// @return A VkVertexInputBindingDescription for the vertex binding. static VkVertexInputBindingDescription getBindingDescription(); }; diff --git a/src/tools/assetbaker/main.cpp b/src/tools/assetbaker/main.cpp index 58ee406..3f98c24 100644 --- a/src/tools/assetbaker/main.cpp +++ b/src/tools/assetbaker/main.cpp @@ -1,3 +1,25 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015-2026 Segfault by Kim Kulling + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-----------------------------------------------------------------------------------------------*/ #include "core/segfault.h" #include "core/filearchive.h" #include "core/genericfilemanager.h" From 24c66037e7b14f00c172edc4bb16b0907ee9800b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 24 Jun 2026 09:16:50 +0200 Subject: [PATCH 3/5] Add namespaces for AI and scene in AGENTS.md Added new namespaces for AI and scene code. --- AGENTS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index f27ef20..5bcee2b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -136,6 +136,15 @@ namespace segfault::renderer { namespace segfault::application { // application code } + +namespace segfault::ai { + // game ai code +} + +namespace segfault::scene { + // scene code +} + ``` ### Import Style From 52cdbc606139e410d33dbf9219bf4ae8575785e6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 24 Jun 2026 15:16:21 +0200 Subject: [PATCH 4/5] Delete src/runtime/ai/.behavior_tree.cpp.un~ --- src/runtime/ai/.behavior_tree.cpp.un~ | Bin 523 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/runtime/ai/.behavior_tree.cpp.un~ diff --git a/src/runtime/ai/.behavior_tree.cpp.un~ b/src/runtime/ai/.behavior_tree.cpp.un~ deleted file mode 100644 index c95342c976d2db59fd17b850f9ac21e910a61cd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 523 zcmWH`%$*;a=aT=FfobBKC6U|hwZeV43<91AnVi_M>t6dzd5P}Jw;K*<28ehwFfcF! zF*0BTazGdaU~Diy%e2aj1tJoE0V0n=!W4rA{{sPr(J0DCIh2I}Fgi@3(eYIR%_wku JnKnLO1puLy9uNQk From a3799bf969483a501556ea3a1d8f10073e35fc27 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 24 Jun 2026 15:16:43 +0200 Subject: [PATCH 5/5] Delete src/runtime/ai/.behavior_tree.h.un~ --- src/runtime/ai/.behavior_tree.h.un~ | Bin 523 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/runtime/ai/.behavior_tree.h.un~ diff --git a/src/runtime/ai/.behavior_tree.h.un~ b/src/runtime/ai/.behavior_tree.h.un~ deleted file mode 100644 index 7e2292059a3f025249e4e920358ad9b427299b51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 523 zcmWH`%$*;a=aT=Ff$8KI{p3aEhlSL>n@BA7c`aZaClnS|RuXZ#Fmh`7`!ZVw1_mY| zMh1*P4hVw)j1A^znO14DKt$p%K;%(Km}0Qte;{CBMv))oP&EXA(V+#6j;|7ECWGV4 IwDI{W00rP3v;Y7A