VJ Master 1.0
Real-time audio analysis and visualisation.
Loading...
Searching...
No Matches
ST_VJ_BoidsRPCS.h
1// Copyright (c) 2025 Aaron Trotter (ShaderTech). All Rights Reserved.
2
3#pragma once
4
5#include "Data/ST_AudioReactiveBoidsLib.h"
6#include "GlobalShader.h"
7#include "ShaderParameterStruct.h"
8
12class FST_VJ_ReactiveBoids_RPInit_CS : public FGlobalShader
13{
14public:
15 DECLARE_GLOBAL_SHADER(FST_VJ_ReactiveBoids_RPInit_CS);
16 SHADER_USE_PARAMETER_STRUCT(FST_VJ_ReactiveBoids_RPInit_CS, FGlobalShader);
17
21 BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
22 SHADER_PARAMETER_RDG_BUFFER_UAV(RWStructuredBuffer<FST_VJ_BoidItem>, boidsOut)
23 SHADER_PARAMETER(uint32, numBoids)
24 SHADER_PARAMETER(float, maxSpeed)
25 SHADER_PARAMETER(uint32, randSeed)
26
27 SHADER_PARAMETER(FMatrix44f, boundsMatrix)
28 SHADER_PARAMETER(FMatrix44f, boundsInverseMatrix)
29 SHADER_PARAMETER(float, boundsRadius)
30 END_SHADER_PARAMETER_STRUCT()
31
32public:
39 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
40
47 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment);
48};
49
53class FST_VJ_ReactiveBoids_RPUpdate_CS : public FGlobalShader
54{
55public:
56 DECLARE_GLOBAL_SHADER(FST_VJ_ReactiveBoids_RPUpdate_CS);
57 SHADER_USE_PARAMETER_STRUCT(FST_VJ_ReactiveBoids_RPUpdate_CS, FGlobalShader);
58
62 BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
63 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<FST_VJ_BoidItem>, boidsIn)
64 SHADER_PARAMETER_RDG_BUFFER_UAV(RWStructuredBuffer<FST_VJ_BoidItem>, boidsOut)
65 SHADER_PARAMETER(uint32, numBoids)
66 SHADER_PARAMETER(float, deltaTime)
67
68 SHADER_PARAMETER(float, minSpeed)
69 SHADER_PARAMETER(float, maxSpeed)
70 SHADER_PARAMETER(float, turnSpeed)
71
72 SHADER_PARAMETER(float, minDistance)
73 SHADER_PARAMETER(float, minDistanceSq)
74 SHADER_PARAMETER(float, cohesionFactor0)
75 SHADER_PARAMETER(float, cohesionFactor1)
76 SHADER_PARAMETER(float, separationFactor0)
77 SHADER_PARAMETER(float, separationFactor1)
78 SHADER_PARAMETER(float, alignmentFactor0)
79 SHADER_PARAMETER(float, alignmentFactor1)
80 SHADER_PARAMETER(float, perlinNoiseForce0)
81 SHADER_PARAMETER(float, perlinNoiseForce1)
82
83 SHADER_PARAMETER(FMatrix44f, boundsMatrix)
84 SHADER_PARAMETER(FMatrix44f, boundsInverseMatrix)
85 SHADER_PARAMETER(float, boundsRadius)
86
87 SHADER_PARAMETER(uint32, IODataSize)
88 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<uint>, IOData)
89 SHADER_PARAMETER(uint32, frequencyBandsLength)
90 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float>, frequencyBands)
91 SHADER_PARAMETER(uint32, amplitudesLength)
92 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float>, amplitudes)
93 SHADER_PARAMETER(uint32, pitchesLength)
94 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float>, pitches)
95 SHADER_PARAMETER(uint32, beatsLength)
96 SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float>, beats)
97
98 SHADER_PARAMETER(float, audio_ReactiveNoise0_Multiplier)
99 SHADER_PARAMETER(uint32, audio_ReactiveNoise0_FrequencyIndex)
100 SHADER_PARAMETER(uint32, audio_ReactiveNoise0_IO)
101 SHADER_PARAMETER(uint32, audio_ReactiveNoise0_Mono)
102 SHADER_PARAMETER(uint32, audio_ReactiveNoise0_ChannelIndex)
103
104 SHADER_PARAMETER(float, audio_ReactiveNoise1_Multiplier)
105 SHADER_PARAMETER(uint32, audio_ReactiveNoise1_FrequencyIndex)
106 SHADER_PARAMETER(uint32, audio_ReactiveNoise1_IO)
107 SHADER_PARAMETER(uint32, audio_ReactiveNoise1_Mono)
108 SHADER_PARAMETER(uint32, audio_ReactiveNoise1_ChannelIndex)
109 END_SHADER_PARAMETER_STRUCT()
110
111public:
118 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
119
126 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment);
127};
Compute shader for initializing reactive boid simulation data.
Definition ST_VJ_BoidsRPCS.h:13
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Shader parameters for initializing reactive boids.
Definition ST_VJ_BoidsRPCS.cpp:12
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Modifies the shader compilation environment before compiling.
Definition ST_VJ_BoidsRPCS.cpp:18
Compute shader for updating reactive boid simulation based on physics and audio input.
Definition ST_VJ_BoidsRPCS.h:54
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Modifies the shader compilation environment before compiling.
Definition ST_VJ_BoidsRPCS.cpp:37
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Shader parameters for updating reactive boids.
Definition ST_VJ_BoidsRPCS.cpp:31