Files
video-shader-toys/apps/LoopThroughWithOpenGLCompositing/ShaderTypes.h
2026-05-04 14:32:29 +10:00

106 lines
2.3 KiB
C++

#pragma once
#include <filesystem>
#include <map>
#include <string>
#include <vector>
#include "AudioSupport.h"
enum class ShaderParameterType
{
Float,
Vec2,
Color,
Boolean,
Enum
};
struct ShaderParameterOption
{
std::string value;
std::string label;
};
struct ShaderParameterDefinition
{
std::string id;
std::string label;
ShaderParameterType type = ShaderParameterType::Float;
std::vector<double> defaultNumbers;
std::vector<double> minNumbers;
std::vector<double> maxNumbers;
std::vector<double> stepNumbers;
bool defaultBoolean = false;
std::string defaultEnumValue;
std::vector<ShaderParameterOption> enumOptions;
};
struct ShaderParameterValue
{
std::vector<double> numberValues;
bool booleanValue = false;
std::string enumValue;
};
enum class TemporalHistorySource
{
None,
Source,
PreLayerInput
};
struct TemporalSettings
{
bool enabled = false;
TemporalHistorySource historySource = TemporalHistorySource::None;
unsigned requestedHistoryLength = 0;
unsigned effectiveHistoryLength = 0;
};
struct ShaderTextureAsset
{
std::string id;
std::filesystem::path path;
std::filesystem::file_time_type writeTime;
};
struct ShaderPackage
{
std::string id;
std::string displayName;
std::string description;
std::string category;
std::string entryPoint;
std::filesystem::path directoryPath;
std::filesystem::path shaderPath;
std::filesystem::path manifestPath;
std::vector<ShaderParameterDefinition> parameters;
std::vector<ShaderTextureAsset> textureAssets;
TemporalSettings temporal;
std::filesystem::file_time_type shaderWriteTime;
std::filesystem::file_time_type manifestWriteTime;
};
struct RuntimeRenderState
{
std::string layerId;
std::string shaderId;
std::vector<ShaderParameterDefinition> parameterDefinitions;
std::map<std::string, ShaderParameterValue> parameterValues;
std::vector<ShaderTextureAsset> textureAssets;
double timeSeconds = 0.0;
double frameCount = 0.0;
double mixAmount = 1.0;
double bypass = 0.0;
unsigned inputWidth = 0;
unsigned inputHeight = 0;
unsigned outputWidth = 0;
unsigned outputHeight = 0;
AudioAnalysisSnapshot audioAnalysis;
bool isTemporal = false;
TemporalHistorySource temporalHistorySource = TemporalHistorySource::None;
unsigned requestedTemporalHistoryLength = 0;
unsigned effectiveTemporalHistoryLength = 0;
};