gamengine3d 1.23.2__tar.gz → 1.24.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/PKG-INFO +66 -4
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/README.md +64 -3
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/__init__.py +2 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/engine.py +53 -6
- gamengine3d-1.24.1/gamengine3d/examples/basics.py +83 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/parkour.py +68 -27
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/player_movement.py +46 -17
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/reactor.py +99 -55
- gamengine3d-1.24.1/gamengine3d/examples/rounded_edges.py +94 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/director.py +1 -1
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/player_controller.py +1 -1
- gamengine3d-1.24.1/gamengine3d/examples/textures.py +118 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/transparency.py +35 -11
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/game_objects.py +1387 -975
- gamengine3d-1.24.1/gamengine3d/obj_reader.py +48 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/renderer.py +202 -83
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/shaders/default.frag +19 -3
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/shaders/default.vert +3 -0
- gamengine3d-1.24.1/gamengine3d/text_font.py +535 -0
- gamengine3d-1.24.1/gamengine3d/textures.py +406 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/PKG-INFO +66 -4
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/SOURCES.txt +4 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/requires.txt +1 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/pyproject.toml +2 -1
- gamengine3d-1.23.2/gamengine3d/examples/basics.py +0 -66
- gamengine3d-1.23.2/gamengine3d/obj_reader.py +0 -29
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/LICENSE.txt +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/assets/__init__.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/assets/circular_crosshair.png +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/assets/plus_sign_crosshair.png +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/cli.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/context.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/__init__.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/__init__.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/bouncer.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/breaker_coil.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/breaker_decoder.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/breaker_gate.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/breaker_shield.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/coin.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/collector.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/confetti.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/drone.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/ghost_pulse.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/horror_atmosphere.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/interact.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/orbiter.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/pulse.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/reactor_core.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/spin.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/sway.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/examples/scripts/void_guard.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/helper.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/0.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/1.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/2.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/3.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/4.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/5.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/6.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/7.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/8.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/9.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/A_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/B_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/C_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/D_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/E_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/F_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/G_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/H_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/I_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/J_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/K_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/L_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/M_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/N_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/O_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/P_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/Q_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/R_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/S_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/T_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/U_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/V_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/W_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/X_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/Y_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/Z_capital.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/__init__.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/a.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/ampersand.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/asterisk.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/at.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/b.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/backslash.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/brace_close.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/brace_open.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/bracket_close.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/bracket_open.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/c.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/caret.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/colon.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/comma.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/d.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/dash.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/dollar.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/dot.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/doublequote.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/e.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/equals.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/exclamation.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/f.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/g.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/greater.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/h.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/hash.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/i.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/j.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/k.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/l.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/less.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/m.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/n.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/o.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/p.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/paren_close.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/paren_open.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/percent.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/plus.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/q.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/question.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/r.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/s.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/semicolon.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/singlequote.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/slash.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/t.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/u.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/underscore.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/v.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/w.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/x.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/y.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/objects/z.obj +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/shaders/__init__.py +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/shaders/depth.frag +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d/shaders/depth.vert +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/dependency_links.txt +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/entry_points.txt +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/gamengine3d.egg-info/top_level.txt +0 -0
- {gamengine3d-1.23.2 → gamengine3d-1.24.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gamengine3d
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.24.1
|
|
4
4
|
Summary: A Unity-like 3D engine in Python using pygame
|
|
5
5
|
Author-email: Samarth Javagal <samarthjavagal@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -10,6 +10,7 @@ Classifier: Operating System :: OS Independent
|
|
|
10
10
|
Requires-Python: >=3.11
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE.txt
|
|
13
|
+
Requires-Dist: fonttools==4.69.1
|
|
13
14
|
Requires-Dist: moderngl==5.12.0
|
|
14
15
|
Requires-Dist: numpy==2.3.3
|
|
15
16
|
Requires-Dist: pygame==2.6.1
|
|
@@ -40,6 +41,9 @@ gamengine3d demo basics # a quiet lit scene, easy on the eyes
|
|
|
40
41
|
gamengine3d demo player_movement # a first-person walking sim: coins, sprint, flashlight
|
|
41
42
|
gamengine3d demo parkour # leap floating discs over a bottomless pit — in the dark
|
|
42
43
|
gamengine3d demo reactor # a full mission: restart four breakers to restore the core
|
|
44
|
+
gamengine3d demo rounded_edges # cuboids with smoothly rounded edges and corners
|
|
45
|
+
gamengine3d demo textures # procedural materials on boxes, spheres and cylinders
|
|
46
|
+
gamengine3d demo transparency # glass, ghost objects and live alpha
|
|
43
47
|
```
|
|
44
48
|
|
|
45
49
|
Run `gamengine3d demo -h` to list everything. A display is required — demos open a real window.
|
|
@@ -95,9 +99,15 @@ stare down the motion gate, reboot the shock coil, override the shield vault, de
|
|
|
95
99
|
|
|
96
100
|
**`player_movement`** — the classic first-person room: sprint, jump, collect eight glowing coins, watch the HUD count them, and check out the flashlight (press `F`).
|
|
97
101
|
|
|
98
|
-
**`basics`** — the minimal scene: floor, column, two spheres, warm lighting. The pace-setter for learning the API.
|
|
102
|
+
**`basics`** — the minimal scene: tiled floor, brushed-metal column, two patterned spheres, warm lighting. The pace-setter for learning the API.
|
|
99
103
|
|
|
100
|
-
|
|
104
|
+
**`rounded_edges`** — a row of cuboids whose corners get progressively rounder, with a hull-panel texture wrapping the rounded faces.
|
|
105
|
+
|
|
106
|
+
**`textures`** — a close-up gallery of the procedural materials: checker, tile, brick, wood, metal and more on boxes, spheres and cylinders.
|
|
107
|
+
|
|
108
|
+
**`transparency`** — glass panes, ghost text and a pulsing orb, showing how alpha and textures compose.
|
|
109
|
+
|
|
110
|
+
Every demo builds its materials with the built-in procedural texture library, so the scenes ship with no image files. All demos are plain Python files in `gamengine3d/examples/` — copy one and start hacking.
|
|
101
111
|
|
|
102
112
|
---
|
|
103
113
|
|
|
@@ -108,7 +118,59 @@ All demos are plain Python files in `gamengine3d/examples/` — copy one and sta
|
|
|
108
118
|
- **`vector3d` / `vector2d` / `Color`** — friendly helpers; `Color.RGB(255, 200, 150)`, `Color.hex("#ffc896")`, or constants like `Color.light_blue`.
|
|
109
119
|
- **Lights** — `Light` (point) and `DirectionalLight`, each casting real-time shadows.
|
|
110
120
|
|
|
111
|
-
Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`,
|
|
121
|
+
Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`, `emit` (glow without lighting) and an optional `texture` — and can be hidden but still collide.
|
|
122
|
+
|
|
123
|
+
Cuboids can also have **rounded edges and corners**: pass `corner_radius` (world units) and optionally `corner_segments` (smoothness, default 6). The radius is clamped to the box's smallest half-extent, and collision respects the rounding.
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
button = Cuboid(pos=vector3d(0, 1, 0), size=vector3d(1, 1, 1),
|
|
127
|
+
corner_radius=0.18, corner_segments=8)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Textures
|
|
131
|
+
|
|
132
|
+
Every world object (`Cuboid`, `Sphere`, `Cylinder`, `ObjModel`, `Text`) accepts a `texture` — a path to an image, a `pygame.Surface`, or an existing moderngl texture — plus `texture_scale=(u, v)` to tile it. The object's `color` multiplies the texture, so `Color.white` shows the image unchanged. Alpha in the image is respected, including cut-out holes.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
floor = Cuboid(pos=vector3d(0, -0.5, 0), size=vector3d(12, 1, 12),
|
|
136
|
+
color=Color.white, texture="brick.png", texture_scale=(6, 6))
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Textures are batched by image, so many objects can share one texture cheaply. OBJ meshes use their own `vt` coordinates when present and fall back to a box projection otherwise. Textures work alongside `corner_radius`; rounded faces, edges and corners all receive UVs. `Engine.draw_cuboid`, `draw_sphere` and `draw_cylinder` accept the same `texture=` argument.
|
|
140
|
+
|
|
141
|
+
#### Procedural materials
|
|
142
|
+
|
|
143
|
+
`gamengine3d.textures` generates tileable `pygame.Surface` materials in code, so you never need to ship image files. Every generator takes a `seed` and colour options:
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from gamengine3d import Cuboid, Color, vector3d
|
|
147
|
+
from gamengine3d.textures import tiles, metal, planks
|
|
148
|
+
|
|
149
|
+
floor = Cuboid(pos=vector3d(0, -0.5, 0), size=vector3d(20, 1, 20),
|
|
150
|
+
color=Color.white, texture=tiles(seed=1), texture_scale=(10, 10))
|
|
151
|
+
wall = Cuboid(pos=vector3d(0, 2, -10), size=vector3d(20, 5, 0.4),
|
|
152
|
+
color=Color.white, texture=metal(seed=2), texture_scale=(6, 2))
|
|
153
|
+
table = Cuboid(pos=vector3d(0, 1, 0), size=vector3d(3, 0.2, 1.5),
|
|
154
|
+
color=Color.white, texture=planks(seed=3), texture_scale=(2, 1))
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Available generators: `checker`, `tiles`, `bricks`, `planks` (alias `wood`), `metal`, `panel`, `grid`, `concrete`, `stone`, `rust`, `hazard`, `circuit`, `dots`, and `stripes`. The object's `color` still multiplies the result, so a neutral material can be tinted per object — the demos use this for coloured platforms and crates.
|
|
158
|
+
|
|
159
|
+
### 3D text
|
|
160
|
+
|
|
161
|
+
`Text` renders real 3D text. Glyphs aren't pre-baked OBJ files — they're read from a real font with `fontTools`, curves are flattened, and each glyph is extruded into a solid slab. Layout uses the font's true advance widths, a baseline, kerning, and real **spaces** (no more faking it with `_`).
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
label = Text(text="Hello World! 123", color=Color.white, scale=vector3d(0.6),
|
|
165
|
+
rotation=vector3d(90, 0, 0), center=True,
|
|
166
|
+
spacing=0.0, # extra letter-spacing (em)
|
|
167
|
+
kerning=True, # font kerning pairs
|
|
168
|
+
depth=0.1, # extrusion thickness
|
|
169
|
+
font="FreeSans.otf", # any .ttf/.otf path, a fontTools TTFont, or None for the bundled font
|
|
170
|
+
emit=True, transparency=1.0, texture=None, texture_scale=(1, 1))
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`rotation=vector3d(90, 0, 0)` makes flat text stand up facing the camera. `texture` tiles an image across each glyph, and transparency/emission work as on any object. The bundled default font is pygame's `freesansbold.ttf`; point `font=` at any font file to render any typeface. The pipeline lives in `gamengine3d.text_font` (`Font`, `extrude_glyph`, ...).
|
|
112
174
|
|
|
113
175
|
---
|
|
114
176
|
|
|
@@ -19,6 +19,9 @@ gamengine3d demo basics # a quiet lit scene, easy on the eyes
|
|
|
19
19
|
gamengine3d demo player_movement # a first-person walking sim: coins, sprint, flashlight
|
|
20
20
|
gamengine3d demo parkour # leap floating discs over a bottomless pit — in the dark
|
|
21
21
|
gamengine3d demo reactor # a full mission: restart four breakers to restore the core
|
|
22
|
+
gamengine3d demo rounded_edges # cuboids with smoothly rounded edges and corners
|
|
23
|
+
gamengine3d demo textures # procedural materials on boxes, spheres and cylinders
|
|
24
|
+
gamengine3d demo transparency # glass, ghost objects and live alpha
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
Run `gamengine3d demo -h` to list everything. A display is required — demos open a real window.
|
|
@@ -74,9 +77,15 @@ stare down the motion gate, reboot the shock coil, override the shield vault, de
|
|
|
74
77
|
|
|
75
78
|
**`player_movement`** — the classic first-person room: sprint, jump, collect eight glowing coins, watch the HUD count them, and check out the flashlight (press `F`).
|
|
76
79
|
|
|
77
|
-
**`basics`** — the minimal scene: floor, column, two spheres, warm lighting. The pace-setter for learning the API.
|
|
80
|
+
**`basics`** — the minimal scene: tiled floor, brushed-metal column, two patterned spheres, warm lighting. The pace-setter for learning the API.
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
**`rounded_edges`** — a row of cuboids whose corners get progressively rounder, with a hull-panel texture wrapping the rounded faces.
|
|
83
|
+
|
|
84
|
+
**`textures`** — a close-up gallery of the procedural materials: checker, tile, brick, wood, metal and more on boxes, spheres and cylinders.
|
|
85
|
+
|
|
86
|
+
**`transparency`** — glass panes, ghost text and a pulsing orb, showing how alpha and textures compose.
|
|
87
|
+
|
|
88
|
+
Every demo builds its materials with the built-in procedural texture library, so the scenes ship with no image files. All demos are plain Python files in `gamengine3d/examples/` — copy one and start hacking.
|
|
80
89
|
|
|
81
90
|
---
|
|
82
91
|
|
|
@@ -87,7 +96,59 @@ All demos are plain Python files in `gamengine3d/examples/` — copy one and sta
|
|
|
87
96
|
- **`vector3d` / `vector2d` / `Color`** — friendly helpers; `Color.RGB(255, 200, 150)`, `Color.hex("#ffc896")`, or constants like `Color.light_blue`.
|
|
88
97
|
- **Lights** — `Light` (point) and `DirectionalLight`, each casting real-time shadows.
|
|
89
98
|
|
|
90
|
-
Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`,
|
|
99
|
+
Every object has `pos`, `size/radius`, `rotation`, `color`, `visible`, `emit` (glow without lighting) and an optional `texture` — and can be hidden but still collide.
|
|
100
|
+
|
|
101
|
+
Cuboids can also have **rounded edges and corners**: pass `corner_radius` (world units) and optionally `corner_segments` (smoothness, default 6). The radius is clamped to the box's smallest half-extent, and collision respects the rounding.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
button = Cuboid(pos=vector3d(0, 1, 0), size=vector3d(1, 1, 1),
|
|
105
|
+
corner_radius=0.18, corner_segments=8)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Textures
|
|
109
|
+
|
|
110
|
+
Every world object (`Cuboid`, `Sphere`, `Cylinder`, `ObjModel`, `Text`) accepts a `texture` — a path to an image, a `pygame.Surface`, or an existing moderngl texture — plus `texture_scale=(u, v)` to tile it. The object's `color` multiplies the texture, so `Color.white` shows the image unchanged. Alpha in the image is respected, including cut-out holes.
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
floor = Cuboid(pos=vector3d(0, -0.5, 0), size=vector3d(12, 1, 12),
|
|
114
|
+
color=Color.white, texture="brick.png", texture_scale=(6, 6))
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Textures are batched by image, so many objects can share one texture cheaply. OBJ meshes use their own `vt` coordinates when present and fall back to a box projection otherwise. Textures work alongside `corner_radius`; rounded faces, edges and corners all receive UVs. `Engine.draw_cuboid`, `draw_sphere` and `draw_cylinder` accept the same `texture=` argument.
|
|
118
|
+
|
|
119
|
+
#### Procedural materials
|
|
120
|
+
|
|
121
|
+
`gamengine3d.textures` generates tileable `pygame.Surface` materials in code, so you never need to ship image files. Every generator takes a `seed` and colour options:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from gamengine3d import Cuboid, Color, vector3d
|
|
125
|
+
from gamengine3d.textures import tiles, metal, planks
|
|
126
|
+
|
|
127
|
+
floor = Cuboid(pos=vector3d(0, -0.5, 0), size=vector3d(20, 1, 20),
|
|
128
|
+
color=Color.white, texture=tiles(seed=1), texture_scale=(10, 10))
|
|
129
|
+
wall = Cuboid(pos=vector3d(0, 2, -10), size=vector3d(20, 5, 0.4),
|
|
130
|
+
color=Color.white, texture=metal(seed=2), texture_scale=(6, 2))
|
|
131
|
+
table = Cuboid(pos=vector3d(0, 1, 0), size=vector3d(3, 0.2, 1.5),
|
|
132
|
+
color=Color.white, texture=planks(seed=3), texture_scale=(2, 1))
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Available generators: `checker`, `tiles`, `bricks`, `planks` (alias `wood`), `metal`, `panel`, `grid`, `concrete`, `stone`, `rust`, `hazard`, `circuit`, `dots`, and `stripes`. The object's `color` still multiplies the result, so a neutral material can be tinted per object — the demos use this for coloured platforms and crates.
|
|
136
|
+
|
|
137
|
+
### 3D text
|
|
138
|
+
|
|
139
|
+
`Text` renders real 3D text. Glyphs aren't pre-baked OBJ files — they're read from a real font with `fontTools`, curves are flattened, and each glyph is extruded into a solid slab. Layout uses the font's true advance widths, a baseline, kerning, and real **spaces** (no more faking it with `_`).
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
label = Text(text="Hello World! 123", color=Color.white, scale=vector3d(0.6),
|
|
143
|
+
rotation=vector3d(90, 0, 0), center=True,
|
|
144
|
+
spacing=0.0, # extra letter-spacing (em)
|
|
145
|
+
kerning=True, # font kerning pairs
|
|
146
|
+
depth=0.1, # extrusion thickness
|
|
147
|
+
font="FreeSans.otf", # any .ttf/.otf path, a fontTools TTFont, or None for the bundled font
|
|
148
|
+
emit=True, transparency=1.0, texture=None, texture_scale=(1, 1))
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`rotation=vector3d(90, 0, 0)` makes flat text stand up facing the camera. `texture` tiles an image across each glyph, and transparency/emission work as on any object. The bundled default font is pygame's `freesansbold.ttf`; point `font=` at any font file to render any typeface. The pipeline lives in `gamengine3d.text_font` (`Font`, `extrude_glyph`, ...).
|
|
91
152
|
|
|
92
153
|
---
|
|
93
154
|
|
|
@@ -5,7 +5,10 @@ from itertools import product
|
|
|
5
5
|
from pyrr import Matrix44
|
|
6
6
|
from .context import Context
|
|
7
7
|
import pygame
|
|
8
|
-
from .game_objects import
|
|
8
|
+
from .game_objects import (
|
|
9
|
+
Cuboid, GameObject, Sphere, Cylinder, ObjModel, Text, ImageOverlay,
|
|
10
|
+
_rounded_box_vertices, _emit_triplet, _uv_scale_pair, _uv_scale_triple,
|
|
11
|
+
)
|
|
9
12
|
from .helper import vector3d, Color, Light, EngineError, Script, ray_intersect_aabb, vector2d
|
|
10
13
|
from .renderer import Renderer, Camera
|
|
11
14
|
from pathlib import Path
|
|
@@ -335,13 +338,36 @@ class Engine:
|
|
|
335
338
|
|
|
336
339
|
return (obj1.x - obj2.x) ** 2 + (obj1.y - obj2.y) ** 2 + (obj1.z - obj2.z) ** 2 <= radius ** 2
|
|
337
340
|
|
|
338
|
-
def draw_cuboid(self, pos: vector3d=None, size: vector3d=None, rotation: vector3d=None, color: Color = Color.light_blue, emit: bool = False, transparency: float = 1.0):
|
|
341
|
+
def draw_cuboid(self, pos: vector3d=None, size: vector3d=None, rotation: vector3d=None, color: Color = Color.light_blue, emit: bool = False, transparency: float = 1.0, corner_radius: float = 0.0, corner_segments: int = 6, texture=None, texture_scale=(1.0, 1.0)):
|
|
339
342
|
if pos is None:
|
|
340
343
|
pos = vector3d.zero
|
|
341
344
|
if size is None:
|
|
342
345
|
size = vector3d(2)
|
|
343
346
|
if rotation is None:
|
|
344
347
|
rotation = vector3d.zero
|
|
348
|
+
texture_scale = _uv_scale_triple(texture_scale)
|
|
349
|
+
|
|
350
|
+
if corner_radius > 0:
|
|
351
|
+
# Match the rotation convention used by the sharp path below.
|
|
352
|
+
rot3 = Matrix44.from_eulers((
|
|
353
|
+
math.radians(rotation.x),
|
|
354
|
+
math.radians(rotation.y),
|
|
355
|
+
math.radians(rotation.z)
|
|
356
|
+
))[:3, :3]
|
|
357
|
+
verts = _rounded_box_vertices(
|
|
358
|
+
size / 2, corner_radius, corner_segments,
|
|
359
|
+
color.to_rgb(), rot3, _emit_triplet(emit),
|
|
360
|
+
uv_scale=texture_scale,
|
|
361
|
+
)
|
|
362
|
+
if verts:
|
|
363
|
+
ox, oy, oz = pos.x, pos.y, pos.z
|
|
364
|
+
for i in range(0, len(verts), 14):
|
|
365
|
+
verts[i] += ox
|
|
366
|
+
verts[i + 1] += oy
|
|
367
|
+
verts[i + 2] += oz
|
|
368
|
+
self.renderer._append_vertices(verts, alpha=transparency, texture=texture)
|
|
369
|
+
return
|
|
370
|
+
|
|
345
371
|
faces = [
|
|
346
372
|
[0, 1, 3, 2],
|
|
347
373
|
[4, 6, 7, 5],
|
|
@@ -359,9 +385,11 @@ class Engine:
|
|
|
359
385
|
math.radians(rotation.z)
|
|
360
386
|
))
|
|
361
387
|
|
|
388
|
+
raws = []
|
|
362
389
|
corners = []
|
|
363
390
|
for dx, dy, dz in product([-1, 1], repeat=3):
|
|
364
391
|
local = vector3d(dx * half_size.x, dy * half_size.y, dz * half_size.z)
|
|
392
|
+
raws.append(local)
|
|
365
393
|
|
|
366
394
|
rotated = vector3d(
|
|
367
395
|
*(rot_matrix @ [local.x, local.y, local.z, 1.0])[:3]
|
|
@@ -371,6 +399,23 @@ class Engine:
|
|
|
371
399
|
corners.append(world)
|
|
372
400
|
|
|
373
401
|
for face_idx in faces:
|
|
402
|
+
raws_face = [raws[i] for i in face_idx]
|
|
403
|
+
raw_tuples = [r.totuple() for r in raws_face]
|
|
404
|
+
# The face's constant local axis; map the other two to [0, 1].
|
|
405
|
+
axis = next(
|
|
406
|
+
a for a in range(3)
|
|
407
|
+
if len({round(r[a], 9) for r in raw_tuples}) == 1
|
|
408
|
+
)
|
|
409
|
+
a_axis, b_axis = [i for i in range(3) if i != axis]
|
|
410
|
+
half = half_size.totuple()
|
|
411
|
+
da = max(2.0 * abs(half[a_axis]), 1e-9)
|
|
412
|
+
db = max(2.0 * abs(half[b_axis]), 1e-9)
|
|
413
|
+
uvs = [
|
|
414
|
+
((r[a_axis] / da + 0.5) * texture_scale[a_axis],
|
|
415
|
+
(r[b_axis] / db + 0.5) * texture_scale[b_axis])
|
|
416
|
+
for r in raw_tuples
|
|
417
|
+
]
|
|
418
|
+
|
|
374
419
|
self.renderer.render_quad(
|
|
375
420
|
corners[face_idx[0]],
|
|
376
421
|
corners[face_idx[1]],
|
|
@@ -379,19 +424,21 @@ class Engine:
|
|
|
379
424
|
color=color,
|
|
380
425
|
emit=emit,
|
|
381
426
|
alpha=transparency,
|
|
427
|
+
texture=texture,
|
|
428
|
+
uvs=uvs,
|
|
382
429
|
)
|
|
383
430
|
|
|
384
|
-
def draw_sphere(self, pos: vector3d=None, radius: int=2, color: Color=Color.light_red, segments=32, rings=16, emit: bool = False, transparency: float = 1.0):
|
|
431
|
+
def draw_sphere(self, pos: vector3d=None, radius: int=2, color: Color=Color.light_red, segments=32, rings=16, emit: bool = False, transparency: float = 1.0, texture=None):
|
|
385
432
|
if pos is None:
|
|
386
433
|
pos = vector3d.zero
|
|
387
|
-
self.renderer.render_sphere(center=pos, radius=radius, color=color, segments=segments, rings=rings, emit=emit, alpha=transparency)
|
|
434
|
+
self.renderer.render_sphere(center=pos, radius=radius, color=color, segments=segments, rings=rings, emit=emit, alpha=transparency, texture=texture)
|
|
388
435
|
|
|
389
|
-
def draw_cylinder(self, pos: vector3d=None, length: int=2, radius: int=.5, color: Color=Color.light_yellow, segments: int=32, rotation: vector3d=None, emit: bool = False, transparency: float = 1.0):
|
|
436
|
+
def draw_cylinder(self, pos: vector3d=None, length: int=2, radius: int=.5, color: Color=Color.light_yellow, segments: int=32, rotation: vector3d=None, emit: bool = False, transparency: float = 1.0, texture=None):
|
|
390
437
|
if pos is None:
|
|
391
438
|
pos = vector3d.zero
|
|
392
439
|
if rotation is None:
|
|
393
440
|
rotation = vector3d.zero
|
|
394
|
-
self.renderer.render_cylinder(center=pos, height=length, radius=radius, color=color, segments=segments, rotation=rotation, emit=emit, alpha=transparency)
|
|
441
|
+
self.renderer.render_cylinder(center=pos, height=length, radius=radius, color=color, segments=segments, rotation=rotation, emit=emit, alpha=transparency, texture=texture)
|
|
395
442
|
|
|
396
443
|
def attach(self, path):
|
|
397
444
|
script = Script(self, path, self.context)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from gamengine3d import Engine, Cuboid, Sphere, vector3d, Light, Color
|
|
2
|
+
from gamengine3d.textures import tiles, metal, checker, dots
|
|
3
|
+
|
|
4
|
+
engine = Engine(
|
|
5
|
+
800, 600,
|
|
6
|
+
background_color=Color.RGB(30, 30, 40),
|
|
7
|
+
ambient_light=0.3,
|
|
8
|
+
name="Basics Demo"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# Materials are generated procedurally at start-up. Reusing one Surface across
|
|
12
|
+
# several objects is efficient: the renderer caches the GPU texture by source.
|
|
13
|
+
floor_tex = tiles(seed=1, tile=(120, 124, 134), grout=(34, 36, 44))
|
|
14
|
+
column_tex = metal(seed=2, base=(150, 156, 168))
|
|
15
|
+
purple_tex = checker(seed=3, light=(255, 255, 255), dark=(150, 110, 190))
|
|
16
|
+
blue_tex = dots(seed=4, bg=(40, 80, 140), dot=(220, 235, 255))
|
|
17
|
+
|
|
18
|
+
# Tiled stone floor.
|
|
19
|
+
floor = Cuboid(
|
|
20
|
+
pos=vector3d(0, -0.5, 0),
|
|
21
|
+
size=vector3d(20, 1, 20),
|
|
22
|
+
color=Color.white,
|
|
23
|
+
name="Floor",
|
|
24
|
+
texture=floor_tex,
|
|
25
|
+
texture_scale=(10, 10),
|
|
26
|
+
)
|
|
27
|
+
engine.add_object(floor)
|
|
28
|
+
|
|
29
|
+
# Brushed-metal central column. texture_scale is (u, v), so (1, 3) repeats the
|
|
30
|
+
# metal once across and three times up the tall face.
|
|
31
|
+
column = Cuboid(
|
|
32
|
+
pos=vector3d(0, 1.5, 0),
|
|
33
|
+
size=vector3d(0.5, 3, 0.5),
|
|
34
|
+
color=Color.white,
|
|
35
|
+
name="Column",
|
|
36
|
+
texture=column_tex,
|
|
37
|
+
texture_scale=(1, 3),
|
|
38
|
+
)
|
|
39
|
+
engine.add_object(column)
|
|
40
|
+
|
|
41
|
+
# Add a nice warm light
|
|
42
|
+
light = Light(
|
|
43
|
+
position=vector3d(0, 5, 3),
|
|
44
|
+
color=Color.RGB(255, 200, 150),
|
|
45
|
+
intensity=1.5,
|
|
46
|
+
name="WarmLight"
|
|
47
|
+
)
|
|
48
|
+
engine.add_light(light)
|
|
49
|
+
|
|
50
|
+
# Add ambient fill
|
|
51
|
+
ambient = Light(
|
|
52
|
+
position=vector3d(0, 10, 0),
|
|
53
|
+
color=Color.RGB(100, 100, 110),
|
|
54
|
+
intensity=0.2,
|
|
55
|
+
name="Ambient"
|
|
56
|
+
)
|
|
57
|
+
engine.add_light(ambient)
|
|
58
|
+
|
|
59
|
+
# A decorative sphere wrapped in a checker pattern.
|
|
60
|
+
sphere = Sphere(
|
|
61
|
+
pos=vector3d(-2, 2, -3),
|
|
62
|
+
radius=1.2,
|
|
63
|
+
color=Color.RGB(220, 180, 255),
|
|
64
|
+
name="DecorativeSphere",
|
|
65
|
+
texture=purple_tex,
|
|
66
|
+
texture_scale=(2, 1),
|
|
67
|
+
)
|
|
68
|
+
engine.add_object(sphere)
|
|
69
|
+
|
|
70
|
+
# Another sphere on the other side, this one with polka dots.
|
|
71
|
+
sphere2 = Sphere(
|
|
72
|
+
pos=vector3d(2, 2, 3),
|
|
73
|
+
radius=1.0,
|
|
74
|
+
color=Color.RGB(150, 190, 255),
|
|
75
|
+
name="DecorativeSphere2",
|
|
76
|
+
texture=blue_tex,
|
|
77
|
+
texture_scale=(2, 1),
|
|
78
|
+
)
|
|
79
|
+
engine.add_object(sphere2)
|
|
80
|
+
|
|
81
|
+
engine.camera.move_to(vector3d(0, 3, 8))
|
|
82
|
+
engine.camera.look_at(vector3d(0, 1.5, 0))
|
|
83
|
+
engine.run(dynamic_view=False)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
from gamengine3d import Engine, Cuboid, Cylinder, Sphere, Text, Light, Color, vector3d
|
|
3
|
+
from gamengine3d.textures import tiles, panel, metal, rust, concrete
|
|
3
4
|
|
|
4
5
|
# ---------------------------------------------------------------- Engine
|
|
5
6
|
|
|
@@ -25,9 +26,24 @@ RUST = Color.RGB(86, 56, 40) # the start disc
|
|
|
25
26
|
GUNMETAL = Color.RGB(108, 112, 120)
|
|
26
27
|
EMBER = Color.RGB(150, 36, 34) # the summit disc, heated and glowing
|
|
27
28
|
|
|
29
|
+
# ---------------------------------------------------------------- Materials
|
|
30
|
+
# Textures are generated once and shared. Base tints match the scene's palette
|
|
31
|
+
# so the grime reads without lifting the darkness.
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
wall_tex = panel(seed=41, base=(24, 27, 34), seam=(9, 11, 15), accent=(40, 90, 120), cells=5)
|
|
34
|
+
rim_tex = tiles(seed=42, tile=(36, 39, 47), grout=(16, 18, 23))
|
|
35
|
+
void_tex = concrete(seed=43, base=(5, 6, 9))
|
|
36
|
+
disc_tex = metal(seed=44, base=(228, 232, 240), streak=10)
|
|
37
|
+
column_tex = metal(seed=45, base=(58, 62, 72), rivets=False)
|
|
38
|
+
rust_tex = rust(seed=46, base=(120, 112, 112), rust_color=(110, 52, 30), amount=0.7)
|
|
39
|
+
vent_tex = metal(seed=47, base=(52, 56, 64))
|
|
40
|
+
monolith_tex = concrete(seed=48, base=(18, 20, 26))
|
|
41
|
+
cable_tex = metal(seed=49, base=(200, 204, 212), rivets=False)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def solid(name, pos, size, color, emit=False, texture=None, texture_scale=(1, 1)):
|
|
45
|
+
obj = Cuboid(pos=pos, size=size, color=color, name=f"Solid_{name}", emit=emit,
|
|
46
|
+
texture=texture, texture_scale=texture_scale)
|
|
31
47
|
engine.add_object(obj)
|
|
32
48
|
return obj
|
|
33
49
|
|
|
@@ -35,9 +51,10 @@ def solid(name, pos, size, color, emit=False):
|
|
|
35
51
|
_prop_count = [0]
|
|
36
52
|
|
|
37
53
|
|
|
38
|
-
def deco(pos, size, color, emit=False):
|
|
54
|
+
def deco(pos, size, color, emit=False, texture=None, texture_scale=(1, 1)):
|
|
39
55
|
_prop_count[0] += 1
|
|
40
|
-
obj = Cuboid(name=f"Prop{_prop_count[0]:03d}", pos=pos, size=size, color=color, emit=emit
|
|
56
|
+
obj = Cuboid(name=f"Prop{_prop_count[0]:03d}", pos=pos, size=size, color=color, emit=emit,
|
|
57
|
+
texture=texture, texture_scale=texture_scale)
|
|
41
58
|
engine.add_object(obj)
|
|
42
59
|
return obj
|
|
43
60
|
|
|
@@ -61,37 +78,50 @@ def disc(name, x, z, r, top_y, col, emit=False):
|
|
|
61
78
|
color=col,
|
|
62
79
|
name=f"Disc_{name}",
|
|
63
80
|
emit=emit,
|
|
81
|
+
texture=disc_tex,
|
|
82
|
+
texture_scale=(r, 1),
|
|
64
83
|
))
|
|
65
84
|
engine.add_object(Cylinder(
|
|
66
85
|
pos=vector3d(x, (top_y - 0.3 + VOID_BOTTOM) / 2, z),
|
|
67
86
|
length=(top_y - 0.3) - VOID_BOTTOM,
|
|
68
87
|
radius=0.18,
|
|
69
|
-
color=Color.
|
|
88
|
+
color=Color.white,
|
|
70
89
|
name=f"Col_{name}",
|
|
90
|
+
texture=column_tex,
|
|
91
|
+
texture_scale=(1, 14),
|
|
71
92
|
))
|
|
72
93
|
|
|
73
94
|
|
|
74
95
|
# ---------------------------------------------------------------- Room + void
|
|
75
96
|
|
|
76
|
-
ceiling = solid("Ceiling", vector3d(0, HEIGHT + 0.5, 0), vector3d(ROOM_X, 1, ROOM_Z),
|
|
97
|
+
ceiling = solid("Ceiling", vector3d(0, HEIGHT + 0.5, 0), vector3d(ROOM_X, 1, ROOM_Z),
|
|
98
|
+
Color.white, texture=wall_tex, texture_scale=(12, 7))
|
|
77
99
|
ceiling.shadow_caster = False
|
|
78
|
-
solid("Wall_Back", vector3d(0, 2.0, -ROOM_Z / 2), vector3d(ROOM_X, HEIGHT, 0.2),
|
|
79
|
-
|
|
80
|
-
solid("
|
|
81
|
-
|
|
100
|
+
solid("Wall_Back", vector3d(0, 2.0, -ROOM_Z / 2), vector3d(ROOM_X, HEIGHT, 0.2),
|
|
101
|
+
Color.white, texture=wall_tex, texture_scale=(12, 7))
|
|
102
|
+
solid("Wall_Front", vector3d(0, 2.0, ROOM_Z / 2), vector3d(ROOM_X, HEIGHT, 0.2),
|
|
103
|
+
Color.white, texture=wall_tex, texture_scale=(12, 7))
|
|
104
|
+
solid("Wall_Left", vector3d(-ROOM_X / 2, 2.0, 0), vector3d(0.2, HEIGHT, ROOM_Z),
|
|
105
|
+
Color.white, texture=wall_tex, texture_scale=(10, 7))
|
|
106
|
+
solid("Wall_Right", vector3d(ROOM_X / 2, 2.0, 0), vector3d(0.2, HEIGHT, ROOM_Z),
|
|
107
|
+
Color.white, texture=wall_tex, texture_scale=(10, 7))
|
|
82
108
|
|
|
83
109
|
# Ring of floor around an open pit. Four non-overlapping slabs, all top at y=0.
|
|
84
110
|
half_void_x = ROOM_X / 2 - RIM # 19
|
|
85
111
|
half_void_z = ROOM_Z / 2 - RIM # 14
|
|
86
|
-
solid("Rim_Left", vector3d(-(ROOM_X / 2 + half_void_x) / 2, -0.5, 0), vector3d(RIM, 1, ROOM_Z - 2 * RIM),
|
|
87
|
-
|
|
88
|
-
solid("
|
|
89
|
-
|
|
112
|
+
solid("Rim_Left", vector3d(-(ROOM_X / 2 + half_void_x) / 2, -0.5, 0), vector3d(RIM, 1, ROOM_Z - 2 * RIM),
|
|
113
|
+
Color.white, texture=rim_tex, texture_scale=(3, 17))
|
|
114
|
+
solid("Rim_Right", vector3d((ROOM_X / 2 + half_void_x) / 2, -0.5, 0), vector3d(RIM, 1, ROOM_Z - 2 * RIM),
|
|
115
|
+
Color.white, texture=rim_tex, texture_scale=(3, 17))
|
|
116
|
+
solid("Rim_Back", vector3d(0, -0.5, -(ROOM_Z / 2 + half_void_z) / 2), vector3d(ROOM_X - 2 * RIM, 1, RIM),
|
|
117
|
+
Color.white, texture=rim_tex, texture_scale=(24, 3))
|
|
118
|
+
solid("Rim_Front", vector3d(0, -0.5, (ROOM_Z / 2 + half_void_z) / 2), vector3d(ROOM_X - 2 * RIM, 1, RIM),
|
|
119
|
+
Color.white, texture=rim_tex, texture_scale=(24, 3))
|
|
90
120
|
|
|
91
121
|
# Far-down dark slab so the pit reads as bottomless.
|
|
92
122
|
void_floor = solid("VoidFloor", vector3d(0, VOID_BOTTOM - 0.5, 0),
|
|
93
123
|
vector3d(2 * half_void_x + 4, 1, 2 * half_void_z + 4),
|
|
94
|
-
Color.
|
|
124
|
+
Color.white, texture=void_tex, texture_scale=(16, 12))
|
|
95
125
|
void_floor.shadow_caster = False
|
|
96
126
|
|
|
97
127
|
# ---------------------------------------------------------------- Big disc course
|
|
@@ -138,22 +168,29 @@ for x, h in ((-12.4, 2.6), (-12.0, 1.5), (-11.6, 0.8), (6.1, 2.0), (5.7, 1.1)):
|
|
|
138
168
|
deco(vector3d(x, h / 2, -18.92), vector3d(0.08, h, 0.06), Color.RGB(66, 9, 11))
|
|
139
169
|
|
|
140
170
|
# Rust blooms on the side walls.
|
|
141
|
-
deco(vector3d(-23.88, 11.0, -6), vector3d(0.1, 3.4, 2.6), Color.
|
|
142
|
-
|
|
171
|
+
deco(vector3d(-23.88, 11.0, -6), vector3d(0.1, 3.4, 2.6), Color.white,
|
|
172
|
+
texture=rust_tex, texture_scale=(2, 1))
|
|
173
|
+
deco(vector3d(23.88, 6.0, 8), vector3d(0.1, 4.2, 1.4), Color.white,
|
|
174
|
+
texture=rust_tex, texture_scale=(2, 1))
|
|
143
175
|
|
|
144
176
|
# Wall vents.
|
|
145
|
-
deco(vector3d(-23.86, 9.0, 5), vector3d(0.12, 1.4, 1.6), Color.
|
|
177
|
+
deco(vector3d(-23.86, 9.0, 5), vector3d(0.12, 1.4, 1.6), Color.white,
|
|
178
|
+
texture=vent_tex, texture_scale=(1, 1))
|
|
146
179
|
for sy in (8.6, 9.0, 9.4):
|
|
147
180
|
deco(vector3d(-23.78, sy, 5), vector3d(0.14, 0.05, 1.2), Color.RGB(18, 19, 23))
|
|
148
|
-
deco(vector3d(23.86, 12.0, -7), vector3d(0.12, 1.2, 1.5), Color.
|
|
181
|
+
deco(vector3d(23.86, 12.0, -7), vector3d(0.12, 1.2, 1.5), Color.white,
|
|
182
|
+
texture=vent_tex, texture_scale=(1, 1))
|
|
149
183
|
for sy in (11.6, 12.0, 12.4):
|
|
150
184
|
deco(vector3d(23.78, sy, -7), vector3d(0.14, 0.05, 1.1), Color.RGB(18, 19, 23))
|
|
151
185
|
|
|
152
186
|
# Faint hazard strips along the four void edges (glow faintly in the dark).
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
for sx, sz, w, d in (
|
|
188
|
+
(0, -half_void_z + 0.06, 2 * half_void_x - 0.6, 0.14),
|
|
189
|
+
(0, half_void_z - 0.06, 2 * half_void_x - 0.6, 0.14),
|
|
190
|
+
(-half_void_x + 0.06, 0, 0.14, 2 * half_void_z - 0.6),
|
|
191
|
+
(half_void_x - 0.06, 0, 0.14, 2 * half_void_z - 0.6),
|
|
192
|
+
):
|
|
193
|
+
deco(vector3d(sx, 0.01, sz), vector3d(w, 0.02, d), Color.RGB(150, 70, 20), emit=True)
|
|
157
194
|
|
|
158
195
|
# Wet, glistening patches on the rim floor.
|
|
159
196
|
for px, pz, sx, sz in ((-21.5, -11.0, 1.4, 2.2), (21.0, 13.0, 1.1, 1.9), (-6.0, -16.5, 1.7, 1.2), (10.0, 16.5, 1.3, 1.6)):
|
|
@@ -161,7 +198,8 @@ for px, pz, sx, sz in ((-21.5, -11.0, 1.4, 2.2), (21.0, 13.0, 1.1, 1.9), (-6.0,
|
|
|
161
198
|
|
|
162
199
|
# Dead monoliths in the four corners.
|
|
163
200
|
for mx, mz, mh in (-21.8, -16.8, 7.0), (21.8, -16.8, 8.0), (-21.8, 16.8, 6.4), (21.8, 16.8, 7.0):
|
|
164
|
-
deco(vector3d(mx, mh / 2, mz), vector3d(1.0, mh, 1.0), Color.
|
|
201
|
+
deco(vector3d(mx, mh / 2, mz), vector3d(1.0, mh, 1.0), Color.white,
|
|
202
|
+
texture=monolith_tex, texture_scale=(1, 2))
|
|
165
203
|
|
|
166
204
|
# Hanging cables and lamps, slow-swaying.
|
|
167
205
|
for hx, hz, bottom, radius, color, lamp in (
|
|
@@ -176,9 +214,12 @@ for hx, hz, bottom, radius, color, lamp in (
|
|
|
176
214
|
radius=radius,
|
|
177
215
|
color=color,
|
|
178
216
|
name=f"Cable{int(hx)}_{int(hz)}",
|
|
217
|
+
texture=cable_tex,
|
|
218
|
+
texture_scale=(1, 16),
|
|
179
219
|
)))
|
|
180
220
|
if lamp:
|
|
181
|
-
attach_sway(deco(vector3d(hx, bottom - 0.4, hz), vector3d(0.5, 0.4, 0.5),
|
|
221
|
+
attach_sway(deco(vector3d(hx, bottom - 0.4, hz), vector3d(0.5, 0.4, 0.5),
|
|
222
|
+
Color.white, texture=vent_tex, texture_scale=(1, 1)))
|
|
182
223
|
|
|
183
224
|
# ---------------------------------------------------------------- Coins
|
|
184
225
|
|
|
@@ -242,7 +283,7 @@ engine.add_object(eye)
|
|
|
242
283
|
|
|
243
284
|
score_hud = Text(
|
|
244
285
|
pos=vector3d(0, 4.6, -ROOM_Z / 2 + 0.18),
|
|
245
|
-
text="coins:
|
|
286
|
+
text="coins: 0 of 8",
|
|
246
287
|
color=Color.RGB(235, 190, 70),
|
|
247
288
|
scale=vector3d(0.6),
|
|
248
289
|
spacing=0.12,
|
|
@@ -255,7 +296,7 @@ engine.add_object(score_hud)
|
|
|
255
296
|
|
|
256
297
|
engine.add_object(Text(
|
|
257
298
|
pos=vector3d(0, 3.4, -ROOM_Z / 2 + 0.18),
|
|
258
|
-
text="run:shift.light:f.
|
|
299
|
+
text="run: shift. light: f. its watching",
|
|
259
300
|
color=Color.RGB(120, 125, 135),
|
|
260
301
|
scale=vector3d(0.3),
|
|
261
302
|
spacing=0.12,
|