scad-gltf 0.2.1 → 0.2.2

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.
package/bevy/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # OpenSCAD GLTF Integration for Rust Bevy
2
+
3
+ This folder contains resources and examples for integrating procedural OpenSCAD (`.scad`) 3D assets natively into the [Bevy](https://bevyengine.org/) game engine using the `scad-gltf` compiler.
4
+
5
+ Unlike Godot (which uses a native editor plugin), Bevy integration is achieved programmatically at compile-time using a custom `build.rs` script. This script automatically watches your `.scad` files and compiles them into binary `.glb` meshes in your `assets/models` folder before the game compiles and runs.
6
+
7
+ ## 🛠️ How It Works
8
+
9
+ To use OpenSCAD files in your Bevy project, ensure you have the CLI compiler installed globally on your machine:
10
+
11
+ ```bash
12
+ npm install -g scad-gltf
13
+ ```
14
+
15
+ Then, add a `build.rs` script to the root of your Bevy project (next to `Cargo.toml`):
16
+
17
+ ```rust
18
+ use std::process::Command;
19
+
20
+ fn main() {
21
+ // Tell Cargo to re-run this script only if the 'scad' directory changes
22
+ println!("cargo::rerun-if-changed=scad");
23
+
24
+ // Ensure cross-platform compatibility for npm global binaries
25
+ let cmd = if cfg!(target_os = "windows") {
26
+ "scad-convert.cmd"
27
+ } else {
28
+ "scad-convert"
29
+ };
30
+
31
+ let status = Command::new(cmd)
32
+ .args(["./scad", "./assets/models", "--cache"])
33
+ .status()
34
+ .expect("Failed to execute scad-convert. Is scad-gltf installed globally?");
35
+
36
+ if !status.success() {
37
+ panic!("scad-convert failed with status: {}", status);
38
+ }
39
+ }
40
+ ```
41
+
42
+ Now, any `.scad` files placed in your `scad/` directory will automatically be converted to `.glb` when you run `cargo build` or `cargo run`. They can then be loaded natively in Bevy via the Asset Server:
43
+
44
+ ```rust
45
+ let my_model = asset_server.load("models/my_model.glb#Scene0");
46
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ilia Grigorev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,58 @@
1
+ # AI-Generated Bevy Examples
2
+
3
+ This folder contains a collection of **all-in-one Node.js scripts**, each representing a complete, playable 3D Rust Bevy game generated entirely by AI using the `scad-bevy` CLI tool.
4
+
5
+ Instead of committing messy project folders, each example is bundled into a single, self-extracting JavaScript file. These scripts contain the generated OpenSCAD (`.scad`) 3D assets, Rust source code (`main.rs`), and the required `build.rs` and `Cargo.toml` configurations.
6
+
7
+ ---
8
+
9
+ ## 🚀 How to Play the Examples
10
+
11
+ To test out an example, you need to extract it and run it using Cargo.
12
+
13
+ ### Prerequisites
14
+
15
+ - **Node.js** installed on your system.
16
+ - **Rust and Cargo** installed on your system.
17
+ - **scad-gltf** installed globally: `npm install -g scad-gltf`
18
+
19
+ ### Step 1: Extract the Project
20
+
21
+ Open your terminal in this folder and execute the desired example script using Node.js:
22
+
23
+ ```bash
24
+ node packman_3d.js
25
+ ```
26
+
27
+ _The script will automatically create a new folder (e.g., `./packman_3d`) containing the full Bevy project directory structure, saving all the assets and Rust files to disk._
28
+
29
+ ---
30
+
31
+ ### Step 2: Compile & Play
32
+
33
+ Navigate into the newly extracted project folder and use Cargo to run the game:
34
+
35
+ ```bash
36
+ cd packman_3d
37
+ cargo run
38
+ ```
39
+
40
+ _The `build.rs` script will automatically invoke `scad-convert` to compile the OpenSCAD assets into `.glb` format before Bevy boots up._
41
+
42
+ ---
43
+
44
+ ## 🛠️ How were these generated?
45
+
46
+ These files were created using this repository's built-in AI prompt pipeline. By running the `scad-bevy` CLI command, the system instructs an LLM (like Claude, Gemini, or ChatGPT) to generate procedural OpenSCAD geometry, gameplay logic, and scene configurations, outputting them as a single JS extractor script.
47
+
48
+ If you want to generate your own games, run:
49
+
50
+ ```bash
51
+ scad-bevy "A simple 3D platformer where you control a rolling ball collecting coins"
52
+ ```
53
+
54
+ _(See the main repository documentation for full details on generating your own AI projects)._
55
+
56
+ ## 📜 License
57
+
58
+ These examples are licensed under the [MIT License](LICENSE).
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "scad-bevy-examples",
3
+ "private": true,
4
+ "type": "commonjs"
5
+ }