shithub: tinyrend

Download patch

ref: 5d50d34ac95d2a63113697047afee180e5bd1e6c
parent: c78f84ec1698633945a6d7db3e4d76f866863728
author: rodri <rgl@antares-labs.eu>
date: Tue Dec 19 17:22:37 EST 2023

added a knob to scale the model.

--- a/main.c
+++ b/main.c
@@ -106,6 +106,7 @@
 Point3 up = {0,1,0,0};
 Matrix3 view, proj, rota;
 double θ, ω;
+double scale;
 
 void resized(void);
 uvlong nanosec(void);
@@ -505,10 +506,16 @@
 		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 @@
 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 @@
 	fbw = 200;
 	fbh = 200;
 	ω = 20*DEG;
+	scale = 1;
 	ARGBEGIN{
 	case 'n':
 		nprocs = strtoul(EARGF(usage()), nil, 10);
@@ -1071,11 +1079,14 @@
 	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;