载入中...
搜索中...
未找到
CinemaDirector.h
浏览该文件的文档.
1#pragma once
2
4#include "common/Export.h"
5#include "common/Result.h"
6
7#include <glm/glm.hpp>
8
9#include <string>
10#include <vector>
11
12namespace ssq {
13class Table;
14}
15
16namespace eve::camera {
17
25public:
31 [[nodiscard]] Result<void> bind(CameraController* controller);
33 [[nodiscard]] Result<void> defineOverview(const std::string& name, float eyeX, float eyeY, float eyeZ,
34 float targetX, float targetY, float targetZ, float fov);
39 [[nodiscard]] Result<void> pushOverview(const std::string& name, float blendTime);
44 [[nodiscard]] Result<void> dolly(float distance, float duration);
49 [[nodiscard]] Result<void> crane(float deltaY, float duration);
54 [[nodiscard]] Result<void> orbitReveal(float degrees, float duration);
59 [[nodiscard]] Result<void> pop(float blendTime);
64 [[nodiscard]] Result<void> update(float dt);
66 [[nodiscard]] bool isActive() const noexcept { return !stack_.empty(); }
68 [[nodiscard]] int depth() const noexcept { return static_cast<int>(stack_.size()); }
70 [[nodiscard]] bool isMovePlaying() const noexcept { return move_.active; }
72 [[nodiscard]] std::string getActiveOverview() const;
73
74private:
75 struct OverviewShot {
76 std::string name;
77 glm::vec3 eye{0.f};
78 glm::vec3 target{0.f};
79 float fov = 48.f;
80 };
81
82 struct StackEntry {
83 std::string overview;
84 CameraFramingSnapshot gameplay{};
85 bool ownsGameplay = false;
86 };
87
88 enum class MoveKind { None, Dolly, Crane, OrbitReveal };
89
90 struct MoveState {
91 bool active = false;
92 MoveKind kind = MoveKind::None;
93 float age = 0.f;
94 float duration = 0.f;
95 float param = 0.f;
96 glm::vec3 fromEye{0.f};
97 glm::vec3 fromTarget{0.f};
98 float fromFov = 60.f;
99 glm::vec3 toEye{0.f};
100 glm::vec3 toTarget{0.f};
101 float toFov = 60.f;
102 glm::vec3 orbitCenter{0.f};
103 float orbitRadius = 1.f;
104 float orbitElevation = 0.f;
105 float orbitAzimuth0 = 0.f;
106 };
107
108 [[nodiscard]] Result<void> requireBound() const;
114 [[nodiscard]] const OverviewShot* findOverview(const std::string& name) const;
115 [[nodiscard]] Result<void> applyOverviewPose(const OverviewShot& shot, float blendTime);
116 [[nodiscard]] Result<void> beginMove(MoveKind kind, float duration, float param);
117 void cancelMove();
118 [[nodiscard]] Result<void> sampleLivePose(glm::vec3& eye, glm::vec3& target, float& fov) const;
119 [[nodiscard]] Result<void> writeActivePose(const glm::vec3& eye, const glm::vec3& target, float fov);
120
121 CameraController* controller_ = nullptr;
122 std::vector<OverviewShot> overviews_;
123 std::vector<StackEntry> stack_;
124 MoveState move_{};
125};
126
128void exposeCinemaDirectorBindings(ssq::Table& table);
129
130} // namespace eve::camera
LogicalId target
bool & active
float duration
float degrees
Definition CardTypes.cpp:38
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_WORLD
Definition Export.h:109
float distance
double dt
glm::vec3 eye
Move-only, checked operation results for the common layer.
std::string kind
float targetX
Move-only operation result carrying either a value or Status.
Definition Result.h:176
3D 摄像机控制器(eve.Camera / eve.CameraController)。
Story-scene cinema director that push/pops overview shots and film moves on a CameraController.
bool isActive() const noexcept
True while at least one story shot is on the stack.
bool isMovePlaying() const noexcept
True while a dolly/crane/orbitReveal is in progress.
int depth() const noexcept
Number of stacked story shots.
void exposeCinemaDirectorBindings(ssq::Table &table)
Register CinemaDirector EveScript bindings on the camera module table.
enum EVENGINE_API_FOUNDATION Table
OT_TABLE (editable via Runtime table APIs / ReflectedPropertyModel).
Definition Runtime.h:121
EVEngine ECS 集成层:底层实现使用 sunxfancy/ECS.hpp https://github.com/sunxfancy/ECS.hpp
Definition ECS.h:21