diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-12-25 22:01:57 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-12-25 22:01:57 -0800 |
commit | 189eac273ba14c8ca0d22b31182b030ccc4c7756 (patch) | |
tree | c49ac8c15404cb68ae4ccb4cf2a2ba0f7417c705 /src/tex-node.c | |
parent | 8da03aff8bca547bb83f1b049a65232f03123d5a (diff) |
*: introduce a projection matrix and winmodesrev3
The bulk of this is mechanical wiring up of a projection_x to all
the nodes.
But this also introduces maintenance of the projection_x, with
aspect-ratio preservation in two of the modes: WINDOWED and
FULLSCREEN, with the previously default stretched-to-fill
fullscreen mode now relegated to a third FILLSCREEN winmode.
The default at startup is now an aspect ratio-preserving windowed
mode.
Simply press the 'f' key at any time to cycle through them.
This was mostly done in sars to provide a source-available test
for reproducing a fullscreen SDL2 bug I filed @
https://github.com/libsdl-org/SDL/issues/5139
Otherwise it's pretty silly to bother with doing anything on
sars... but it is a handy little mule for such things.
Diffstat (limited to 'src/tex-node.c')
-rw-r--r-- | src/tex-node.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tex-node.c b/src/tex-node.c index 6d049ca..a3e0830 100644 --- a/src/tex-node.c +++ b/src/tex-node.c @@ -32,6 +32,7 @@ typedef struct tex_node_t { tex_t *tex; + m4f_t *projection_x; m4f_t *model_x; } tex_node_t; @@ -44,7 +45,7 @@ static void tex_node_render(const stage_t *stage, void *object, float alpha, voi assert(stage); assert(tex_node); - tex_render(tex_node->tex, alpha, tex_node->model_x); + tex_render(tex_node->tex, alpha, tex_node->projection_x, tex_node->model_x); } @@ -65,7 +66,7 @@ static const stage_ops_t tex_node_ops = { /* retun a tex node from a reusable refcounted tex instance */ -stage_t * tex_node_new_tex(stage_conf_t *conf, tex_t *tex, m4f_t *model_x) +stage_t * tex_node_new_tex(stage_conf_t *conf, tex_t *tex, m4f_t *projection_x, m4f_t *model_x) { tex_node_t *tex_node; stage_t *s; @@ -79,6 +80,7 @@ stage_t * tex_node_new_tex(stage_conf_t *conf, tex_t *tex, m4f_t *model_x) fatal_if(!s, "Unable to create stage \"%s\"", conf->name); tex_node->tex = tex_ref(tex); + tex_node->projection_x = projection_x; tex_node->model_x = model_x; return s; @@ -89,10 +91,10 @@ stage_t * tex_node_new_tex(stage_conf_t *conf, tex_t *tex, m4f_t *model_x) /* return a tex node from a pix array * the pixels are used in-place and no duplicate is made. */ -stage_t * tex_node_new_mem(stage_conf_t *conf, int width, int height, const unsigned char *buf, m4f_t *model_x) +stage_t * tex_node_new_mem(stage_conf_t *conf, int width, int height, const unsigned char *buf, m4f_t *projection_x, m4f_t *model_x) { tex_t *tex = tex_new(width, height, buf); - stage_t *stage = tex_node_new_tex(conf, tex_new(width, height, buf), model_x); + stage_t *stage = tex_node_new_tex(conf, tex_new(width, height, buf), projection_x, model_x); tex_free(tex); |