ref: 1b6da4afeb01d14714291a0b1f5103662a47eb00
parent: e490447bf7b3688ced181e8aa6315b28537b4e61
author: rodri <rgl@antares-labs.eu>
date: Thu Mar 13 16:50:59 EDT 2025
make nanosec() public.
binary files a/doc/libgraphics.pdf b/doc/libgraphics.pdf differ
--- a/doc/libgraphics.ps
+++ b/doc/libgraphics.ps
@@ -887,7 +887,7 @@
(Figure 1) 2219 7036 w
10 /LucidaSansUnicode00 f
(: The scene graph.) 2641 7036 w
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -1073,7 +1073,7 @@
(1.5.) 720 6482 w
(Materials) 962 6482 w
10 /LucidaSansUnicode00 f
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -1155,161 +1155,155 @@
(*/) 4755 3692 w
(Projection) 1440 3802 w
(projtype;) 2155 3802 w
-(ulong) 1440 3912 w
-(clearcolor;) 1830 3912 w
-(int) 1440 4022 w
-(cullmode;) 1700 4022 w
-(int) 1440 4132 w
-(enableblend;) 1700 4132 w
-(int) 1440 4242 w
-(enabledepth;) 1700 4242 w
-(int) 1440 4352 w
-(enableAbuff;) 1700 4352 w
-(};) 920 4462 w
+(int) 1440 3912 w
+(cullmode;) 1700 3912 w
+(uint) 1440 4022 w
+(rendopts;) 1765 4022 w
+(};) 920 4132 w
10 /LucidaSans-Demi f
-(3.) 720 4762 w
-(The renderer) 873 4762 w
+(3.) 720 4432 w
+(The renderer) 873 4432 w
10 /LucidaSansUnicode00 f
-(The) 720 4918 w
+(The) 720 4588 w
10 /LucidaSans-Italic f
-(renderer) 938 4918 w
+(renderer) 938 4588 w
10 /LucidaSansUnicode00 f
-(is) 1401 4918 w
-(the) 1518 4918 w
-(core) 1710 4918 w
-(of) 1956 4918 w
-(the) 2091 4918 w
-(library.) 2283 4918 w
-(It) 2662 4918 w
-(follows) 2766 4918 w
-(a) 3149 4918 w
+(is) 1401 4588 w
+(the) 1518 4588 w
+(core) 1710 4588 w
+(of) 1956 4588 w
+(the) 2091 4588 w
+(library.) 2283 4588 w
+(It) 2662 4588 w
+(follows) 2766 4588 w
+(a) 3149 4588 w
10 /LucidaSans-Demi f
-(retained) 3242 4918 w
-(mode) 3708 4918 w
+(retained) 3242 4588 w
+(mode) 3708 4588 w
10 /LucidaSansUnicode00 f
-(model,) 4032 4918 w
-(which) 4404 4918 w
-(means) 4723 4918 w
-(that) 720 5038 w
-(the) 955 5038 w
-(user) 1154 5038 w
-(won) 1408 5038 w
+(model,) 4032 4588 w
+(which) 4404 4588 w
+(means) 4723 4588 w
+(that) 720 4708 w
+(the) 955 4708 w
+(user) 1154 4708 w
+(won) 1408 4708 w
10 /LucidaSansUnicode20 f
-(\031) 1608 5038 w
+(\031) 1608 4708 w
10 /LucidaSansUnicode00 f
-(t) 1640 5038 w
-(get) 1721 5038 w
-(a) 1920 5038 w
-(picture) 2019 5038 w
-(until) 2402 5038 w
-(the) 2665 5038 w
-(entire) 2864 5038 w
-(scene) 3189 5038 w
-(has) 3509 5038 w
-(been) 3721 5038 w
-(rendered.) 4002 5038 w
-(Thanks) 4548 5038 w
-(to) 4942 5038 w
-(this) 720 5158 w
-(we) 939 5158 w
-(can) 1112 5158 w
-(apply) 1320 5158 w
-(optimizations) 1622 5158 w
-(to) 2326 5158 w
-(make) 2465 5158 w
-(better) 2768 5158 w
-(use) 3099 5158 w
-(of) 3309 5158 w
-(the) 3448 5158 w
-(pipeline,) 3644 5158 w
-(clear) 4104 5158 w
-(and) 4377 5158 w
-(swap) 4598 5158 w
-(the) 4885 5158 w
-(framebuffers,) 720 5278 w
-(and) 1424 5278 w
+(t) 1640 4708 w
+(get) 1721 4708 w
+(a) 1920 4708 w
+(picture) 2019 4708 w
+(until) 2402 4708 w
+(the) 2665 4708 w
+(entire) 2864 4708 w
+(scene) 3189 4708 w
+(has) 3509 4708 w
+(been) 3721 4708 w
+(rendered.) 4002 4708 w
+(Thanks) 4548 4708 w
+(to) 4942 4708 w
+(this) 720 4828 w
+(we) 939 4828 w
+(can) 1112 4828 w
+(apply) 1320 4828 w
+(optimizations) 1622 4828 w
+(to) 2326 4828 w
+(make) 2465 4828 w
+(better) 2768 4828 w
+(use) 3099 4828 w
+(of) 3309 4828 w
+(the) 3448 4828 w
+(pipeline,) 3644 4828 w
+(clear) 4104 4828 w
+(and) 4377 4828 w
+(swap) 4598 4828 w
+(the) 4885 4828 w
+(framebuffers,) 720 4948 w
+(and) 1424 4948 w
10 /LucidaSansUnicode20 f
-(\024) 1604 5278 w
+(\024) 1604 4948 w
10 /LucidaSansUnicode00 f
-(in) 1704 5278 w
-(the) 1838 5278 w
-(future) 2036 5278 w
+(in) 1704 4948 w
+(the) 1838 4948 w
+(future) 2036 4948 w
10 /LucidaSansUnicode20 f
-(\024) 2331 5278 w
+(\024) 2331 4948 w
10 /LucidaSansUnicode00 f
-(run) 2431 5278 w
-(distributed) 2639 5278 w
-(rendering) 3213 5278 w
-(jobs,) 3728 5278 w
-(all) 4008 5278 w
-(without) 4164 5278 w
-(any) 4571 5278 w
-(inter\255) 4782 5278 w
-(vention;) 720 5398 w
-(users) 1152 5398 w
-(only) 1454 5398 w
-(need) 1699 5398 w
-(to) 1977 5398 w
-(concern) 2116 5398 w
-(themselves) 2541 5398 w
-(with) 3126 5398 w
-(shooting) 3373 5398 w
-(and) 3840 5398 w
+(run) 2431 4948 w
+(distributed) 2639 4948 w
+(rendering) 3213 4948 w
+(jobs,) 3728 4948 w
+(all) 4008 4948 w
+(without) 4164 4948 w
+(any) 4571 4948 w
+(inter\255) 4782 4948 w
+(vention;) 720 5068 w
+(users) 1152 5068 w
+(only) 1454 5068 w
+(need) 1699 5068 w
+(to) 1977 5068 w
+(concern) 2116 5068 w
+(themselves) 2541 5068 w
+(with) 3126 5068 w
+(shooting) 3373 5068 w
+(and) 3840 5068 w
10 /LucidaSansUnicode20 f
-(\034) 4062 5398 w
+(\034) 4062 5068 w
10 /LucidaSansUnicode00 f
-(developing) 4099 5398 w
+(developing) 4099 5068 w
10 /LucidaSansUnicode20 f
-(\035) 4632 5398 w
+(\035) 4632 5068 w
10 /LucidaSansUnicode00 f
-(a) 4711 5398 w
-(cam\255) 4808 5398 w
-(era.) 720 5518 w
-(It) 720 5674 w
+(a) 4711 5068 w
+(cam\255) 4808 5068 w
+(era.) 720 5188 w
+(It) 720 5344 w
10 /LucidaSansUnicode20 f
-(\031) 786 5674 w
+(\031) 786 5344 w
10 /LucidaSansUnicode00 f
-(s) 818 5674 w
-(implemented) 974 5674 w
-(as) 1716 5674 w
-(a) 1927 5674 w
-(tree) 2087 5674 w
-(of) 2382 5674 w
-(concurrent) 2585 5674 w
-(processes) 3214 5674 w
-(connected) 3800 5674 w
-(by) 4404 5674 w
-(buffered) 4625 5674 w
+(s) 818 5344 w
+(implemented) 974 5344 w
+(as) 1716 5344 w
+(a) 1927 5344 w
+(tree) 2087 5344 w
+(of) 2382 5344 w
+(concurrent) 2585 5344 w
+(processes) 3214 5344 w
+(connected) 3800 5344 w
+(by) 4404 5344 w
+(buffered) 4625 5344 w
10 /LucidaTypewriter f
-(Channel) 720 5794 w
+(Channel) 720 5464 w
10 /LucidaSansUnicode00 f
-(s) 1224 5794 w
+(s) 1224 5464 w
10 /LucidaSansUnicode20 f
-(\024) 1275 5794 w
+(\024) 1275 5464 w
10 /LucidaSansUnicode00 f
-(as) 1375 5794 w
-(seen) 1520 5794 w
-(in) 1784 5794 w
+(as) 1375 5464 w
+(seen) 1520 5464 w
+(in) 1784 5464 w
10 /LucidaSans-Demi f
-(Figure) 1914 5794 w
-(2) 2278 5794 w
+(Figure) 1914 5464 w
+(2) 2278 5464 w
10 /LucidaSansUnicode20 f
-(\024) 2342 5794 w
+(\024) 2342 5464 w
10 /LucidaSansUnicode00 f
-(,) 2442 5794 w
-(spawned) 2512 5794 w
-(with) 2977 5794 w
-(a) 3220 5794 w
-(call) 3313 5794 w
-(to) 3515 5794 w
+(,) 2442 5464 w
+(spawned) 2512 5464 w
+(with) 2977 5464 w
+(a) 3220 5464 w
+(call) 3313 5464 w
+(to) 3515 5464 w
10 /LucidaTypewriter f
-(initgraphics) 3651 5794 w
+(initgraphics) 3651 5464 w
10 /LucidaSansUnicode00 f
-(,) 4515 5794 w
-(each) 4585 5794 w
-(rep\255) 4847 5794 w
-(resenting a stage of the pipeline:) 720 5914 w
-(March 8, 2025) 2527 7680 w
+(,) 4515 5464 w
+(each) 4585 5464 w
+(rep\255) 4847 5464 w
+(resenting a stage of the pipeline:) 720 5584 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -1710,7 +1704,7 @@
(be) 4559 5412 w
(copied) 4717 5412 w
(and sent to each of them.) 720 5532 w
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -2207,7 +2201,7 @@
(Figure 4) 2073 7032 w
10 /LucidaSansUnicode00 f
(: Raster task scheduling.) 2495 7032 w
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -2547,7 +2541,7 @@
(&) 4545 7260 w
(Francis,) 4655 7260 w
10 /LucidaSansUnicode00 f
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
@@ -2714,7 +2708,7 @@
10 /LucidaSans-Italic f
(ACM Transactions on Computer Graphics, Vol. 23, No. 3, July 1989) 1311 2928 w
10 /LucidaSansUnicode00 f
-(March 8, 2025) 2527 7680 w
+(March 12, 2025) 2495 7680 w
cleartomark
showpage
saveobj restore
--- a/graphics.h
+++ b/graphics.h
@@ -471,4 +471,7 @@
Color getlightcolor(LightSource*, Point3, Point3);
Color getscenecolor(Scene*, Point3, Point3);
+/* nanosec */
+uvlong nanosec(void);
+
extern Rectangle UR; /* unit rectangle */
--- a/internal.h
+++ b/internal.h
@@ -84,9 +84,6 @@
void memsetf(void*, float, usize);
void memsetl(void*, ulong, usize);
-/* nanosec */
-uvlong nanosec(void);
-
#define getpixel(fb, p) rastergetcolor(fb, p)
#define putpixel(fb, p, c) rasterputcolor(fb, p, c)
#define getdepth(fb, p) rastergetfloat(fb, p)
--- a/render.c
+++ b/render.c
@@ -7,8 +7,6 @@
#include "graphics.h"
#include "internal.h"
-Rectangle UR = {0,0,1,1};
-
static Vertexattr *
sparams_getuniform(Shaderparams *sp, char *id)
{
--- a/util.c
+++ b/util.c
@@ -7,6 +7,8 @@
#include "graphics.h"
#include "internal.h"
+Rectangle UR = {0,0,1,1};
+
Point
minpt(Point a, Point b)
{