diff options
author | rodri <rgl@antares-labs.eu> | 2023-12-19 22:22:37 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-12-19 22:22:37 +0000 |
commit | 5d50d34ac95d2a63113697047afee180e5bd1e6c (patch) | |
tree | b0fc8d40be38430bb606540c7490d6b65c983833 | |
parent | c78f84ec1698633945a6d7db3e4d76f866863728 (diff) | |
download | tinyrend-5d50d34ac95d2a63113697047afee180e5bd1e6c.tar.gz tinyrend-5d50d34ac95d2a63113697047afee180e5bd1e6c.tar.bz2 tinyrend-5d50d34ac95d2a63113697047afee180e5bd1e6c.zip |
added a knob to scale the model.
-rw-r--r-- | main.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -106,6 +106,7 @@ Point3 center = {0,0,0,1}; Point3 up = {0,1,0,0}; Matrix3 view, proj, rota; double θ, ω; +double scale; void resized(void); uvlong nanosec(void); @@ -505,10 +506,16 @@ vertshader(VSparams *sp) 0, 1, 0, 0, sin(θ+fmod(ω*sp->su->uni_time/1e9, 2*PI)), 0, cos(θ+fmod(ω*sp->su->uni_time/1e9, 2*PI)), 0, 0, 0, 0, 1, + }, S = { + scale, 0, 0, 0, + 0, scale, 0, 0, + 0, 0, scale, 0, + 0, 0, 0, 1, }, M, V; identity3(M); identity3(V); + mulm3(yrot, S); mulm3(M, rota); mulm3(M, yrot); mulm3(V, view); @@ -1027,7 +1034,7 @@ key(Rune r) void usage(void) { - fprint(2, "usage: %s [-n nprocs] [-m objfile] [-t texfile] [-a yrotangle] [-z camzpos] [-s shader]\n", argv0); + fprint(2, "usage: %s [-n nprocs] [-m objfile] [-t texfile] [-a yrotangle] [-z camzpos] [-s shader] [-w width] [-h height] [-S scale]\n", argv0); exits("usage"); } @@ -1049,6 +1056,7 @@ threadmain(int argc, char *argv[]) fbw = 200; fbh = 200; ω = 20*DEG; + scale = 1; ARGBEGIN{ case 'n': nprocs = strtoul(EARGF(usage()), nil, 10); @@ -1071,12 +1079,15 @@ threadmain(int argc, char *argv[]) case 's': sname = EARGF(usage()); break; - case 'W': + case 'w': fbw = strtoul(EARGF(usage()), nil, 10); break; - case 'H': + case 'h': fbh = strtoul(EARGF(usage()), nil, 10); break; + case 'S': + scale = strtod(EARGF(usage()), nil); + break; default: usage(); }ARGEND; if(argc != 0) |