改名
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <renderive/error/Error_Policy.hpp>
|
||||
#include "Point_Scene.h"
|
||||
#include "Render_Scene_3D.h"
|
||||
#include "Scene_Context.hpp"
|
||||
|
||||
#include "detail/Datoviz_Visual_Backend.h"
|
||||
@@ -609,7 +609,7 @@ std::unique_ptr<Scene_Model> make_scene_model(
|
||||
|
||||
} // namespace
|
||||
|
||||
struct Point_Scene::Impl {
|
||||
struct Render_Scene_3D::Impl {
|
||||
explicit Impl(const Scene_Options& options,
|
||||
std::shared_ptr<Point_Visual> visual)
|
||||
: model(make_scene_model(options, std::move(visual))) {}
|
||||
@@ -617,7 +617,7 @@ struct Point_Scene::Impl {
|
||||
std::unique_ptr<Scene_Model> model;
|
||||
};
|
||||
|
||||
Point_Scene::Point_Scene(Scene_Options options,
|
||||
Render_Scene_3D::Render_Scene_3D(Scene_Options options,
|
||||
std::shared_ptr<Point_Visual> visual) {
|
||||
if (!valid(options.viewport))
|
||||
::renderive::error::unexpected<std::invalid_argument>("Point_Scene viewport must be nonempty");
|
||||
@@ -630,26 +630,26 @@ Point_Scene::Point_Scene(Scene_Options options,
|
||||
impl_ = std::make_unique<Impl>(options, std::move(visual));
|
||||
}
|
||||
|
||||
Point_Scene::~Point_Scene() = default;
|
||||
Render_Scene_3D::~Render_Scene_3D() = default;
|
||||
|
||||
Scene_Control_Error Point_Scene::resize(Extent extent) {
|
||||
Scene_Control_Error Render_Scene_3D::resize(Extent extent) {
|
||||
if (!valid(extent))
|
||||
return Scene_Control_Error::empty_viewport;
|
||||
impl_->model->resize(extent);
|
||||
return Scene_Control_Error::none;
|
||||
}
|
||||
Scene_Control_Error Point_Scene::set_clear_color(Clear_Color color) {
|
||||
Scene_Control_Error Render_Scene_3D::set_clear_color(Clear_Color color) {
|
||||
if (!valid(color))
|
||||
return Scene_Control_Error::invalid_clear_color;
|
||||
impl_->model->set_clear_color(color);
|
||||
return Scene_Control_Error::none;
|
||||
}
|
||||
|
||||
Scene_Control_Error Point_Scene::dispatch(const ::renderive::Event&) {
|
||||
Scene_Control_Error Render_Scene_3D::dispatch(const ::renderive::Event&) {
|
||||
return Scene_Control_Error::none;
|
||||
}
|
||||
|
||||
Scene_Control_Error Point_Scene::dispatch_pointer(
|
||||
Scene_Control_Error Render_Scene_3D::dispatch_pointer(
|
||||
::renderive::Event_Type type, float x, float y,
|
||||
::renderive::Mouse_Button button, ::renderive::Mouse_Button_Mask,
|
||||
::renderive::Keyboard_Modifier modifiers) {
|
||||
@@ -662,7 +662,7 @@ Scene_Control_Error Point_Scene::dispatch_pointer(
|
||||
return impl_->model->dispatch_pointer(type, x, y, button, modifiers);
|
||||
}
|
||||
|
||||
Scene_Control_Error Point_Scene::dispatch_wheel(
|
||||
Scene_Control_Error Render_Scene_3D::dispatch_wheel(
|
||||
float x, float y, float pixel_delta_x, float pixel_delta_y,
|
||||
float angle_delta_x, float angle_delta_y,
|
||||
::renderive::Keyboard_Modifier modifiers) {
|
||||
@@ -675,39 +675,39 @@ Scene_Control_Error Point_Scene::dispatch_wheel(
|
||||
datoviz_wheel_step(pixel_delta_y, angle_delta_y), modifiers);
|
||||
}
|
||||
|
||||
Scene_Control_Error Point_Scene::dispatch(const ::renderive::Key_Event& event) {
|
||||
Scene_Control_Error Render_Scene_3D::dispatch(const ::renderive::Key_Event& event) {
|
||||
return impl_->model->dispatch_key(event);
|
||||
}
|
||||
|
||||
Frame_Request_Result Point_Scene::prepare_frame() { return impl_->model->prepare_frame(); }
|
||||
Frame_Request_Result Point_Scene::refresh_manual_frame() {
|
||||
Frame_Request_Result Render_Scene_3D::prepare_frame() { return impl_->model->prepare_frame(); }
|
||||
Frame_Request_Result Render_Scene_3D::refresh_manual_frame() {
|
||||
return impl_->model->refresh_manual_frame();
|
||||
}
|
||||
bool Point_Scene::discard_pending_frame() {
|
||||
bool Render_Scene_3D::discard_pending_frame() {
|
||||
return impl_->model->discard_pending_frame();
|
||||
}
|
||||
Frame_Request_Result Point_Scene::render_prepared_frame() {
|
||||
Frame_Request_Result Render_Scene_3D::render_prepared_frame() {
|
||||
return impl_->model->render_prepared_frame();
|
||||
}
|
||||
Frame_Request_Result Point_Scene::request_frame() { return impl_->model->request_frame(); }
|
||||
Frame_Request_Result Render_Scene_3D::request_frame() { return impl_->model->request_frame(); }
|
||||
|
||||
std::shared_ptr<const Pixel_Frame> Point_Scene::latest_frame() const {
|
||||
std::shared_ptr<const Pixel_Frame> Render_Scene_3D::latest_frame() const {
|
||||
return impl_->model->latest_frame();
|
||||
}
|
||||
|
||||
Frame_Status Point_Scene::frame_status() const {
|
||||
Frame_Status Render_Scene_3D::frame_status() const {
|
||||
return impl_->model->frame_status();
|
||||
}
|
||||
|
||||
Runtime_Statistics Point_Scene::runtime_statistics() const noexcept {
|
||||
Runtime_Statistics Render_Scene_3D::runtime_statistics() const noexcept {
|
||||
return impl_->model->runtime_statistics();
|
||||
}
|
||||
|
||||
Scene_Base& Point_Scene::render_scene() noexcept {
|
||||
Scene_Base& Render_Scene_3D::render_scene() noexcept {
|
||||
return impl_->model->scene();
|
||||
}
|
||||
|
||||
const Scene_Base& Point_Scene::render_scene() const noexcept {
|
||||
const Scene_Base& Render_Scene_3D::render_scene() const noexcept {
|
||||
return impl_->model->scene();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "Point_Visual.h"
|
||||
|
||||
#include <renderive/event/Event.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class Scene_Base;
|
||||
|
||||
namespace renderive::render_3d {
|
||||
|
||||
struct Extent {
|
||||
std::uint32_t width{};
|
||||
std::uint32_t height{};
|
||||
[[nodiscard]] constexpr bool empty() const noexcept { return width == 0 || height == 0; }
|
||||
[[nodiscard]] constexpr bool empty() const noexcept {
|
||||
return width == 0 || height == 0;
|
||||
}
|
||||
bool operator==(const Extent&) const = default;
|
||||
};
|
||||
|
||||
struct Clear_Color {
|
||||
float red{0.035F};
|
||||
float green{0.045F};
|
||||
@@ -45,13 +40,11 @@ enum class Frame_Request_Result : std::uint8_t {
|
||||
external_failure,
|
||||
scene_shutting_down
|
||||
};
|
||||
|
||||
enum class Frame_Mode : std::uint8_t {
|
||||
Manual,
|
||||
Low_Latency,
|
||||
Playback,
|
||||
};
|
||||
|
||||
enum struct Visual_Family : std::uint8_t {
|
||||
Point,
|
||||
Splat,
|
||||
@@ -69,7 +62,6 @@ enum struct Visual_Family : std::uint8_t {
|
||||
Text,
|
||||
Volume,
|
||||
};
|
||||
|
||||
struct Scene_Options {
|
||||
Extent viewport{560, 320};
|
||||
Clear_Color clear_color;
|
||||
@@ -79,13 +71,11 @@ struct Scene_Options {
|
||||
bool validation_enabled{};
|
||||
Visual_Family visual_family{Visual_Family::Point};
|
||||
};
|
||||
|
||||
struct Pixel_Frame {
|
||||
Extent extent;
|
||||
std::uint64_t sequence{};
|
||||
std::vector<std::byte> rgba8;
|
||||
};
|
||||
|
||||
struct Runtime_Admission_Statistics {
|
||||
std::size_t capacity{};
|
||||
std::size_t active{};
|
||||
@@ -95,14 +85,12 @@ struct Runtime_Admission_Statistics {
|
||||
std::uint64_t backpressure_count{};
|
||||
std::uint64_t backpressure_wait_ns{};
|
||||
};
|
||||
|
||||
struct Runtime_Statistics {
|
||||
Runtime_Admission_Statistics render_domain;
|
||||
Runtime_Admission_Statistics gpu_completion;
|
||||
std::uint64_t gpu_completion_fault_count{};
|
||||
std::uint64_t gpu_completion_abandoned_count{};
|
||||
};
|
||||
|
||||
struct Frame_Status {
|
||||
Frame_Mode mode{Frame_Mode::Low_Latency};
|
||||
double frequency_hz{};
|
||||
@@ -114,22 +102,18 @@ struct Frame_Status {
|
||||
std::uint64_t latest_sequence{};
|
||||
std::uint64_t next_refresh_interval_ns{};
|
||||
};
|
||||
|
||||
// Owns frame scheduling and the single Datoviz mutation/render domain.
|
||||
class Point_Scene final {
|
||||
class Render_Scene_3D final {
|
||||
public:
|
||||
Point_Scene(Scene_Options options, std::shared_ptr<Point_Visual> visual);
|
||||
~Point_Scene();
|
||||
|
||||
Point_Scene(const Point_Scene&) = delete;
|
||||
Point_Scene& operator=(const Point_Scene&) = delete;
|
||||
Point_Scene(Point_Scene&&) = delete;
|
||||
Point_Scene& operator=(Point_Scene&&) = delete;
|
||||
|
||||
Render_Scene_3D(Scene_Options options, std::shared_ptr<Point_Visual> visual);
|
||||
~Render_Scene_3D();
|
||||
Render_Scene_3D(const Render_Scene_3D&) = delete;
|
||||
Render_Scene_3D& operator=(const Render_Scene_3D&) = delete;
|
||||
Render_Scene_3D(Render_Scene_3D&&) = delete;
|
||||
Render_Scene_3D& operator=(Render_Scene_3D&&) = delete;
|
||||
[[nodiscard]] Scene_Control_Error resize(Extent extent);
|
||||
[[nodiscard]] Scene_Control_Error set_clear_color(Clear_Color color);
|
||||
[[nodiscard]] Scene_Control_Error dispatch(const ::renderive::Event& event);
|
||||
|
||||
template <::renderive::Event_Point Point_Type>
|
||||
[[nodiscard]] Scene_Control_Error dispatch(
|
||||
const ::renderive::Basic_Pointer_Event<Point_Type>& event) {
|
||||
@@ -137,7 +121,6 @@ public:
|
||||
static_cast<float>(event.position.y), event.button,
|
||||
event.buttons, event.modifiers);
|
||||
}
|
||||
|
||||
template <::renderive::Event_Point Point_Type>
|
||||
[[nodiscard]] Scene_Control_Error dispatch(
|
||||
const ::renderive::Basic_Wheel_Event<Point_Type>& event) {
|
||||
@@ -148,34 +131,28 @@ public:
|
||||
static_cast<float>(event.angle_delta_x),
|
||||
static_cast<float>(event.angle_delta_y), event.modifiers);
|
||||
}
|
||||
|
||||
[[nodiscard]] Scene_Control_Error dispatch(const ::renderive::Key_Event& event);
|
||||
|
||||
// Frame strategy operations. request_frame() is the complete low-latency path.
|
||||
[[nodiscard]] Frame_Request_Result prepare_frame();
|
||||
[[nodiscard]] Frame_Request_Result refresh_manual_frame();
|
||||
[[nodiscard]] bool discard_pending_frame();
|
||||
[[nodiscard]] Frame_Request_Result render_prepared_frame();
|
||||
[[nodiscard]] Frame_Request_Result request_frame();
|
||||
|
||||
[[nodiscard]] std::shared_ptr<const Pixel_Frame> latest_frame() const;
|
||||
[[nodiscard]] Frame_Status frame_status() const;
|
||||
[[nodiscard]] Runtime_Statistics runtime_statistics() const noexcept;
|
||||
[[nodiscard]] Scene_Base& render_scene() noexcept;
|
||||
[[nodiscard]] const Scene_Base& render_scene() const noexcept;
|
||||
|
||||
private:
|
||||
[[nodiscard]] Scene_Control_Error dispatch_pointer(::renderive::Event_Type type, float x, float y,
|
||||
::renderive::Mouse_Button button,
|
||||
::renderive::Mouse_Button_Mask buttons,
|
||||
::renderive::Keyboard_Modifier modifiers);
|
||||
::renderive::Mouse_Button button,
|
||||
::renderive::Mouse_Button_Mask buttons,
|
||||
::renderive::Keyboard_Modifier modifiers);
|
||||
[[nodiscard]] Scene_Control_Error dispatch_wheel(float x, float y, float pixel_delta_x,
|
||||
float pixel_delta_y, float angle_delta_x,
|
||||
float angle_delta_y,
|
||||
::renderive::Keyboard_Modifier modifiers);
|
||||
|
||||
float pixel_delta_y, float angle_delta_x,
|
||||
float angle_delta_y,
|
||||
::renderive::Keyboard_Modifier modifiers);
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
|
||||
} // namespace renderive::render_3d
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "render_3D/Point_Scene.h"
|
||||
#include "render_3D/Render_Scene_3D.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "render_3D/Point_Scene.h"
|
||||
#include "render_3D/Render_Scene_3D.h"
|
||||
|
||||
#include <renderive/scene/base/Scene_Base.hpp>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace {
|
||||
|
||||
struct Test_Point_Scene {
|
||||
std::shared_ptr<Point_Visual> visual;
|
||||
std::unique_ptr<Point_Scene> scene;
|
||||
std::unique_ptr<Render_Scene_3D> scene;
|
||||
};
|
||||
|
||||
Test_Point_Scene make_test_scene(Scene_Options options) {
|
||||
@@ -31,7 +31,7 @@ Test_Point_Scene make_test_scene(Scene_Options options) {
|
||||
Point_State state;
|
||||
state.style = {{12, 16, 24, 255}, 2.0F, Point_Aspect::Outline};
|
||||
auto visual = Point_Visual::Builder{state}.build(std::move(points));
|
||||
auto scene = std::make_unique<Point_Scene>(options, visual);
|
||||
auto scene = std::make_unique<Render_Scene_3D>(options, visual);
|
||||
return {std::move(visual), std::move(scene)};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user