载入中...
搜索中...
未找到
EffectShaders.cpp
浏览该文件的文档.
2
3#include "common/Exception.h"
4#include "graphics/Graphics.h"
5#include "graphics/Shader.h"
6#include "graphics/shaders/mesh3d_toon_vert_spv.inc"
7#include "stylize/shaders/chromatic_post_frag_spv.inc"
8#include "stylize/shaders/dissolve_mesh_frag_spv.inc"
9#include "stylize/shaders/glitch_analog_post_frag_spv.inc"
10#include "stylize/shaders/glitch_block_post_frag_spv.inc"
11#include "stylize/shaders/glitch_wave_post_frag_spv.inc"
12#include "stylize/shaders/grain_post_frag_spv.inc"
13#include "stylize/shaders/kuwahara_post_frag_spv.inc"
14#include "stylize/shaders/kuwahara_aniso_post_frag_spv.inc"
15#include "stylize/shaders/dog_post_frag_spv.inc"
16#include "stylize/shaders/sharpen_post_frag_spv.inc"
17#include "stylize/shaders/neon_edge_post_frag_spv.inc"
18#include "stylize/shaders/hologram_mesh_frag_spv.inc"
19#include "stylize/shaders/slash_mesh_frag_spv.inc"
20#include "stylize/shaders/ember_mesh_frag_spv.inc"
21#include "stylize/shaders/aura_mesh_frag_spv.inc"
22#include "stylize/shaders/rim_mesh_frag_spv.inc"
23#include "stylize/shaders/snow_mesh_frag_spv.inc"
24#include "stylize/shaders/vignette_post_frag_spv.inc"
25
26#include <algorithm>
27#include <cstddef>
28#include <vector>
29
30namespace eve::stylize {
31namespace {
32
33// Mesh effect styles (reuse mesh3d_toon.vert; no scene buffers needed).
34const StyleDefinition kMeshEffects[] = {
35 {"rim", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 40},
36 {"dissolve", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 41},
37 {"hologram", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 42},
38 {"snow", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 43},
39 {"slash", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 44},
40 {"ember", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 45},
41 {"aura", false, true, false, false, false, graphics::PostEffectStage::AfterOpaque, 46},
42};
43
44// Post effect styles (full-screen passes, color input only).
45const StyleDefinition kPostEffects[] = {
46 {"vignette", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 260},
47 {"chromatic", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 270},
48 {"grain", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 280},
49 {"glitchAnalog", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 290},
50 {"glitchBlock", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 300},
51 {"glitchWave", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 310},
52 {"kuwahara", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 220},
53 {"kuwaharaAniso", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 225},
54 {"dog", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 230},
55 {"sharpen", true, false, false, false, false, graphics::PostEffectStage::AfterTonemap, 240},
56 // BeforeTonemap so neon edges sit with cartoon/ink outline peers (port program Wave 2).
57 {"neonEdge", true, false, false, false, false, graphics::PostEffectStage::BeforeTonemap, 120},
58};
59
60const StyleParameterDesc kRimParams[] = {
61 {"colorR", 0.4f, 0.f, 2.f}, {"colorG", 0.6f, 0.f, 2.f}, {"colorB", 1.f, 0.f, 2.f},
62 {"rimPower", 3.f, 0.1f, 16.f}, {"rimIntensity", 1.f, 0.f, 4.f}, {"rimMix", 1.f, 0.f, 1.f},
63 {"ambientStrength", 0.15f, 0.f, 1.f}, {"baseLight", 1.f, 0.f, 3.f},
64};
65
66const StyleParameterDesc kDissolveParams[] = {
67 {"amount", 0.5f, 0.f, 1.f}, {"edgeWidth", 0.1f, 0.01f, 0.5f}, {"edgeColorR", 1.f, 0.f, 2.f},
68 {"edgeColorG", 0.5f, 0.f, 2.f}, {"edgeColorB", 0.1f, 0.f, 2.f}, {"edgeGlow", 2.f, 0.f, 6.f},
69 {"noiseScale", 2.f, 0.1f, 16.f}, {"hardness", 0.5f, 0.f, 1.f},
70};
71
72const StyleParameterDesc kHologramParams[] = {
73 {"colorR", 0.2f, 0.f, 2.f}, {"colorG", 0.9f, 0.f, 2.f}, {"colorB", 1.f, 0.f, 2.f},
74 {"fresnelStrength", 1.f, 0.f, 4.f}, {"scanDensity", 8.f, 1.f, 48.f}, {"scanIntensity", 0.5f, 0.f, 1.f},
75 {"flicker", 0.3f, 0.f, 1.f}, {"alphaBase", 0.35f, 0.f, 1.f}, {"glitchAmplitude", 0.15f, 0.f, 1.f},
76};
77
78const StyleParameterDesc kSnowParams[] = {
79 {"snowAmount", 0.9f, 0.f, 1.f}, {"snowHardness", 0.5f, 0.f, 1.f}, {"snowColorR", 0.93f, 0.f, 1.f},
80 {"snowColorG", 0.95f, 0.f, 1.f}, {"snowColorB", 0.98f, 0.f, 1.f}, {"noiseScale", 3.f, 0.1f, 16.f},
81 {"snowHeight", 0.f, -1000.f, 1000.f}, {"heightFade", 4.f, 0.1f, 100.f},
82};
83
84const StyleParameterDesc kSlashParams[] = {
85 {"coreR", 0.85f, 0.f, 2.f}, {"coreG", 0.95f, 0.f, 2.f}, {"coreB", 1.0f, 0.f, 2.f},
86 {"edgeR", 1.0f, 0.f, 2.f}, {"edgeG", 0.4f, 0.f, 2.f}, {"edgeB", 0.2f, 0.0f, 2.f},
87 {"intensity", 1.6f, 0.f, 4.f}, {"width", 0.06f, 0.005f, 0.3f}, {"softness", 0.12f, 0.001f, 0.5f},
88 {"noiseScale", 4.f, 0.1f, 20.f}, {"time", 0.f, 0.f, 120.f}, {"speed", 0.9f, 0.f, 3.f},
89 {"flowWarp", 0.35f, 0.f, 2.f}, {"edgeDistortion", 0.08f, 0.f, 0.5f},
90 {"depthSoftness", 0.004f, 0.0001f, 0.1f}, {"intersectionWidth", 0.006f, 0.0001f, 0.1f},
91 {"intersectionGlow", 0.8f, 0.f, 4.f},
92 {"refractionStrength", 0.f, 0.f, 1.f},
93};
94
95const StyleParameterDesc kEmberParams[] = {
96 {"coreR", 1.0f, 0.f, 2.f}, {"coreG", 0.35f, 0.f, 2.f}, {"coreB", 0.08f, 0.f, 2.f},
97 {"flareR", 1.0f, 0.f, 2.f}, {"flareG", 0.58f, 0.f, 2.f}, {"flareB", 0.2f, 0.f, 2.f},
98 {"burnAmount", 0.68f, 0.f, 1.f}, {"flicker", 0.5f, 0.f, 1.f}, {"noiseScale", 2.5f, 0.1f, 16.f},
99 {"hardness", 0.6f, 0.f, 1.f}, {"time", 0.f, 0.f, 120.f},
100};
101
102const StyleParameterDesc kAuraParams[] = {
103 {"auraR", 0.24f, 0.f, 2.f}, {"auraG", 0.62f, 0.f, 2.f}, {"auraB", 1.f, 0.f, 2.f},
104 {"pulse", 1.1f, 0.f, 4.f}, {"edge", 2.f, 0.1f, 8.f}, {"radius", 0.65f, 0.1f, 2.f},
105 {"noiseScale", 3.f, 0.1f, 16.f}, {"time", 0.f, 0.f, 120.f}, {"intensity", 1.1f, 0.f, 4.f},
106};
107
108const StyleParameterDesc kVignetteParams[] = {
109 {"strength", 0.5f, 0.f, 1.f}, {"smoothness", 0.5f, 0.01f, 1.f}, {"roundness", 0.5f, 0.f, 1.f},
110 {"colorR", 0.f, 0.f, 1.f}, {"colorG", 0.f, 0.f, 1.f}, {"colorB", 0.f, 0.f, 1.f},
111};
112
113const StyleParameterDesc kChromaticParams[] = {
114 {"strength", 0.3f, 0.f, 1.f},
115 {"radialMix", 1.f, 0.f, 1.f},
116 {"rgbSplit", 0.5f, 0.f, 1.f},
117};
118
119const StyleParameterDesc kGrainParams[] = {
120 {"strength", 0.15f, 0.f, 1.f},
121 {"grainSize", 4.f, 1.f, 32.f},
122 {"lumaAmount", 0.7f, 0.f, 1.f},
123 {"colorAmount", 0.1f, 0.f, 1.f},
124};
125
126// Defaults keep the pass near-identity until knobs are raised (DoD: strength 0
127// or all knobs 0 ≈ passthrough). Artistic ranges match KinoGlitch public API.
128const StyleParameterDesc kGlitchAnalogParams[] = {
129 {"strength", 1.f, 0.f, 1.f}, {"scanLineJitter", 0.f, 0.f, 1.f},
130 {"verticalJump", 0.f, 0.f, 1.f}, {"horizontalShake", 0.f, 0.f, 1.f},
131 {"colorDrift", 0.f, 0.f, 1.f}, {"time", 0.f, 0.f, 120.f},
132};
133
134// Digital block damage. intensity mirrors Kino DigitalGlitch; cell counts default
135// to the original 64×32 noise atlas. Trash history is approximated in-shader.
136const StyleParameterDesc kGlitchBlockParams[] = {
137 {"strength", 1.f, 0.f, 1.f}, {"intensity", 0.f, 0.f, 1.f}, {"time", 0.f, 0.f, 120.f},
138 {"cellCountX", 64.f, 4.f, 256.f}, {"cellCountY", 32.f, 4.f, 256.f},
139};
140
141// XPL WaveJitter. amount default 0 → near-identity; screenW/H appended in bind.
142const StyleParameterDesc kGlitchWaveParams[] = {
143 {"strength", 1.f, 0.f, 1.f}, {"amount", 0.f, 0.f, 2.f}, {"frequency", 5.f, 0.f, 50.f},
144 {"rgbSplit", 20.f, 0.f, 50.f}, {"speed", 0.25f, 0.f, 1.f}, {"direction", 0.f, 0.f, 1.f},
145 {"infiniteFreq", 0.f, 0.f, 1.f}, {"time", 0.f, 0.f, 120.f},
146};
147
148// Acerola basic Kuwahara. strength 0 → identity; texelW/H appended in bind.
149// kernelSize capped at 8 in the shader for SPIR-V loop bounds / cost.
150const StyleParameterDesc kKuwaharaParams[] = {
151 {"strength", 0.f, 0.f, 1.f},
152 {"kernelSize", 3.f, 1.f, 8.f},
153};
154
155// Acerola anisotropic Kuwahara (fused). strength 0 → identity; texelW/H in bind.
156// zeta 0 → auto 2/kernelSize (Acerola useZeta=false path). Diameter capped at 8.
157const StyleParameterDesc kKuwaharaAnisoParams[] = {
158 {"strength", 0.f, 0.f, 1.f}, {"kernelSize", 4.f, 2.f, 8.f}, {"sharpness", 8.f, 1.f, 18.f},
159 {"hardness", 8.f, 1.f, 100.f}, {"alpha", 1.f, 0.01f, 2.f}, {"zeroCrossing", 0.58f, 0.01f, 2.f},
160 {"zeta", 0.f, 0.f, 3.f},
161};
162
163// Acerola Difference of Gaussians. strength 0 → identity; texelW/H in bind.
164// thresholding/useTanh/invert are 0/1 flags (float knobs for push-constant layout).
165const StyleParameterDesc kDogParams[] = {
166 {"strength", 0.f, 0.f, 1.f}, {"kernelSize", 5.f, 1.f, 8.f}, {"sigma", 2.f, 0.1f, 5.f},
167 {"k", 1.6f, 0.1f, 5.f}, {"tau", 1.f, 0.01f, 5.f}, {"thresholding", 1.f, 0.f, 1.f},
168 {"useTanh", 0.f, 0.f, 1.f}, {"phi", 1.f, 0.01f, 100.f}, {"threshold", 0.005f, -1.f, 1.f},
169 {"invert", 0.f, 0.f, 1.f},
170};
171
172// Acerola Contrast Adaptive Sharpening. strength 0 → identity; texelW/H in bind.
173// amount maps to CAS sharpness lerp(10,7); CAS alone is never identity.
174const StyleParameterDesc kSharpenParams[] = {
175 {"strength", 0.f, 0.f, 1.f},
176 {"amount", 0.5f, 0.f, 1.f},
177};
178
179// XPL EdgeDetectionSobelNeonV2. strength 0 → identity; screenW/H appended in bind.
180// RGB Sobel gradients → colorful neon edges (not luma-only V1).
181const StyleParameterDesc kNeonEdgeParams[] = {
182 {"strength", 0.f, 0.f, 1.f}, {"edgeWidth", 1.f, 0.05f, 5.f}, {"neonFade", 1.f, 0.1f, 1.f},
183 {"brightness", 1.f, 0.2f, 2.f}, {"backgroundFade", 0.f, 0.f, 1.f},
184 {"bgR", 0.f, 0.f, 1.f}, {"bgG", 0.f, 0.f, 1.f}, {"bgB", 0.f, 0.f, 1.f},
185};
186
187const StyleDefinition* findMesh(const std::string& style) {
188 for (const auto& d : kMeshEffects)
189 if (style == d.id) return &d;
190 return nullptr;
191}
192const StyleDefinition* findPost(const std::string& style) {
193 for (const auto& d : kPostEffects)
194 if (style == d.id) return &d;
195 return nullptr;
196}
197
198template <size_t N>
199const StyleParameterDesc* paramAt(const StyleParameterDesc (&arr)[N], int index) {
200 return index < 0 || index >= int(N) ? nullptr : &arr[size_t(index)];
201}
202
203int meshParamCount(const std::string& style) {
204 if (style == "rim") return int(sizeof(kRimParams) / sizeof(kRimParams[0]));
205 if (style == "dissolve") return int(sizeof(kDissolveParams) / sizeof(kDissolveParams[0]));
206 if (style == "hologram") return int(sizeof(kHologramParams) / sizeof(kHologramParams[0]));
207 if (style == "snow") return int(sizeof(kSnowParams) / sizeof(kSnowParams[0]));
208 if (style == "slash") return int(sizeof(kSlashParams) / sizeof(kSlashParams[0]));
209 if (style == "ember") return int(sizeof(kEmberParams) / sizeof(kEmberParams[0]));
210 if (style == "aura") return int(sizeof(kAuraParams) / sizeof(kAuraParams[0]));
211 return 0;
212}
213const StyleParameterDesc* meshParamAt(const std::string& style, int index) {
214 if (style == "rim") return paramAt(kRimParams, index);
215 if (style == "dissolve") return paramAt(kDissolveParams, index);
216 if (style == "hologram") return paramAt(kHologramParams, index);
217 if (style == "snow") return paramAt(kSnowParams, index);
218 if (style == "slash") return paramAt(kSlashParams, index);
219 if (style == "ember") return paramAt(kEmberParams, index);
220 if (style == "aura") return paramAt(kAuraParams, index);
221 return nullptr;
222}
223int postParamCount(const std::string& style) {
224 if (style == "vignette") return int(sizeof(kVignetteParams) / sizeof(kVignetteParams[0]));
225 if (style == "chromatic") return int(sizeof(kChromaticParams) / sizeof(kChromaticParams[0]));
226 if (style == "grain") return int(sizeof(kGrainParams) / sizeof(kGrainParams[0]));
227 if (style == "glitchAnalog") return int(sizeof(kGlitchAnalogParams) / sizeof(kGlitchAnalogParams[0]));
228 if (style == "glitchBlock") return int(sizeof(kGlitchBlockParams) / sizeof(kGlitchBlockParams[0]));
229 if (style == "glitchWave") return int(sizeof(kGlitchWaveParams) / sizeof(kGlitchWaveParams[0]));
230 if (style == "kuwahara") return int(sizeof(kKuwaharaParams) / sizeof(kKuwaharaParams[0]));
231 if (style == "kuwaharaAniso") return int(sizeof(kKuwaharaAnisoParams) / sizeof(kKuwaharaAnisoParams[0]));
232 if (style == "dog") return int(sizeof(kDogParams) / sizeof(kDogParams[0]));
233 if (style == "sharpen") return int(sizeof(kSharpenParams) / sizeof(kSharpenParams[0]));
234 if (style == "neonEdge") return int(sizeof(kNeonEdgeParams) / sizeof(kNeonEdgeParams[0]));
235 return 0;
236}
237const StyleParameterDesc* postParamAt(const std::string& style, int index) {
238 if (style == "vignette") return paramAt(kVignetteParams, index);
239 if (style == "chromatic") return paramAt(kChromaticParams, index);
240 if (style == "grain") return paramAt(kGrainParams, index);
241 if (style == "glitchAnalog") return paramAt(kGlitchAnalogParams, index);
242 if (style == "glitchBlock") return paramAt(kGlitchBlockParams, index);
243 if (style == "glitchWave") return paramAt(kGlitchWaveParams, index);
244 if (style == "kuwahara") return paramAt(kKuwaharaParams, index);
245 if (style == "kuwaharaAniso") return paramAt(kKuwaharaAnisoParams, index);
246 if (style == "dog") return paramAt(kDogParams, index);
247 if (style == "sharpen") return paramAt(kSharpenParams, index);
248 if (style == "neonEdge") return paramAt(kNeonEdgeParams, index);
249 return nullptr;
250}
251
252// The push-constant layout index of a param equals its position in the param
253// array, so bind in array order.
254void bindParamArray(graphics::Shader* shader, const std::string& style, bool mesh) {
255 if (!shader) throw eve::Exception("bindParamArray: null shader");
256 int n = mesh ? meshParamCount(style) : postParamCount(style);
257 for (int i = 0; i < n; ++i) {
258 const StyleParameterDesc* d = mesh ? meshParamAt(style, i) : postParamAt(style, i);
259 if (!d) break;
260 shader->declareFloat(d->id);
261 shader->sendFloat(d->id, d->defaultValue);
262 }
263}
264
265std::vector<uint32_t> copySpv(const uint32_t* data, size_t count) { return std::vector<uint32_t>(data, data + count); }
266
267} // namespace
268
269bool isEffectStyle(const std::string& style) { return findMesh(style) != nullptr || findPost(style) != nullptr; }
270
271const StyleDefinition* findEffectDefinition(const std::string& style) {
272 if (const StyleDefinition* d = findMesh(style)) return d;
273 return findPost(style);
274}
275
277 return int(sizeof(kMeshEffects) / sizeof(kMeshEffects[0])) + int(sizeof(kPostEffects) / sizeof(kPostEffects[0]));
278}
279
280std::string effectStyleIdAt(int index) {
281 const int meshCount = int(sizeof(kMeshEffects) / sizeof(kMeshEffects[0]));
282 if (index >= 0 && index < meshCount) return kMeshEffects[index].id;
283 index -= meshCount;
284 if (index >= 0 && index < int(sizeof(kPostEffects) / sizeof(kPostEffects[0]))) return kPostEffects[index].id;
285 return {};
286}
287
288int effectParamCount(const std::string& style) {
289 if (findMesh(style)) return meshParamCount(style);
290 return postParamCount(style);
291}
292
293std::string effectParamName(const std::string& style, int index) {
295 return d ? d->id : std::string{};
296}
297
298const StyleParameterDesc* findEffectParameter(const std::string& style, const std::string& name) {
299 const int n = effectParamCount(style);
300 for (int i = 0; i < n; ++i) {
301 const StyleParameterDesc* d = effectParameterAt(style, i);
302 if (d && name == d->id) return d;
303 }
304 return nullptr;
305}
306
307const StyleParameterDesc* effectParameterAt(const std::string& style, int index) {
308 if (findMesh(style)) return meshParamAt(style, index);
309 return postParamAt(style, index);
310}
311
312void bindEffectPostUniforms(graphics::Shader* shader, const std::string& style) {
313 bindParamArray(shader, style, /*mesh=*/false);
314 // Chromatic / wave glitch need framebuffer size; StylePass::uploadScreenUniforms
315 // refreshes these each apply.
316 if (style == "chromatic" || style == "glitchWave" || style == "neonEdge") {
317 shader->declareFloat("screenW");
318 shader->declareFloat("screenH");
319 shader->sendFloat("screenW", 256.f);
320 shader->sendFloat("screenH", 256.f);
321 }
322 if (style == "kuwahara" || style == "kuwaharaAniso" || style == "dog" || style == "sharpen") {
323 shader->declareFloat("texelW");
324 shader->declareFloat("texelH");
325 shader->sendFloat("texelW", 1.f / 256.f);
326 shader->sendFloat("texelH", 1.f / 256.f);
327 }
328}
329
330void bindEffectMeshUniforms(graphics::Shader* shader, const std::string& style) {
331 bindParamArray(shader, style, /*mesh=*/true);
332}
333
335 if (!gfx) throw eve::Exception("createEffectPostShader: null graphics");
336 std::vector<uint32_t> frag;
337 if (style == "vignette")
338 frag = copySpv(vignette_post_frag_spv, vignette_post_frag_spv_count);
339 else if (style == "chromatic")
340 frag = copySpv(chromatic_post_frag_spv, chromatic_post_frag_spv_count);
341 else if (style == "grain")
342 frag = copySpv(grain_post_frag_spv, grain_post_frag_spv_count);
343 else if (style == "glitchAnalog")
344 frag = copySpv(glitch_analog_post_frag_spv, glitch_analog_post_frag_spv_count);
345 else if (style == "glitchBlock")
346 frag = copySpv(glitch_block_post_frag_spv, glitch_block_post_frag_spv_count);
347 else if (style == "glitchWave")
348 frag = copySpv(glitch_wave_post_frag_spv, glitch_wave_post_frag_spv_count);
349 else if (style == "kuwahara")
350 frag = copySpv(kuwahara_post_frag_spv, kuwahara_post_frag_spv_count);
351 else if (style == "kuwaharaAniso")
352 frag = copySpv(kuwahara_aniso_post_frag_spv, kuwahara_aniso_post_frag_spv_count);
353 else if (style == "dog")
354 frag = copySpv(dog_post_frag_spv, dog_post_frag_spv_count);
355 else if (style == "sharpen")
356 frag = copySpv(sharpen_post_frag_spv, sharpen_post_frag_spv_count);
357 else if (style == "neonEdge")
358 frag = copySpv(neon_edge_post_frag_spv, neon_edge_post_frag_spv_count);
359 else
360 throw eve::Exception("createEffectPostShader: not an effect post style '%s'", style.c_str());
361
362 graphics::Shader* sh = gfx->newShaderFromSpv({}, frag);
363 if (!sh || !sh->gpuHandle) throw eve::Exception("createEffectPostShader: failed to create '%s'", style.c_str());
364 bindEffectPostUniforms(sh, style);
365 return sh;
366}
367
369 if (!gfx) throw eve::Exception("createEffectMeshShader: null graphics");
370 std::vector<uint32_t> frag;
371 if (style == "rim")
372 frag = copySpv(rim_mesh_frag_spv, rim_mesh_frag_spv_count);
373 else if (style == "dissolve")
374 frag = copySpv(dissolve_mesh_frag_spv, dissolve_mesh_frag_spv_count);
375 else if (style == "hologram")
376 frag = copySpv(hologram_mesh_frag_spv, hologram_mesh_frag_spv_count);
377 else if (style == "snow")
378 frag = copySpv(snow_mesh_frag_spv, snow_mesh_frag_spv_count);
379 else if (style == "slash")
380 frag = copySpv(slash_mesh_frag_spv, slash_mesh_frag_spv_count);
381 else if (style == "ember")
382 frag = copySpv(ember_mesh_frag_spv, ember_mesh_frag_spv_count);
383 else if (style == "aura")
384 frag = copySpv(aura_mesh_frag_spv, aura_mesh_frag_spv_count);
385 else
386 throw eve::Exception("createEffectMeshShader: not an effect mesh style '%s'", style.c_str());
387
388 auto vert = copySpv(mesh3d_toon_vert_spv, mesh3d_toon_vert_spv_count);
390 if (!sh || !sh->gpuHandle) throw eve::Exception("createEffectMeshShader: failed to create '%s'", style.c_str());
391 bindEffectMeshUniforms(sh, style);
392 return sh;
393}
394
395} // namespace eve::stylize
std::string name
Definition ECS.cpp:154
vk::ShaderModule vert
vk::ShaderModule frag
glm::vec3 n
Definition Grass.cpp:63
std::string id
OceanMeshSettings mesh
float d
Shader * shader
int count
uint32_t index
EVENGINE_API_FOUNDATION public API.
Definition Exception.h:13
virtual Shader * newMeshShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv)=0
Create a Mesh3D custom shader (MeshVertex + Frame UBO + albedo). Empty vert → default mesh3d....
virtual Shader * newShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv)=0
Create a custom 2D shader from SPIR-V words (vert + frag). Owned by Graphics. Vertex stage may be emp...
Custom GPU program.
Definition Shader.h:41
void bindEffectMeshUniforms(graphics::Shader *shader, const std::string &style)
Binds effect mesh uniforms.
graphics::Shader * createEffectMeshShader(graphics::Graphics *gfx, const std::string &style)
Creates effect mesh shader.
std::string effectParamName(const std::string &style, int index)
Effect param name.
bool isEffectStyle(const std::string &style)
True when style names one of the ported effect shaders.
graphics::Shader * createEffectPostShader(graphics::Graphics *gfx, const std::string &style)
Creates effect post shader.
const StyleParameterDesc * findEffectParameter(const std::string &style, const std::string &name)
Finds effect parameter.
int effectStyleCount()
Effect style count.
void bindEffectPostUniforms(graphics::Shader *shader, const std::string &style)
Binds effect post uniforms.
std::string effectStyleIdAt(int index)
Effect style id at.
const StyleDefinition * findEffectDefinition(const std::string &style)
Effect-only StyleDefinition lookup, or nullptr when unknown.
int effectParamCount(const std::string &style)
Effect param count.
const StyleParameterDesc * effectParameterAt(const std::string &style, int index)
Effect parameter at.
Immutable capability metadata for one built-in stylization recipe.
Tooling metadata for one user-facing float parameter.