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

@ -12,7 +12,7 @@ import (
)
// RenderMP4 renders a GLB model to an MP4 video rotating 360 degrees
func RenderMP4(glbBytes []byte, atlas *texture.Atlas, background string, frames, width, height, fps int) ([]byte, error) {
func RenderMP4(glbBytes []byte, atlas *texture.Atlas, background string, frames, width, height, fps int, autoZoom bool) ([]byte, error) {
// Parse background color
bgColor, err := ParseHexColor(background)
if err != nil {
@ -47,7 +47,7 @@ func RenderMP4(glbBytes []byte, atlas *texture.Atlas, background string, frames,
go func(frameIdx int) {
defer wg.Done()
rotation := float64(frameIdx) * rotationPerFrame
img := RenderScene(mesh, atlasImage, rotation, width, height, bgColor)
img := RenderScene(mesh, atlasImage, rotation, width, height, bgColor, autoZoom)
// Write frame to temp file
framePath := filepath.Join(tempDir, fmt.Sprintf("frame_%04d.png", frameIdx))