feat: cinematic seasonal atmosphere presets (spring/summer/autumn/winter) - enhances existing light with season tints, sun glow, fog veil
This commit is contained in:
@@ -6,6 +6,7 @@ import { Asset } from 'expo-asset';
|
||||
import { Recipe, GPSInfo, FrameId } from '../types';
|
||||
import { getSkiaColorMatrix, applyExposureGain } from './colorUtils';
|
||||
import { TONE_SKSL, getToneUniforms, toneIsActive } from './toneShader';
|
||||
import { CINEMA_SKSL, getCinemaUniforms, cinemaIsActive } from './cinemaShader';
|
||||
import { drawFrameOnCanvas } from './frameUtils';
|
||||
import { patchJpegDpi } from './jpegDpi';
|
||||
|
||||
@@ -152,6 +153,31 @@ export async function processAndExportPhoto(
|
||||
}
|
||||
}
|
||||
|
||||
// 3c. Cinema seasonal atmosphere grade (chain: cinema -> tone -> image).
|
||||
// All-zero uniforms (no recipe.cinema) → skipped entirely.
|
||||
const cinema = getCinemaUniforms(recipe.cinema);
|
||||
let paintShader = toneShader;
|
||||
if (cinema && cinemaIsActive(cinema.flat)) {
|
||||
try {
|
||||
const cinemaEffect = Skia.RuntimeEffect.Make(CINEMA_SKSL);
|
||||
if (cinemaEffect) {
|
||||
const child = toneShader ?? skImage.makeShaderOptions(
|
||||
TileMode.Clamp,
|
||||
TileMode.Clamp,
|
||||
FilterMode.Linear,
|
||||
MipmapMode.None
|
||||
);
|
||||
const cs = cinemaEffect.makeShaderWithChildren(cinema.flat, [child]);
|
||||
if (cs) {
|
||||
paintShader = cs;
|
||||
paint.setShader(paintShader);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[export] CINEMA_SKSL failed - skipped: ' + e);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Denoise / Clarity Image Filters (export-only enhancements)
|
||||
let imageFilter = null;
|
||||
|
||||
@@ -202,7 +228,7 @@ export async function processAndExportPhoto(
|
||||
// whole chain (tone → matrix → denoise/clarity) applies — but only when a
|
||||
// real shader was built; otherwise plain drawImage (never drawRect on a
|
||||
// shader-less paint, which paints solid color).
|
||||
if (toneShader) {
|
||||
if (paintShader) {
|
||||
canvas.drawRect(Skia.XYWHRect(0, 0, width, height), paint);
|
||||
} else {
|
||||
canvas.drawImage(skImage, 0, 0, paint);
|
||||
|
||||
Reference in New Issue
Block a user