Merge pull request #1032 from xexyl/2013-mills

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-10-12 08:23:15 -07:00
commit b31dd1fb70
2 files changed
+35 -39

No files matched your search

+34 -39
View File
@@ -1,7 +1,7 @@
# Most timely rendered # Most timely rendered
Christopher Mills Christopher Mills<br>
<mrxo@sonic.net> <mrxo@sonic.net><br>
## To build: ## To build:
@@ -21,7 +21,8 @@ make
./mills & ./mills &
``` ```
While that is running, point your favorite browser at: [http://localhost:8224](http://localhost:8224) While that is running, point your favorite browser at:
[http://localhost:8224](http://localhost:8224).
## Judges' remarks: ## Judges' remarks:
@@ -33,9 +34,7 @@ Who will be the first to post an image rendered during a leap-second?
This program is a handy graphical clock. Simply run the program, click *OK* to This program is a handy graphical clock. Simply run the program, click *OK* to
any annoying security dialog that pop up (aren't those annoying?), then fire any annoying security dialog that pop up (aren't those annoying?), then fire
up your web browser and type in the following URL: up your web browser and type in the following URL: <http://localhost:8224>.
<http://localhost:8224>
You will soon be presented with a lovely dynamically rendered 3D scene that You will soon be presented with a lovely dynamically rendered 3D scene that
also conveniently tells you the current time! also conveniently tells you the current time!
@@ -47,8 +46,8 @@ reloading the page as often as it can render. If you grow tired of watching
your life slip by, hit `Control-C` in the original window. Note that if you your life slip by, hit `Control-C` in the original window. Note that if you
want to restart the program again, you should wait a minute or two before want to restart the program again, you should wait a minute or two before
doing so. For details as to why this is necessary, feel free to Google doing so. For details as to why this is necessary, feel free to Google
`TIME_WAIT`. And while you are there, click on an ad. They could use the `"TIME_WAIT"`, `"SO_REUSEADDR"` and `"SO_REUSEPORT"` (with the quotes). And
money. while you are there, click on an ad. They could use the money.
It would be possible to fix this by adding It would be possible to fix this by adding
@@ -63,20 +62,20 @@ as this limitation is documented, it is not technically a bug.
The program wears many hats (not literally). It is The program wears many hats (not literally). It is
- a web server - a web server
- a PNG encoder - a PNG encoder
- a ray tracer - a ray tracer
- a clock - a clock
It replies to web requests with a PNG image that uses the It replies to web requests with a PNG image that uses the
[Adam7](http://en.wikipedia.org/wiki/Adam7_algorithm) [Adam7](http://en.wikipedia.org/wiki/Adam7_algorithm) encoding to return data
encoding to return data progressively. Since the data is returned in Adam7 progressively. Since the data is returned in Adam7 format, the scene is
format, the scene is displayed initially at a lower resolution and allowed to displayed initially at a lower resolution and allowed to be progressively
be progressively refined as time goes on. The ray tracer is integrally tied refined as time goes on. The ray tracer is integrally tied to the PNG encoder,
to the PNG encoder, casting rays in the Adam7 order. The web server uses casting rays in the Adam7 order. The web server uses PNG primarily because of
PNG primarily because of PNG's ability to return data progressively, and not PNG's ability to return data progressively, and not as you might think it being
as you might think because the PNG standard is so obfuscated as to require because the PNG standard is so obfuscated as to require both little- and
both little- and big-endian encodings at different spec layers. big-endian encodings at different spec layers.
Since ray-tracing was an obvious choice to return to a web server, I needed Since ray-tracing was an obvious choice to return to a web server, I needed
something to ray-trace. A static scene would be uninteresting. I took something to ray-trace. A static scene would be uninteresting. I took
@@ -94,36 +93,32 @@ intended this use of whitespace for data compression, since their tool
doesn't count whitespace in strings differently than whitespace outside of doesn't count whitespace in strings differently than whitespace outside of
them. them.
### User-modifyable Features ### User-modifiable Features
The code can be user-modified simply by changing the build command line. The code can be user-modified simply by changing the build command line.
The following symbols are defined in the build file: The following symbols are defined in the [Makefile](Makefile):
* `-DLT=x1,y1,z1,x2,y2,z2,...` * `-DLT=x1,y1,z1,x2,y2,z2,...` defines the coordinates of the lights in the
scene. It should be a comma-separated list of coordinates `(x, y, z)`, three per
light.
Defines the coordinates of the lights in the scene. It should be a * `-DNL=n` defines the number of lights. It should be equal to the length of the
comma-separated list of coordinates (x, y, z), three per light. list above (three times the number of lights).
* `-DNL=n` * `-DEY=x,y,z` defines the position of the viewer (the eye point) for the scene.
The eye is looking at the origin `(0, 0, 0)`.
Defines the number of lights. Should be equal to the length of the list
above (three times the number of lights).
* `-DEY=x,y,z`
Defines the position of the viewer (the eyepoint) for the scene. The eye
is looking at the origin (0, 0, 0).
### Other Build Flags ### Other Build Flags
The original program bound the server to `INADDR_ANY` to allow everyone to The original program bound the server to `INADDR_ANY` to allow everyone to
experience the server's output. The Judges suggested that I instead restrict experience the server's output. The Judges suggested that I instead restrict
the bind to `INADDR_LOOPBACK` to reduce security alarms. As a compliant veteran the bind to `INADDR_LOOPBACK` to reduce security alarms. As a compliant veteran
of innumerable post-ship late feature additions, I have modified the `Makefile` of innumerable post-ship late feature additions, I have modified the
to inject the new code without destroying the beautiful spherical symmetry of [Makefile](Makefile) to inject the new code without destroying the beautiful
the source code. In addition, I have altered the word `sin_port` to the more spherical symmetry of the source code. In addition, I have altered the word
family-friendly version `win_port` to protect against curious impressionable `sin_port` to the more family-friendly version `win_port` (via
youth trying to learn about sockets on Internet. `-Dwin_port="sin_addr.s_addr=htonl(2130706433),R.sin_port"`) to protect against
curious impressionable youth trying to learn about sockets on Internet.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License:
+1
View File
@@ -1629,6 +1629,7 @@ symlink is created.
Cody also added the [demo.sh](2013/dlowe/demo.sh) script to more easily try the Cody also added the [demo.sh](2013/dlowe/demo.sh) script to more easily try the
program. program.
## [2013/endoh4](2013/endoh4/endoh4.c) ([README.md](2013/endoh4/README.md)) ## [2013/endoh4](2013/endoh4/endoh4.c) ([README.md](2013/endoh4/README.md))
Cody added the [run.sh](2013/endoh4/run.sh) script which temporarily turns off Cody added the [run.sh](2013/endoh4/run.sh) script which temporarily turns off