61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "openroller/psp/StagePackage.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
namespace openroller::psp {
|
|
|
|
struct Vec3 {
|
|
float x = 0.0f;
|
|
float y = 0.0f;
|
|
float z = 0.0f;
|
|
};
|
|
|
|
struct CameraState {
|
|
Vec3 eye;
|
|
Vec3 target;
|
|
Vec3 up{0.0f, 1.0f, 0.0f};
|
|
float projectionBlend = 0.0f;
|
|
};
|
|
|
|
struct StageView {
|
|
void* storage = nullptr;
|
|
std::size_t storageSize = 0;
|
|
const StagePackageHeader* header = nullptr;
|
|
const PackageTrackPoint* track = nullptr;
|
|
const PackageNote* notes = nullptr;
|
|
const PackageCameraPoint* cameras = nullptr;
|
|
const PackageDrawDistancePoint* drawDistances = nullptr;
|
|
const PackageBackgroundColorPoint* backgroundColors = nullptr;
|
|
const PackageBackgroundModel* backgroundModels = nullptr;
|
|
const PackageBackgroundVertex* backgroundVertices = nullptr;
|
|
const PackageBackgroundObject* backgroundObjects = nullptr;
|
|
const PackageVisibilityKey* visibilityKeys = nullptr;
|
|
const PackageTransformKey* transformKeys = nullptr;
|
|
const PackageObjectColorKey* objectColorKeys = nullptr;
|
|
const PackageParticlePoint* particles = nullptr;
|
|
const PackageVisualizerPoint* visualizer = nullptr;
|
|
const PackageBpmPoint* bpmChanges = nullptr;
|
|
};
|
|
|
|
struct BackgroundColors {
|
|
std::uint32_t topRight = 0;
|
|
std::uint32_t topLeft = 0;
|
|
std::uint32_t bottomRight = 0;
|
|
std::uint32_t bottomLeft = 0;
|
|
};
|
|
|
|
bool loadStagePackage(const char* path, StageView* stage, char* error, std::size_t errorCapacity);
|
|
void unloadStagePackage(StageView* stage);
|
|
|
|
Vec3 trackPositionAt(const StageView& stage, float timeMs);
|
|
Vec3 trackTangentAt(const StageView& stage, float timeMs);
|
|
CameraState evaluateCamera(const StageView& stage, float timeMs);
|
|
BackgroundColors evaluateBackground(const StageView& stage, float timeMs);
|
|
float evaluateDrawAhead(const StageView& stage, float timeMs);
|
|
float evaluateBeatDurationMs(const StageView& stage, float timeMs);
|
|
|
|
} // namespace openroller::psp
|