From 7eceed2d2f8b99d8300ae828cb942f44f6351b03 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 10 May 2019 00:54:00 -0700 Subject: libstage: add pass-thru pointer to stage_render() It's common to need access to some rendering context from the per-stage render functions, this simply plumbs an opaque pointer from stage_render() down to the render functions. --- src/stage.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/stage.c') diff --git a/src/stage.c b/src/stage.c index a2c6e2d..44a0378 100644 --- a/src/stage.c +++ b/src/stage.c @@ -254,14 +254,14 @@ void stage_clear(stage_t *stage) } -static void _render_stage(const stage_t *stage, float alpha) +static void _render_stage(const stage_t *stage, float alpha, void *render_ctxt) { float a = alpha * stage->alpha; assert(stage); if (stage->render) - stage->render(stage, stage->object, a); + stage->render(stage, stage->object, a, render_ctxt); for (int i = 0; i < STAGE_LAYERS_MAX; i++) { stage_t *s; @@ -270,21 +270,21 @@ static void _render_stage(const stage_t *stage, float alpha) if (!s->active) continue; - _render_stage(s, a); + _render_stage(s, a, render_ctxt); } } } /* recursively render the supplied stage tree, skipping inactive branches */ -void stage_render(const stage_t *stage) +void stage_render(const stage_t *stage, void *render_ctxt) { assert(stage); if (!stage->active) return; - _render_stage(stage, 1.f); + _render_stage(stage, 1.f, render_ctxt); } -- cgit v1.2.3