载入中...
搜索中...
未找到
ParticleTrack.h
浏览该文件的文档.
1#pragma once
2#include <cstdint>
3#include <memory>
4#include <span>
5#include <string_view>
6#include <vector>
7#include "common/Export.h"
8#include "common/Identity.h"
9#include "common/Result.h"
10namespace eve::physics {
11class BakeRecipe;
14 float x = 0, y = 0, w = 0, h = 0, rotation = 0;
15 float r = 1, g = 1, b = 1, a = 1;
16 float u0 = 0, v0 = 0, u1 = 1, v1 = 1;
17};
29 std::uint64_t birthSerial = 0;
30 std::vector<ParticleTrackKey> keys;
31};
43public:
45 [[nodiscard]] bool isSameAsset(const ParticleTrack& other) const noexcept { return data_ == other.data_; }
50 [[nodiscard]] static Result<ParticleTrack> prepare(float duration, std::vector<ParticleTrajectory> trajectories,
51 const BakeRecipe& recipe);
56 [[nodiscard]] Result<void> save(std::string_view path) const;
62 [[nodiscard]] static Result<ParticleTrack> load(std::string_view path);
67 [[nodiscard]] static Result<ParticleTrack> loadForRecipe(std::string_view path, const BakeRecipe& expected);
74 [[nodiscard]] Result<std::size_t> sample(float seconds, std::span<BakedParticleSample> output) const;
76 [[nodiscard]] std::size_t capacity() const noexcept;
78 [[nodiscard]] float duration() const noexcept;
80 [[nodiscard]] std::shared_ptr<const BakeRecipe> recipe() const noexcept;
81
82private:
83 struct Data;
84 explicit ParticleTrack(std::shared_ptr<const Data> data);
85 std::shared_ptr<const Data> data_;
86};
87} // namespace eve::physics
float duration
std::string output
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::uint32_t capacity
Strong identity values shared by persistence, content and logical-name APIs.
BakeRecipe recipe
std::string path
Definition PlayHost.cpp:111
Move-only, checked operation results for the common layer.
Data public API.
Definition Data.h:8
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Id128 public API.
Definition Identity.h:111
Bounded provenance builder for explicit-coordinate baked recordings. @ownership Owns names and conten...
Definition BakeRecipe.h:21
Immutable particle trajectories independent of live simulation, ECS and graphics resources....
bool isSameAsset(const ParticleTrack &other) const noexcept
Whether both views share the same frozen asset; constant-time identity query.
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
Owning planar sprite presentation; pixels, unwrapped degrees, linear RGBA and normalized UV.
Owning visible sample retaining the two-part stable identity.
Explicit event/sample time and owning presentation value.
One birth's complete trajectory, including keys exactly at birth and death.
std::vector< ParticleTrackKey > keys