Files
Renderive/Core/render/Render_Frame_Snapshot.h
T
2026-08-02 18:58:35 +08:00

51 lines
1.7 KiB
C++

#pragma once
#include "../architecture/Update_Completion.h"
#include "../base/Color.h"
#include "../base/Geometry.h"
#include "Renderable_Frame_Node.h"
#include <atomic>
#include <cstdint>
#include <memory>
#include <memory_resource>
#include <vector>
namespace renderive {
struct Frame_Lifecycle_Record;
class Timeline_Stream;
struct Timeline_Stream_Snapshot;
struct Timeline_Stream_Cache_Item {
std::weak_ptr<Timeline_Stream> stream;
int time_point_size = 1;
int tick_space = 1;
bool start_coord_to_end_coord = false;
std::shared_ptr<const Timeline_Stream_Snapshot> snapshot;
};
struct Timeline_Stream_Frame_Cache {
std::vector<Timeline_Stream_Cache_Item> items;
};
struct Render_Frame_Snapshot {
std::shared_ptr<std::atomic_bool> destroying_token;
Size size;
Color background_color = Color::black();
std::uint64_t frame_time_ns{};
std::uint64_t previous_frame_time_ns{};
Frame_Lifecycle_Record* frame_metadata{};
std::pmr::vector<std::shared_ptr<Update_State>>* frame_update_states{};
const Renderable_Frame_Tree* frame_tree{};
mutable std::shared_ptr<Timeline_Stream_Frame_Cache> timeline_cache = std::make_shared<Timeline_Stream_Frame_Cache>();
[[nodiscard]] bool destroying() const;
[[nodiscard]] const Renderable_Frame_Node* find_node(Renderable_Id id) const;
[[nodiscard]] const Renderable_Frame_Node* frame_node_for(const Renderable* renderable) const;
[[nodiscard]] std::shared_ptr<const Timeline_Stream_Snapshot> timeline_snapshot(
const std::shared_ptr<Timeline_Stream>& stream,
int time_point_size,
int label_tick_interval,
bool start_coord_to_end_coord) const;
};
} // namespace renderive