-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlib_postprocessing.lua
314 lines (305 loc) · 10.6 KB
/
lib_postprocessing.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
__source 'extensions/weather_fx/ac_ext_weather_fx__lua_pp.h'
__allow 'impl'
ffi.cdef [[
typedef struct {
bool active;
float3 center;
float width, depth, height;
} _pp_particle_set;
typedef struct {
void* __0;
void* __1;
void* __2;
float dt;
float hue;
float saturation;
float brightness;
float contrast;
float sepia;
float colorTemperature;
float whiteBalance;
int fixedWidth;
int __aperture_reslt_blur_modify;
int __heat_particle_enabled;
int __heat_particle_active;
float __heat_particle_radius;
float __heat_particle_shimmer;
float __heat_particle_coord;
float __heat_particle_fractal_octaves;
rgb __heat_particle_color;
int __heat_particle_max_number_per_set;
int __heat_particle_sets_number;
float __heat_particle_min_life;
float __heat_particle_life_mult;
float __heat_particle_intensity_mult;
float __heat_particle_min_intensity;
float __heat_particle_intensity_velocity_mult;
float __heat_particle_intensity_min_velocity;
float __heat_particle_position_velocity[3];
float filmicContrast; // __heat_particle_radius_velocity_mult
_pp_particle_set __heat_particle_sets[29];
bool customTonemappingFunctionCode; // __heat_particle_sets_30_active
vec2 __heat_particle_sets_center;
vec2 autoExposureAreaSize;
vec2 autoExposureAreaOffset;
float cameraNearPlane;
float cameraFarPlane;
float cameraVerticalFOVRad;
mat4x4 cameraMatrix;
mat4x4 viewMatrix;
int tonemapUseHDRSpace;
float tonemapExposure;
float tonemapGamma;
int tonemapFunction;
float tonemapViewportScaleWidth;
float tonemapViewportScaleHeight;
float tonemapViewportOffsetX;
float tonemapViewportOffsetY;
float tonemapMappingFactor;
bool autoExposureEnabled; bool __pad1[3];
float autoExposureDelay;
float autoExposureMin;
float autoExposureMax;
float autoExposureTarget;
bool autoExposureInfluencedByGlare; bool __pad2[3];
float vignetteStrength;
float vignetteFOVDependence;
bool chromaticAberrationEnabled; bool __pad3[3];
bool chromaticAberrationActive; bool __pad4[3];
int chromaticAberrationSamples;
vec2 chromaticAberrationLateralDisplacement;
vec2 chromaticAberrationUniformDisplacement;
float diaphragmRotateScale;
float diaphragmRotateOffsetRad;
int diaphragmRotationType;
bool feedbackEnabled; bool __pad5[3];
float feedbackAspectRatio;
float feedbackWeight;
float feedbackCurrentWeight;
float feedbackTimeInSeconds;
int __airydisk_enabled;
float __airydisk_wavelength;
int __airydisk_dispersion;
bool glareEnabled; bool __pad6[3];
bool glareAnamorphic; bool __pad7[3];
int glareShape;
int glarePrecision;
int glareQuality;
int glareBrightPass;
bool glareUseCustomShape; bool __pad8[3];
bool glareAfterImage; bool __pad9[3];
bool glareGhost; bool __pad10[3];
bool glareGhostActive; bool __pad11[3];
float glareGhostConcentricDistortion;
float glareLuminance;
float glareBlur;
float glareThreshold;
float glareBloomFilterThreshold;
float glareBloomGaussianRadiusScale;
float glareBloomLuminanceGamma;
int glareBloomLevels;
float glareGenerationRangeScale;
float glareStarLengthFOVDependence;
float glareStarSoftness;
float glareStarFilterThreshold;
float glareFOVDependence;
float glareShapeLuminance;
float glareShapeBloomLuminance;
float glareShapeBloomDispersion;
int glareShapeBloomDispersionBaseLevel;
float glareShapeGhostLuminance;
float glareShapeGhostHaloLuminance;
float glareShapeGhostDistortion;
bool glareShapeGhostSharpeness;
float glareShapeStarLuminance;
int glareShapeStarStreaks;
float glareShapeStarLength;
float glareShapeStarSecondaryLength;
bool glareShapeStarRotation; bool __pad12[3];
float glareShapeStarInclinationAngle;
float glareShapeStarDispersion;
bool glareShapeStarForceDispersion; bool __pad13[3];
float glareShapeAfterimageLuminance;
float glareShapeAfterimageLength;
bool dofEnabled; bool __pad14[3];
bool dofActive; bool __pad15[3];
int dofQuality;
float dofFocusDistance;
float dofApertureFNumber;
float dofImageSensorHeight;
float dofVerticalFOVBaseRad;
float dofAdaptiveApertureFactor;
int dofApertureParameter;
int dofApertureType;
int dofApertureFrontLevels;
int dofApertureBackLevels;
float dofBackgroundMaskThreshold;
int dofEdgeQuality;
bool godraysEnabled; bool __pad16[3];
bool godraysInCameraFustrum; bool __pad17[3];
vec2 godraysOrigin;
float godraysDiffractionRing;
float godraysDiffractionRingAttenuation;
float godraysDiffractionRadius;
float godraysDiffractionRingSpectrumOrder;
rgbm godraysDiffractionRingOuterColor;
bool godraysUseSunLightColor;
rgbm godraysColor;
float godraysLength;
float godraysGlareRatio;
float godraysAngleAttenuation;
float godraysNoiseMask;
float godraysNoiseFrequency;
float godraysDepthMaskThreshold;
bool lensDistortionEnabled; bool __pad18[3];
float lensDistortionRoundness;
float lensDistortionSmoothness;
bool __antialiasEnabled; bool __pad19[3];
float __antialiasStartDistance;
float __antialiasEndDistance;
} pp_params_data;
]]
---Structure containing postprocessing parameters to be applied. Could be used to sync settings with custom postprocessing or alter something live.
---@class ac.PostProcessingParameters
---@field dt number
---@field hue number
---@field saturation number
---@field brightness number
---@field contrast number
---@field sepia number
---@field colorTemperature number
---@field whiteBalance number
---@field fixedWidth integer
---@field cameraNearPlane number
---@field cameraFarPlane number
---@field cameraVerticalFOVRad number
---@field cameraMatrix mat4x4
---@field viewMatrix mat4x4
---@field tonemapUseHDRSpace integer
---@field tonemapExposure number
---@field tonemapGamma number
---@field tonemapFunction integer
---@field tonemapViewportScaleWidth number
---@field tonemapViewportScaleHeight number
---@field tonemapViewportOffsetX number
---@field tonemapViewportOffsetY number
---@field tonemapMappingFactor number
---@field autoExposureEnabled boolean
---@field autoExposureDelay number
---@field autoExposureMin number
---@field autoExposureMax number
---@field autoExposureTarget number
---@field autoExposureInfluencedByGlare boolean
---@field autoExposureAreaSize vec2
---@field autoExposureAreaOffset vec2
---@field vignetteStrength number
---@field vignetteFOVDependence number
---@field chromaticAberrationEnabled boolean
---@field chromaticAberrationActive boolean
---@field chromaticAberrationSamples integer
---@field chromaticAberrationLateralDisplacement vec2
---@field chromaticAberrationUniformDisplacement vec2
---@field diaphragmRotateScale number
---@field diaphragmRotateOffsetRad number
---@field diaphragmRotationType integer
---@field feedbackEnabled boolean
---@field feedbackAspectRatio number
---@field feedbackWeight number
---@field feedbackCurrentWeight number
---@field feedbackTimeInSeconds number
---@field glareEnabled boolean
---@field glareAnamorphic boolean
---@field glareShape integer
---@field glarePrecision integer
---@field glareQuality integer
---@field glareBrightPass integer
---@field glareUseCustomShape boolean
---@field glareAfterImage boolean
---@field glareGhost boolean
---@field glareGhostActive boolean
---@field glareGhostConcentricDistortion number
---@field glareLuminance number
---@field glareBlur number
---@field glareThreshold number
---@field glareBloomFilterThreshold number
---@field glareBloomGaussianRadiusScale number
---@field glareBloomLuminanceGamma number
---@field glareBloomLevels integer
---@field glareGenerationRangeScale number
---@field glareStarLengthFOVDependence number
---@field glareStarSoftness number
---@field glareStarFilterThreshold number
---@field glareFOVDependence number
---@field glareShapeLuminance number
---@field glareShapeBloomLuminance number
---@field glareShapeBloomDispersion number
---@field glareShapeBloomDispersionBaseLevel integer
---@field glareShapeGhostLuminance number
---@field glareShapeGhostHaloLuminance number
---@field glareShapeGhostDistortion number
---@field glareShapeGhostSharpeness boolean
---@field glareShapeStarLuminance number
---@field glareShapeStarStreaks integer
---@field glareShapeStarLength number
---@field glareShapeStarSecondaryLength number
---@field glareShapeStarRotation boolean
---@field glareShapeStarInclinationAngle number
---@field glareShapeStarDispersion number
---@field glareShapeStarForceDispersion boolean
---@field glareShapeAfterimageLuminance number
---@field glareShapeAfterimageLength number
---@field dofEnabled boolean
---@field dofActive boolean
---@field dofQuality integer
---@field dofFocusDistance number
---@field dofApertureFNumber number
---@field dofImageSensorHeight number
---@field dofVerticalFOVBaseRad number
---@field dofAdaptiveApertureFactor number
---@field dofApertureParameter integer
---@field dofApertureType integer
---@field dofApertureFrontLevels integer
---@field dofApertureBackLevels integer
---@field dofBackgroundMaskThreshold number
---@field dofEdgeQuality integer
---@field godraysEnabled boolean
---@field godraysInCameraFustrum boolean
---@field godraysOrigin vec2
---@field godraysDiffractionRing number
---@field godraysDiffractionRingAttenuation number
---@field godraysDiffractionRadius number
---@field godraysDiffractionRingSpectrumOrder number
---@field godraysDiffractionRingOuterColor rgbm
---@field godraysUseSunLightColor boolean
---@field godraysColor rgbm
---@field godraysLength number
---@field godraysGlareRatio number
---@field godraysAngleAttenuation number
---@field godraysNoiseMask number
---@field godraysNoiseFrequency number
---@field godraysDepthMaskThreshold number
---@field lensDistortionEnabled boolean
---@field lensDistortionRoundness number
---@field lensDistortionSmoothness number
---@field filmicContrast number
---@field customTonemappingFunctionCode boolean @If `true`, current YEBIS filter has a custom tonemapping implementation. Use `ac.getCustomTonemappingFunctionCode()` to get it.
---@cpptype pp_params_data
ffi.metatype('pp_params_data', { __index = {} })
local rtSize = vec2()
__definitions()
--[[? if (ctx.ldoc) out(]]
---Get custom tonemapping function code from currently selected PP filter, or `nil` if it’s not set.
---@return string?
function ac.getCustomTonemappingFunctionCode() end
--[[) ?]]
return function(callback)
return __util.disposable(ffi.C.lj_onPostProcessing_inner__impl(__util.setCallback(function (exposure, mainPass, updateExposure, sizeX, sizeY)
rtSize.x, rtSize.y = sizeX, sizeY
local ret = callback(ffi.C.lj_getPostProcessing_inner__impl(), exposure, mainPass, updateExposure, rtSize)
if type(ret) == 'boolean' then
return ret
elseif ret then
ffi.C.lj_setPostProcessingInput_inner__impl(tostring(ret))
end
end)))
end