62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
#pragma once
|
|
#include "../base/Color.h"
|
|
#include "../base/Geometry.h"
|
|
#include "Frame_Scheduler.h"
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <memory_resource>
|
|
#include <vector>
|
|
|
|
namespace renderive {
|
|
|
|
class Plot_Core;
|
|
class Timeline_Stream;
|
|
struct Update_State;
|
|
|
|
struct Frame_Lifecycle_Observer {
|
|
virtual ~Frame_Lifecycle_Observer() = default;
|
|
virtual bool enabled() const = 0;
|
|
virtual void collect_frame(const Frame_Lifecycle_Record& frame) = 0;
|
|
};
|
|
|
|
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 Plot_Render_Context {
|
|
std::atomic_bool destroying{false};
|
|
std::atomic_bool first_resize{true};
|
|
std::atomic_bool first_prepare_data{true};
|
|
std::atomic_int render_width{0};
|
|
std::atomic_int render_height{0};
|
|
std::atomic<std::uint32_t> background_rgba{0xff000000u};
|
|
std::shared_ptr<Frame_Lifecycle_Observer> frame_lifecycle_observer;
|
|
std::atomic<Plot_Core*> owner{};
|
|
};
|
|
|
|
struct Plot_Render_Snapshot {
|
|
std::shared_ptr<Plot_Render_Context> context;
|
|
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{};
|
|
mutable std::shared_ptr<Timeline_Stream_Frame_Cache> timeline_cache = std::make_shared<Timeline_Stream_Frame_Cache>();
|
|
bool destroying() const {
|
|
return !context || context->destroying.load(std::memory_order_acquire);
|
|
}
|
|
std::shared_ptr<const Timeline_Stream_Snapshot> timeline_snapshot(const std::shared_ptr<Timeline_Stream>& stream, int time_point_size, int tick_space, bool start_coord_to_end_coord) const;
|
|
};
|
|
|
|
} // namespace renderive
|