Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
SequenceTransforms.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "LegacySequence.hpp"
4
5#include <array>
6#include <cstdint>
7#include <expected>
8#include <variant>
9
10namespace monopoly::sequence
11{
12 struct Matrix2D { std::array<float, 9> values{}; };
13 struct Matrix3D { std::array<float, 16> values{}; };
14 using SequenceTransform = std::variant<std::monostate, Matrix2D, Matrix3D>;
15
22
30
36
37 // L_Seqncr.cpp:4755: the first private attribute (130..144) chooses
38 // one effect for the entire tweeker. Only a second key of that same
39 // type participates; dimensionality and filenames do not choose a type.
40 [[nodiscard]] TweekerKeys selectTweekerKeys(
41 const data::LegacySequenceAttributes& attributes) noexcept;
42
43 [[nodiscard]] Matrix2D identity2D() noexcept;
44 [[nodiscard]] Matrix3D identity3D() noexcept;
45 [[nodiscard]] Matrix2D multiply(const Matrix2D& left, const Matrix2D& right) noexcept;
46 [[nodiscard]] Matrix3D multiply(const Matrix3D& left, const Matrix3D& right) noexcept;
47 [[nodiscard]] Matrix2D translate2D(std::int32_t x, std::int32_t y) noexcept;
48 [[nodiscard]] Matrix3D translate3D(float x, float y, float z) noexcept;
49
50 // Portable equivalents of the matrices built by the public legacy
51 // MoveXY and MoveRySTxz helpers. A monostate represents MoveXY's null
52 // matrix, which resets the target rather than applying a zero delta.
54 std::int32_t x, std::int32_t y) noexcept;
55 // LE_SEQNCR_StartCXYSR/MoveXYSR: rotate, then uniform scale, then
56 // translate using ArtLib's row-vector matrix convention.
57 [[nodiscard]] Matrix2D moveXYSRTransform(
58 std::int32_t x, std::int32_t y,
59 float scale, float rotate) noexcept;
60 [[nodiscard]] Matrix3D moveRySTxzTransform(
61 float yaw, float scale, float x, float z) noexcept;
62
63 // StartupSequence dimensionality scan stops at the first child, while
64 // positioning uses the first applicable direct subchunk on either side
65 // of that boundary. Bounds/mesh choice hint dimensions, never matrices.
66 // Unknown/unimplemented attributes are rejected by
67 // SequenceProgram before this runtime conversion is called.
68 [[nodiscard]] InitialSequenceTransform initialSequenceTransform(
69 const data::LegacySequenceRecord& record,
70 const data::LegacySequenceAttributes& attributes,
72
73 // Row-vector convention used by L_Matrix.cpp: local effects are on the
74 // left and the same-dimensional parent's world matrix is on the right.
76 const SequenceTransform& local, std::uint8_t dimensionality,
79
80 [[nodiscard]] std::expected<EvaluatedTweekerTransform, TweekerTransformError>
81 evaluateTweekerTransform(const data::LegacySequenceAttributes& attributes,
82 std::uint8_t interpolationType, std::int32_t clock,
83 std::int32_t endTime, std::uint8_t parentDimensionality) noexcept;
84}
std::atomic< float > left
std::atomic< float > right
unsigned index
float yaw
int z
std::variant< SequenceDimensionalityAttribute, Sequence2DOffsetAttribute, Sequence2DMatrixAttribute, Sequence2DOriginScaleRotateOffsetAttribute, Sequence3DOffsetAttribute, Sequence3DMatrixAttribute, Sequence3DOriginScaleRotateOffsetAttribute, Sequence2DBoundingBoxAttribute, Sequence3DBoundingBoxAttribute, Sequence3DBoundingSphereAttribute, Sequence3DMeshChoiceAttribute, SequenceLabelAttribute, SequenceSoundPitchAttribute, SequenceSoundVolumeAttribute, SequenceSoundPanningAttribute, SequenceCameraFieldOfViewAttribute, SequenceFileNameAttribute, SequenceUnsupportedAttribute > LegacySequenceAttribute
std::expected< EvaluatedTweekerTransform, TweekerTransformError > evaluateTweekerTransform(const data::LegacySequenceAttributes &attributes, std::uint8_t interpolationType, std::int32_t clock, std::int32_t endTime, std::uint8_t parentDimensionality) noexcept
Matrix3D moveRySTxzTransform(float yaw, float scale, float x, float z) noexcept
Matrix2D identity2D() noexcept
Matrix2D translate2D(std::int32_t x, std::int32_t y) noexcept
std::variant< std::monostate, Matrix2D, Matrix3D > SequenceTransform
Matrix3D translate3D(float x, float y, float z) noexcept
TweekerKeys selectTweekerKeys(const data::LegacySequenceAttributes &attributes) noexcept
Matrix2D moveXYSRTransform(std::int32_t x, std::int32_t y, float scale, float rotate) noexcept
SequenceTransform composeSequenceWorld(const SequenceTransform &local, std::uint8_t dimensionality, const SequenceTransform &parentWorld, std::uint8_t parentDimensionality) noexcept
Matrix3D identity3D() noexcept
SequenceTransform moveXYTransform(std::int32_t x, std::int32_t y) noexcept
InitialSequenceTransform initialSequenceTransform(const data::LegacySequenceRecord &record, const data::LegacySequenceAttributes &attributes, std::uint8_t parentDimensionality) noexcept
Matrix2D multiply(const Matrix2D &left, const Matrix2D &right) noexcept
std::array< float, 16 > values
const data::LegacySequenceAttribute * second
const data::LegacySequenceAttribute * first