Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4e78815
Renamed atlas::scene_scope to atlas::scene
SpinnerX Nov 29, 2025
2583b04
Refactored the scene class and scene_object class to not be wrapped a…
SpinnerX Nov 30, 2025
5f19d2d
Added experimental game_objects.hpp/.cpp file for creating game objects
SpinnerX Nov 30, 2025
1a1ca16
Updated includes and updated scene_object to work the same as game_ob…
SpinnerX Nov 30, 2025
8b4b1e2
Updated world.hpp with updated includes and added commented code to w…
SpinnerX Nov 30, 2025
f38eb84
Deleted unecessary files that were not supposed to be added
SpinnerX Nov 30, 2025
c545a65
Removed unused files
SpinnerX Nov 30, 2025
883e345
Added exception header and updated scene object's documentation comments
SpinnerX Nov 30, 2025
dcac3c3
Added documentation comments to atlas::scene
SpinnerX Nov 30, 2025
c6f989e
Removed unused API that was was causing a stack overflow error
SpinnerX Dec 2, 2025
f8105b9
Added a fix for modifying entity names through the UI editor to match…
SpinnerX Dec 2, 2025
a86759d
Added view of the entity ID's to the editor scene heirarchy panel
SpinnerX Dec 2, 2025
b7d3ce3
Created custom exception and ensures atlas::scene_object throws when …
SpinnerX Dec 3, 2025
00e57b4
Code cleanup and added a few minor changes to editor/level_scene.cpp
SpinnerX Dec 3, 2025
d49f38a
Renamed API for creating and fetching entities with an entity(const s…
SpinnerX Dec 3, 2025
96d9579
Renamed atlas::world_scope to atlas::world for simplicity and did som…
SpinnerX Dec 3, 2025
686465e
WIP for getting std::optional<scene_object> to work
SpinnerX Dec 4, 2025
2f1c1c6
WIP uscene_objects and fixed up API's to only enable creating game ob…
SpinnerX Dec 4, 2025
b5d0d1a
WIP changed parameters from using atlas::scene_object to atlas::uscen…
SpinnerX Dec 4, 2025
cd65f26
Updated test cases to conform to the new API's for scenes and scene o…
SpinnerX Dec 4, 2025
d7a9038
Updated order of rendering components in the UI editor
SpinnerX Dec 4, 2025
f4beb63
Renamed atlas::uscene_object to atlas::game_object
SpinnerX Dec 4, 2025
eb91370
Code cleaned up atlas::world and did some minor refactor to the edito…
SpinnerX Dec 4, 2025
6bf0b57
Changed game object code in editor/level_scene.cpp
SpinnerX Dec 6, 2025
4947ad1
Merge branch 'main' of https://github.com/engine3d-dev/TheAtlasEngine…
SpinnerX Dec 6, 2025
a9ce5dd
Added some testing experimentation code to the editor's UI
SpinnerX Dec 7, 2025
cf5568a
Reverted editor_world to not being wrapped around strong_ptr as its n…
SpinnerX Dec 7, 2025
b3e2920
Formatted code using clang-format
SpinnerX Dec 7, 2025
b1b4368
Added noexcept to invalid_access_exception to be synced with definiti…
SpinnerX Dec 7, 2025
839bc38
Formatted code using clang-format
SpinnerX Dec 7, 2025
28933f2
Removed unecessary includes from level_scene.cpp
SpinnerX Dec 7, 2025
c50ad00
Removed commented code that are no longer needed from editor/level_sc…
SpinnerX Dec 7, 2025
fcda87c
Make editor_world a strong_ptr as a temp fix for early construction t…
SpinnerX Dec 8, 2025
fd9ac1c
Formatted code using clang-format
SpinnerX Dec 8, 2025
bd38597
Updated some documentation comments to atlas::scene
SpinnerX Dec 8, 2025
c78844d
Code formatted using clang-format
SpinnerX Dec 8, 2025
01c8f56
Updated documentation for atlas::game_object
SpinnerX Dec 8, 2025
4d1fecb
Set flip flag to true to flip texture coordinates
SpinnerX Dec 9, 2025
018c9a8
Renamed atlas::scene_object to atlas::game_object
SpinnerX Dec 15, 2025
77f3b91
Formatted code using clang-format
SpinnerX Dec 15, 2025
362cd18
Updated conanfile version to 0.f due to core API changes
SpinnerX Dec 15, 2025
0c33d5e
Updated test cases to conform to new game object API's
SpinnerX Dec 15, 2025
5604dee
Removed tinygltf dependency from project cmake and conanfile
SpinnerX Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,15 @@ build_core_library(
tests/scene.test.cpp
tests/jolt_type_conversion.test.cpp
tests/jolt_engine.test.cpp
# tests/object.test.cpp

PACKAGES
tinyobjloader
TinyGLTF
# shaderc # uncomment to use shaderc
${SHADERC_PACKAGE}
watcher
vulkan-cpp

LINK_PACKAGES
tinyobjloader::tinyobjloader
TinyGLTF::TinyGLTF
# shaderc::shaderc # uncomment to use shaderc
${SHADERC_LINK_PACKAGE}
watcher::watcher
vulkan-cpp::vulkan-cpp
Expand Down
1 change: 1 addition & 0 deletions atlas/core/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// core includes
#include <core/core.hpp>
#include <core/application.hpp>
#include <core/engine_logger.hpp>
#include <core/utilities/state.hpp>
#include <core/event/event.hpp>
Expand Down
23 changes: 23 additions & 0 deletions atlas/core/scene/exceptions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include <exception>

namespace atlas {
struct exception_block {
const char* data = nullptr;
};

class invalid_access_exception : public std::exception {
public:
invalid_access_exception() = default;
invalid_access_exception(const char* p_data)
: m_block(p_data) {}

//! @return message given when this exception gets triggered
[[nodiscard]] const char* what() const noexcept override {
return m_block.data;
}

private:
exception_block m_block;
};
};
84 changes: 84 additions & 0 deletions atlas/core/scene/game_object.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#pragma once
#include <flecs.h>
#include <optional>

namespace atlas {

/**
* @brief Creates a pointer wrapper which extends capabilities of
* flecs::entity
*
* Provides our own construct of API's that handles any workload around some
* of the raw flecs API's that can still be used by other flecs API's
* without completely interacting touching raw flecs API
*/
class game_object : public flecs::entity {
public:
//! @brief Should not construct a scene object not created through
//! flecs::world
game_object() = delete;

game_object(flecs::world_t* p_registry, flecs::entity_t p_id);

game_object(const flecs::entity& p_base);

explicit game_object(flecs::entity& p_base);

/**
* @brief sets the entity to be a parent of the specified entity
*
* @param p_entity is the specified entity to specify as the parent.
*
*
* Example Usage:
*
* ```C++
*
* atlas::game_object obj1 = entity("Parent");
*
* atlas::game_object obj2 = entity("Chlid");
*
* // obj2 is the child of obj1
* // As obj1 is a parent node
* obj2.child_of(obj1);
*
* ```
*
*/
void child_of(const std::optional<game_object>& p_parent);

/**
* @brief iterates through all children entities if the given entity is
* a parent of any given entities
*
* Example Usage:
*
*
* ```C++
* atlas::game_object obj1 = entity("Parent Node");
* atlas::game_object obj2 = entity("Chlid Node");
*
* // obj1 is the parent of obj2.
* obj2.child_of(parent);
*
* // iteration should only include for "Child Node"
* obj1.children([](flecs::entity p_child){
* // do stuff with the child entity
* });
*
* ```
*/
template<typename UFunction>
void children(UFunction&& p_callback) {
children(p_callback);
}
};

/**
* @brief Alias to std::optional<game_object>
*
* This alias serves as a representation of game objects users can create
* and manage components with
*/
using game_object_optional = std::optional<game_object>;
};
75 changes: 51 additions & 24 deletions atlas/core/scene/scene.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma once
#include <core/core.hpp>
#include <core/engine_logger.hpp>
#include <core/scene/scene_object.hpp>
#include <string>
#include <core/scene/types.hpp>
#include <core/event/event_bus.hpp>
#include <core/scene/game_object.hpp>

namespace atlas {

Expand All @@ -23,30 +21,33 @@ namespace atlas {
* helps manages these scenes and consider them as contexts that can be
* switched/toggled based on users transforms.
*/
class scene_scope {
class scene {
public:
/**
* @param p_name is the name given to this scene
* @param p_bus is the globalized event bus that is given access to the
* scene to subscribe events to it.
*/
scene_scope(const std::string& p_name, event::event_bus& p_bus)
: m_name(p_name)
, m_bus(&p_bus) {}
scene(const std::string& p_name, event::event_bus& p_bus);

virtual ~scene_scope() = default;
virtual ~scene() = default;

/**
* @brief Used to creating a game object
* @brief Retrieves if an entity already exists within the registry,
* create new entity otherwise
*
* @param p_name is specified when creating or searching the object
* @param p_name is a string to set the name of the entity
*/
game_object entity(std::string_view p_name);

/**
* @brief Retrieves if an entity already exists within the registry,
* create new entity otherwise
*
* @return strong_ptr<atlas::scene_object>
* @param p_entity_id is the ID to retrieve an entity if it exists,
* otherwise returns a new entity.
*/
strong_ref<scene_object> create_object(const std::string& p_name) {
return create_strong_ref<scene_object>(
m_allocator, &m_registry, p_name);
}
game_object entity(uint64_t p_id);

/**
* @brief subscribes an event to the event::bus to get invoked when
Expand All @@ -59,6 +60,7 @@ namespace atlas {
* callback belongs to
* @param p_callback is the callback that contains an arbitrary task
* that gets invoked when incoming updates occur from the publisher
*
*/
template<typename UEventType, typename UObject, typename UCallback>
void subscribe(UObject* p_instance, const UCallback& p_callback) {
Expand Down Expand Up @@ -96,11 +98,38 @@ namespace atlas {
std::forward(args)...);
}

/**
* @return the number of children entities
*
* Example Usage:
*
*
* ```C++
*
* atlas::scene scene("New Scene");
*
* // creating obj1 (parent) and obj2 (child)
* atlas::game_object obj1 = scene.create("Parent");
*
* atlas::game_object obj2 = scene.create("Chlid");
*
* // obj2 is the child of obj1
* // As obj1 is a parent node
*
* obj2.child_of(obj1);
*
* // Returns 1
* uint32_t obj1_children = scene.children_count(obj1);
*
* ```
*/
uint32_t children_count(const game_object& p_parent);

/**
* @brief Defer operations until end of frame.
* When this operation is invoked while iterating, operations inbetween
* the defer_begin() and defer_end() operations are executed at the end
* of the frame.
* When this operation is invoked while iterating, operations
* inbetween the defer_begin() and defer_end() operations are executed
* at the end of the frame.
*
* This operation is thread safe.
*
Expand All @@ -120,22 +149,20 @@ namespace atlas {
*/
bool defer_end() { return m_registry.defer_end(); }

//! @return the name of atlas::scene_object
//! @return the name of the scene
[[nodiscard]] std::string name() const { return m_name; }

//! @return the event::bus handle to do the subscription operation of
//! events
//! @return the event::bus handle for subscribing events
[[nodiscard]] event::event_bus* event_handle() const { return m_bus; }

/**
* @brief Requires to return flecs::world is returned by reference to
* prevent making copies of flecs::world
*/
operator world&() { return m_registry; }
operator flecs::world&() { return m_registry; }

private:
std::pmr::polymorphic_allocator<> m_allocator;
world m_registry;
flecs::world m_registry;
std::string m_name;
event::event_bus* m_bus = nullptr;
};
Expand Down
Loading
Loading