feat: add autoZoom param to GIF/MP4 renderers

Adjusts camera distance multiplier from 1.5 to 1.25 when enabled,
reducing empty space around character while leaving room for cosmetics.
This commit is contained in:
devilreef 2026-01-23 01:51:07 +06:00
parent f8947fdcc4
commit fcc495c06f
7 changed files with 29 additions and 13 deletions

View file

@ -66,7 +66,7 @@ func (h *Handlers) HandlePNG(w http.ResponseWriter, r *http.Request) {
return
}
pngBytes, err := render.RenderPNG(result.GLBBytes, result.Atlas, req.Rotation, req.Background, req.Width, req.Height)
pngBytes, err := render.RenderPNG(result.GLBBytes, result.Atlas, req.Rotation, req.Background, req.Width, req.Height, true)
if err != nil {
writeError(w, http.StatusInternalServerError, "render failed: "+err.Error())
return
@ -103,7 +103,7 @@ func (h *Handlers) HandleGIF(w http.ResponseWriter, r *http.Request) {
return
}
gifBytes, err := render.RenderGIF(result.GLBBytes, result.Atlas, req.Background, req.Frames, req.Width, req.Height, req.Delay, *req.Dithering)
gifBytes, err := render.RenderGIF(result.GLBBytes, result.Atlas, req.Background, req.Frames, req.Width, req.Height, req.Delay, *req.Dithering, *req.AutoZoom)
if err != nil {
writeError(w, http.StatusInternalServerError, "render failed: "+err.Error())
return
@ -140,7 +140,7 @@ func (h *Handlers) HandleMP4(w http.ResponseWriter, r *http.Request) {
return
}
mp4Bytes, err := render.RenderMP4(result.GLBBytes, result.Atlas, req.Background, req.Frames, req.Width, req.Height, req.FPS)
mp4Bytes, err := render.RenderMP4(result.GLBBytes, result.Atlas, req.Background, req.Frames, req.Width, req.Height, req.FPS, *req.AutoZoom)
if err != nil {
writeError(w, http.StatusInternalServerError, "render failed: "+err.Error())
return