Added glass and metal objects
This commit is contained in:
parent
926008e491
commit
3fa044013a
7 changed files with 2103 additions and 38 deletions
|
|
@ -26,7 +26,53 @@
|
|||
"Bash(rm -f /tmp/st2 /tmp/st2.c)",
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 760x360+340+60 +repage /tmp/vg_faces.png)",
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 760x300+340+430 +repage /tmp/vg_googie.png)",
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 360x340+150+60 +repage /tmp/vg_angry.png)"
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 360x340+150+60 +repage /tmp/vg_angry.png)",
|
||||
"Read(//usr/bin/**)",
|
||||
"Read(//usr/x86_64-w64-mingw32/**)",
|
||||
"Read(//usr/x86_64-w64-mingw32/lib/**)",
|
||||
"Bash(dpkg -l)",
|
||||
"Bash(timeout 12 curl -sI https://github.com)",
|
||||
"Bash(timeout 12 curl -sI https://deb.debian.org)",
|
||||
"Bash(timeout 60 apt-get download gcc-mingw-w64-x86-64-posix)",
|
||||
"Bash(timeout 90 curl -sL -o glfw-win.zip https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN64.zip)",
|
||||
"Bash(unzip -o -q glfw-win.zip -d /tmp/)",
|
||||
"Bash(identify /tmp/vg_win.png)",
|
||||
"Bash(awk '{print \"screenshot size:\", $3}')",
|
||||
"Bash(convert /tmp/vg_win.png -crop 300x300+0+0 +repage -resize 200% /tmp/vg_win_crop.png)",
|
||||
"Bash(convert /tmp/vg_win.png -crop 1140x800+0+20 +repage /tmp/vg_win_crop.png)",
|
||||
"Bash(export WINEDEBUG=-all DISPLAY=:0)",
|
||||
"Bash(echo \"=== /p preview: should exit cleanly and fast ===\")",
|
||||
"Bash(timeout 15 wine ./vectorgons.scr /p 12345)",
|
||||
"Bash(echo \"exit=$?\")",
|
||||
"Bash(echo)",
|
||||
"Bash(convert /tmp/scr.png -resize 60% /tmp/scr_small.png)",
|
||||
"Bash(grep -n \"static void add_ball\\\\|static void update_clocks\\\\|static void add_symbol\\\\|#define MAX_SHAPES\\\\|Vectorgons: %d\\\\|add_symbol\\(build_hand\\)\\\\|update_clocks\\(\\);$\" vectorgons.c)",
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 1100x380+0+40 +repage /tmp/vg_sil_top.png)",
|
||||
"Bash(convert /tmp/vg_frame.ppm -crop 1100x340+0+400 +repage /tmp/vg_sil_bot.png)",
|
||||
"Bash(grep -n \"int active = active_count\\(\\);\\\\|for \\(int i = 0; i < active; i++\\)\\\\|if \\(!g_screensaver\\) {\\\\s*$\\\\|render_osd\\(fbw, fbh, osd_alpha\\);\" vectorgons.c)",
|
||||
"Bash(echo \"=== exe launches & loads shapes? ===\")",
|
||||
"Bash(timeout 12 wine ./vectorgons.exe)",
|
||||
"Bash(timeout 12 wine ./vectorgons.scr /p 0)",
|
||||
"Bash(echo \"scr /p exit=$?\")",
|
||||
"Bash(timeout 8 wine ./vectorgons.scr /s)",
|
||||
"Bash(python3 verify_mirror.py)",
|
||||
"Bash(sed 's#-lglfw -lGLU -lGL#X#' /dev/null)",
|
||||
"Bash(DISPLAY=:0 timeout 6 wine vectorgons.exe)",
|
||||
"Bash(tail -3 /tmp/vgtest/wine.log)",
|
||||
"Bash(python3 count3.py)",
|
||||
"Bash(cc -O2 -std=c11 -o cnt3 cnt3.c -lglfw -lGLU -lGL -lm)",
|
||||
"Bash(DISPLAY=:0 VG_COUNT=1 timeout 8 ./cnt3)",
|
||||
"Bash(python3 verify_counts.py)",
|
||||
"Bash(python3 verify_visual.py)",
|
||||
"Bash(echo \"exit=$? \\(no matches expected\\)\")",
|
||||
"Bash(DISPLAY=:0 timeout 3 ./vectorgons)",
|
||||
"Bash(echo \"normal-config exit=$? \\(124=ran ok\\)\")",
|
||||
"Bash(cp ~/.vectorgons /tmp/vgtest/cfg.bak)",
|
||||
"Bash(printf 'mag_count=1000\\\\nglass_count=1000\\\\nmirror_count=1000\\\\ndensity=200\\\\nrender_dist=400\\\\nspeed=20\\\\n')",
|
||||
"Bash(DISPLAY=:0 timeout 4 ./vectorgons)",
|
||||
"Bash(python3 verify_smooth.py)",
|
||||
"Bash(convert smooth.ppm -crop 760x500+330+150 +repage -resize 200% smooth_zoom.png)",
|
||||
"Bash(python3 verify_gm.py)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
Makefile
28
Makefile
|
|
@ -13,7 +13,29 @@ $(TARGET): $(SRC)
|
|||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
# --- Windows x64 cross-compile (MinGW-w64) ---------------------------------
|
||||
# Produces a self-contained vectorgons.exe (statically links GLFW and the
|
||||
# GCC/threads runtime; at run time it needs only Windows system DLLs:
|
||||
# opengl32, glu32, gdi32, user32, shell32, kernel32). Override WINCC / GLFWDIR
|
||||
# for your toolchain and GLFW (https://www.glfw.org/download, WIN64 binaries):
|
||||
# make windows WINCC=x86_64-w64-mingw32-gcc GLFWDIR=/path/to/glfw-3.4.bin.WIN64
|
||||
WINCC ?= x86_64-w64-mingw32-gcc
|
||||
GLFWDIR ?= /tmp/glfw-3.4.bin.WIN64
|
||||
WINFLAGS = -O2 -std=c11 -Wall -Wextra -mwindows -static -s
|
||||
WINLIBS = -lglfw3 -lglu32 -lopengl32 -lgdi32 -luser32 -lshell32
|
||||
|
||||
.PHONY: run clean
|
||||
windows: $(SRC)
|
||||
$(WINCC) $(WINFLAGS) -I$(GLFWDIR)/include -o $(TARGET).exe $(SRC) \
|
||||
-L$(GLFWDIR)/lib-mingw-w64 $(WINLIBS)
|
||||
|
||||
# Windows screensaver: same code with -DSCREENSAVER, output named .scr.
|
||||
# Install by right-clicking the .scr in Windows -> Install (or drop it in
|
||||
# C:\Windows\System32 and pick it in Settings > Lock screen > Screen saver).
|
||||
screensaver: $(SRC)
|
||||
$(WINCC) $(WINFLAGS) -DSCREENSAVER -I$(GLFWDIR)/include -o $(TARGET).scr $(SRC) \
|
||||
-L$(GLFWDIR)/lib-mingw-w64 $(WINLIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(TARGET).exe $(TARGET).scr
|
||||
|
||||
.PHONY: run windows screensaver clean
|
||||
|
|
|
|||
120
README.md
120
README.md
|
|
@ -3,7 +3,7 @@
|
|||
A starfield simulator — except instead of stars, colorful **vector-drawn
|
||||
platonic solids** tumble through space toward the camera.
|
||||
|
||||
**~165 shape types** are rendered as glowing wireframes — each spawns far away
|
||||
**~530 shape types** are rendered as glowing wireframes — each spawns far away
|
||||
at a random size, tumbles on its own random axis, and streams past the camera
|
||||
before being recycled at the render-distance sphere. Solids never overlap.
|
||||
|
||||
|
|
@ -33,7 +33,69 @@ The shape set includes:
|
|||
question mark, exclamation point, hash/pound (`#`), dollar sign (`$`), pound
|
||||
sterling (`£`), and the **at sign (`@`)**
|
||||
- **Object iconography**, each in **2-D** and **3-D**: space invaders, UFOs,
|
||||
pac-man, alien heads, smoking pipes, umbrellas, and hands
|
||||
pac-man and pac-man ghosts, alien heads, smoking pipes, umbrellas, hands,
|
||||
ice cream cones, light bulbs, mitochondria, windowpanes, bowling balls and
|
||||
pins, baseball bats, beer bottles, nonic pint glasses, whiskey bottles,
|
||||
telephones, telephone booths, radio towers, and atoms with orbiting electrons
|
||||
(the volumetric bowling ball is a true wireframe sphere, and the 3-D atom has
|
||||
real orbits + nucleus + electron balls rather than a flat extrusion)
|
||||
- **More 3-D objects** — many built as true **solids of revolution** (a profile
|
||||
lathed around an axis): a full **chess set** (pawn, rook, bishop, knight,
|
||||
queen, king), candlesticks with a flame, coffee cups, lanterns, hurricane
|
||||
lamps, quartz crystals, pineapples, and a parametric **torus** — plus extruded
|
||||
silhouettes of padlocks, antique keys, bananas, electric guitars, tacos, pizza
|
||||
slices, hammers, wrenches, directional and drafting compasses, set-squares,
|
||||
eyeglasses, forks, spoons, fountain pens, the four classical element symbols
|
||||
(fire/water/air/earth), the squared-circle "philosopher's stone", a couple of
|
||||
retro stylized gaming/OS marks, a retro joystick, and a generic starship
|
||||
- **Even more objects** in 2-D and 3-D: top hats, baseball caps, noses, hearts,
|
||||
computer keyboards, floppy disks, bells, books, and two more stylized retro
|
||||
computer marks. Every representational *object* now has both a flat 2-D and a
|
||||
3-D form — the once-3-D-only chess pieces, lathed solids, torus, and atomic
|
||||
starbursts all gained matching 2-D silhouettes.
|
||||
- **Yet more**, all in 2-D and 3-D: IC chip packages (DIP, QFP, PGA, and a
|
||||
generic CPU — the styles behind the 6502/Z80/386/486 and friends), hot dogs,
|
||||
hamburgers, monoliths, ringed planets, unicycles, hula hoops, mechanical
|
||||
gyroscopes, microscopes, telescopes, **magnifying glasses that actually
|
||||
magnify the field behind them**, thermometers, calculators, staplers, paper
|
||||
clips, palm trees, saguaro cacti, grape bunches, sushi rolls, corkscrews (a
|
||||
real 3-D helix), bottle openers, lightning bolts, and batteries
|
||||
- **An even bigger batch** in 2-D and 3-D: everlasting gobstoppers, pants,
|
||||
shirts, jacks, dice, K/Q/J/A playing cards, roulette wheels, slot machines,
|
||||
fire hydrants, bucky balls (a real truncated icosahedron), yo-yos, brains,
|
||||
d6 and d20 dice, thimbles, automobiles, couches, stop signs, office chairs,
|
||||
DNA double helices, skull-and-crossbones, goldfish, squid, pine cones, maple
|
||||
leaves, sea anemones, wagon wheels, submarines, sailing ships, anchors, swiss
|
||||
cheese wedges, and the anarchy symbol
|
||||
- **Animated objects** (the 3-D form is rebuilt every frame): a **Hoberman
|
||||
sphere** that unfolds and folds, a **Rubik's cube** whose top layer turns, a
|
||||
**spinning top** and **dreidel** that precess, a **lighthouse** with a beam
|
||||
that sweeps around, a **blinking eyeball**, a **skull with a chattering jaw**,
|
||||
**chattering teeth**, an **octopus** with waving arms, a **jellyfish** with
|
||||
drifting tentacles, a **fish** swimming with a flapping tail, **scissors**
|
||||
that scissor, **flickering flames** (free and on a zippo lighter), and
|
||||
**spinning gears** and a **spinning fan**
|
||||
- A **3-D refracting prism**: a triangular glass prism that takes a white beam
|
||||
in one face and splits it into a full rainbow spectrum fanning out the other —
|
||||
the colours are drawn straight into the shape, independent of the field hue
|
||||
- A **3-D glass sphere** (crystal ball): a real ball lens that grabs the field
|
||||
behind it and shows it **inverted and fish-eye-distorted**, with a bright
|
||||
fresnel rim and a specular reflection highlight. Like the magnifier it samples
|
||||
the grabbed framebuffer, but with an inverting non-linear radial warp
|
||||
- An **opaque polished mirror sphere** (chrome ball): a convex mirror that
|
||||
**reflects the surrounding field upright** in a wide fish-eye — the optical
|
||||
opposite of the glass ball (which inverts what's behind it). It has metallic
|
||||
sky/ground shading so it reads as a solid metal ball even over empty space,
|
||||
plus a sharp specular highlight. The magnifier, glass-ball and mirror-ball
|
||||
**counts are each user-settable (0–1000)** — these are *extra* bodies added on
|
||||
top of the density field, so dialling them up never thins out the normal shapes
|
||||
- **Still more** in 2-D and 3-D: cassette tapes, vinyl records, CDs, quarters,
|
||||
kites, baseballs, a police box, roses, shoes, boots, pianos, clouds, soup
|
||||
cans, icebergs, pyramids (a real square pyramid in 3-D), bombs, combs, train
|
||||
crossing signs, mailboxes, ship's wheels, axes, popcorn, teapots, church
|
||||
bells, anvils, book stacks, springs and slinkies (real 3-D helices), extra
|
||||
old keys, and a set of traditional alchemical and occult symbols (sulfur,
|
||||
mercury, salt, antimony, pentagram, ankh, all-seeing eye, triple moon)
|
||||
- **Live clocks** (analog and digital, 2-D and 3-D) that show the **actual
|
||||
current time** — their geometry is rebuilt every frame, so the analog hands
|
||||
sweep and the seven-segment digital display ticks along in real time
|
||||
|
|
@ -55,6 +117,46 @@ make
|
|||
./vectorgons # or: make run
|
||||
```
|
||||
|
||||
## Windows 11 (cross-compiled from Linux)
|
||||
|
||||
A self-contained `vectorgons.exe` can be cross-compiled with the
|
||||
**MinGW-w64** toolchain. It statically links GLFW and the GCC/threads runtime,
|
||||
so on Windows it needs **only system DLLs** (`opengl32`, `glu32`, `gdi32`,
|
||||
`user32`, `shell32`, `kernel32`) — just copy `vectorgons.exe` to a Windows 11
|
||||
machine and double-click it. No console window, no extra DLLs.
|
||||
|
||||
```sh
|
||||
# 1. toolchain: sudo apt install gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev
|
||||
# 2. GLFW: download the WIN64 binaries from https://www.glfw.org/download
|
||||
# 3. build:
|
||||
make windows WINCC=x86_64-w64-mingw32-gcc GLFWDIR=/path/to/glfw-3.4.bin.WIN64
|
||||
make screensaver WINCC=x86_64-w64-mingw32-gcc GLFWDIR=/path/to/glfw-3.4.bin.WIN64
|
||||
```
|
||||
|
||||
The legacy immediate-mode OpenGL it uses (and the `glu32` perspective helpers)
|
||||
are provided by the standard Windows OpenGL driver, so it runs on any Windows 11
|
||||
box with working GPU drivers.
|
||||
|
||||
### Screensaver (`vectorgons.scr`)
|
||||
|
||||
`make screensaver` builds the **same program as a Windows screensaver** (it's
|
||||
the same source with `-DSCREENSAVER`, output named `.scr`). It handles the
|
||||
standard screensaver command line:
|
||||
|
||||
- **`/s`** (or no argument) — run full-screen on the primary monitor; **any key,
|
||||
mouse click, or real mouse movement exits**. The on-screen control panel is
|
||||
hidden.
|
||||
- **`/c`** — show a short configuration dialog. There are no in-saver controls;
|
||||
the saver simply uses whatever settings the main app last saved (see below),
|
||||
so run `vectorgons.exe`, dial in the look you want, quit, and the saver picks
|
||||
it up.
|
||||
- **`/p`** — preview (the little monitor in Windows' settings); not supported, so
|
||||
it exits cleanly and the preview stays blank.
|
||||
|
||||
To install on Windows: right-click `vectorgons.scr` → **Install** (or copy it to
|
||||
`C:\Windows\System32` and choose it under *Settings → Personalization → Lock
|
||||
screen → Screen saver*). Like the `.exe`, it needs only Windows system DLLs.
|
||||
|
||||
## Settings persistence
|
||||
|
||||
Your settings are saved automatically on exit to `~/.vectorgons` (a plain
|
||||
|
|
@ -87,6 +189,9 @@ out over a few seconds. Press any key to bring it back.
|
|||
| Color mode | `M` | Toggle **single-hue** ⇄ **multicolor** |
|
||||
| Glow | `O` / `L` | CRT glow / light bleed around vectors |
|
||||
| Flicker | `G` / `H` | Vector flicker intensity |
|
||||
| Magnifier count | `B` / `P` | How many magnifying glasses are on screen (0–1000, ±1 per press; extra, on top of the density field) |
|
||||
| Glass-ball count | `1` / `2` | How many refracting glass spheres are on screen (0–1000) |
|
||||
| Mirror-ball count | `3` / `4` | How many reflecting mirror spheres are on screen (0–1000) |
|
||||
| Shapes | `N` | Toggle random ⇄ cycling shape spawns |
|
||||
| Fullscreen | `F` or `F11` | Toggle fullscreen |
|
||||
| Pause | `Space` | |
|
||||
|
|
@ -141,6 +246,17 @@ out over a few seconds. Press any key to bring it back.
|
|||
ghost copies bloom that glow into a larger volume than the hardware line-width
|
||||
cap (~10px) could reach on its own. The crisp core is drawn last so the vector
|
||||
stays sharp; the glow setting scales the mist's spread and brightness.
|
||||
- **Magnifying glasses** are real lenses. After the field is drawn, the back
|
||||
buffer is grabbed into a texture (`glCopyTexSubImage2D`); each lens body is
|
||||
then projected to its screen position and drawn as a disc that samples that
|
||||
texture with a radial zoom — so the wireframes behind the glass appear
|
||||
genuinely enlarged, with the rim and handle drawn on top. (Pure legacy GL, so
|
||||
it works on the Linux, Windows, and screensaver builds alike.)
|
||||
- **Glass and mirror spheres** reuse the same grabbed-framebuffer trick. The
|
||||
glass ball resamples it with an *inverting* fish-eye warp (refraction). The
|
||||
mirror ball is a convex mirror: it samples *outward* from its centre with an
|
||||
*upright* fish-eye, so the surrounding shapes wrap onto its surface the right
|
||||
way up, over an opaque metallic sky/ground gradient with a specular highlight.
|
||||
- **Flicker** randomly dips each solid's brightness per frame, scaled by the
|
||||
flicker setting.
|
||||
- **Rendering** uses legacy OpenGL immediate mode (`GL_LINES`) with additive
|
||||
|
|
|
|||
BIN
vectorgons
BIN
vectorgons
Binary file not shown.
1945
vectorgons.c
1945
vectorgons.c
File diff suppressed because it is too large
Load diff
BIN
vectorgons.exe
Executable file
BIN
vectorgons.exe
Executable file
Binary file not shown.
BIN
vectorgons.scr
Executable file
BIN
vectorgons.scr
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue