scad-gltf 0.2.2 → 0.3.0
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/README.md +17 -14
- package/bin/{scad-convert.js → convert.js} +1 -1
- package/bin/gen.js +33 -0
- package/bin/{scad-mcp.js → mcp.js} +11 -11
- package/bin/{scad-play.js → play.js} +2 -4
- package/bin/scad-gltf.js +33 -0
- package/bin/{scad-serve.js → serve.js} +1 -1
- package/godot/README.md +3 -6
- package/godot/addons/scad_importer/scad_importer.gd +8 -7
- package/package.json +4 -16
- package/src/cli-utils.js +20 -31
- package/src/project-prompts.js +256 -0
- package/bevy/README.md +0 -46
- package/bevy/examples/LICENSE +0 -21
- package/bevy/examples/README.md +0 -58
- package/bevy/examples/package.json +0 -5
- package/bevy/examples/packman_3d.js +0 -2415
- package/bin/scad-bevy.js +0 -74
- package/bin/scad-gen.js +0 -25
- package/bin/scad-godot.js +0 -140
- package/bin/scad-web.js +0 -51
- package/godot/examples/LICENSE +0 -21
- package/godot/examples/README.md +0 -91
- package/godot/examples/fruit_fusion_3d.js +0 -1774
- package/godot/examples/horde_survivor_3d.js +0 -2753
- package/godot/examples/kids_digit_writing.js +0 -2532
- package/godot/examples/naval_battle_3d.js +0 -1691
- package/godot/examples/package.json +0 -5
- package/godot/export_presets.cfg +0 -25
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import url from "node:url";
|
|
4
|
+
|
|
5
|
+
const __filename = url.fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
const DIR = path.resolve(__dirname, "..");
|
|
8
|
+
|
|
9
|
+
export function getProjectPrompts(projectType) {
|
|
10
|
+
if (projectType === "scad") {
|
|
11
|
+
return {
|
|
12
|
+
buildSystemPrompt: () =>
|
|
13
|
+
`You are an expert procedural 3D technical artist and OpenSCAD developer.
|
|
14
|
+
Your goal is to generate a single OpenSCAD (.scad) file based on the user's request.
|
|
15
|
+
|
|
16
|
+
CRITICAL WORKFLOW:
|
|
17
|
+
1. Write the OpenSCAD code using the custom syntax rules provided in the request.
|
|
18
|
+
2. Call the \`render_scad_model\` tool with your code to visually verify your design.
|
|
19
|
+
3. If the model looks incorrect, adjust your code and re-render. Iterate until perfect.
|
|
20
|
+
4. Provide your final OpenSCAD code in a standard markdown block (\`\`\`openscad).`,
|
|
21
|
+
allowedTools: ["render_scad_model"],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (projectType === "bevy") {
|
|
26
|
+
return {
|
|
27
|
+
buildSystemPrompt: (
|
|
28
|
+
promptRules,
|
|
29
|
+
) => `You are an expert Rust Bevy engine game developer and procedural 3D technical artist.
|
|
30
|
+
|
|
31
|
+
NAMING CONVENTION REQUIREMENT:
|
|
32
|
+
- All generated files, directories, models, scripts, and root folders MUST strictly use snake_case (lowercase with underscores, e.g. \`player_character.rs\`, \`enemy_walker.scad\`).
|
|
33
|
+
- NEVER use hyphens/minus signs (\`-\`) or spaces in any file or folder names.
|
|
34
|
+
|
|
35
|
+
What to generate:
|
|
36
|
+
1. 3D Game Assets (.scad):
|
|
37
|
+
- Generate procedural 3D models for the game using OpenSCAD.
|
|
38
|
+
- CRITICAL: The SCAD to glTF converter automatically converts OpenSCAD's Z-up coordinate system to the standard glTF Y-up coordinate system. Design your models naturally in OpenSCAD.
|
|
39
|
+
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
40
|
+
|
|
41
|
+
=== OPENSCAD SYNTAX RULES ===
|
|
42
|
+
${promptRules}
|
|
43
|
+
=============================
|
|
44
|
+
|
|
45
|
+
2. Rust Bevy Project Files:
|
|
46
|
+
- Create the necessary files for a modern Rust Bevy engine application (e.g., \`Cargo.toml\`, \`build.rs\`, \`src/main.rs\`).
|
|
47
|
+
- In \`Cargo.toml\`, include \`bevy\` as a dependency.
|
|
48
|
+
- You MUST include this EXACT \`build.rs\` script at the root of the project to automatically compile the \`.scad\` files into \`.glb\` format inside the \`assets/models\` folder before running the game via Cargo:
|
|
49
|
+
\`\`\`rust
|
|
50
|
+
use std::process::Command;
|
|
51
|
+
|
|
52
|
+
fn main() {
|
|
53
|
+
// Tell Cargo to re-run this script only if the 'scad' directory changes
|
|
54
|
+
println!("cargo::rerun-if-changed=scad");
|
|
55
|
+
|
|
56
|
+
// Ensure cross-platform compatibility for npm global binaries
|
|
57
|
+
let cmd = if cfg!(target_os = "windows") {
|
|
58
|
+
"scad-gltf.cmd"
|
|
59
|
+
} else {
|
|
60
|
+
"scad-gltf"
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
let status = Command::new(cmd)
|
|
64
|
+
.args(["convert", "./scad", "./assets/models", "--cache"])
|
|
65
|
+
.status()
|
|
66
|
+
.expect("Failed to execute scad-gltf. Is scad-gltf installed globally?");
|
|
67
|
+
|
|
68
|
+
if !status.success() {
|
|
69
|
+
panic!("scad-gltf convert failed with status: {}", status);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
\`\`\`
|
|
73
|
+
- Write the core application logic in \`src/main.rs\` to load and display the converted \`.glb\` files interactively. Provide standard Bevy game systems (camera, lights, movement, etc.).
|
|
74
|
+
|
|
75
|
+
3. Delivery Format (Single Node.js Script):
|
|
76
|
+
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
77
|
+
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using a slugified version of the project name) and output all files and folders inside this newly created project folder.
|
|
78
|
+
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
79
|
+
- The script must embed and write:
|
|
80
|
+
- Your generated \`.scad\` 3D assets.
|
|
81
|
+
- Your generated Rust Bevy project files (\`Cargo.toml\`, \`build.rs\`, \`src/main.rs\`).
|
|
82
|
+
- Ensure all string file contents inside the Node.js script are properly escaped.`,
|
|
83
|
+
buildInputRequest: (task) =>
|
|
84
|
+
`Design and implement a Rust Bevy engine game for the following concept: "${task}"`,
|
|
85
|
+
allowedTools: ["render_scad_model", "compile_bevy_project"],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (projectType === "web") {
|
|
90
|
+
return {
|
|
91
|
+
buildSystemPrompt: (
|
|
92
|
+
promptRules,
|
|
93
|
+
) => `You are an expert Web 3D developer and procedural 3D technical artist.
|
|
94
|
+
|
|
95
|
+
What to generate:
|
|
96
|
+
1. 3D Web Assets (.scad):
|
|
97
|
+
- Generate procedural 3D models for the game using OpenSCAD.
|
|
98
|
+
- CRITICAL: The SCAD to glTF converter automatically converts OpenSCAD's Z-up coordinate system to the standard glTF Y-up coordinate system. Design your models naturally in OpenSCAD.
|
|
99
|
+
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
100
|
+
|
|
101
|
+
=== OPENSCAD SYNTAX RULES ===
|
|
102
|
+
${promptRules}
|
|
103
|
+
=============================
|
|
104
|
+
|
|
105
|
+
2. Vite Web Project Files (npm based):
|
|
106
|
+
- Create the necessary files for a modern web application (e.g., \`package.json\`, \`index.html\`, \`main.js\`).
|
|
107
|
+
- You can use ANY web 3D library with glTF support (e.g., Three.js, Babylon.js, @google/model-viewer, PlayCanvas, A-Frame, etc.) that fits the game's requirements.
|
|
108
|
+
- In \`package.json\`, you MUST include the scad to gltf converter tool as a dev dependency:
|
|
109
|
+
\`"scad-gltf": "^0.3.0"\`
|
|
110
|
+
- In \`package.json\`, add npm scripts to automatically compile the \`.scad\` files into \`.glb\` format inside the \`public/\` folder before Vite runs its dev or build steps.
|
|
111
|
+
For example:
|
|
112
|
+
\`"predev": "scad-gltf convert ./scad ./public/models --cache"\`
|
|
113
|
+
\`"prebuild": "scad-gltf convert ./scad ./public/models --cache"\`
|
|
114
|
+
- Write the core game logic to load and display the converted \`.glb\` files interactively.
|
|
115
|
+
|
|
116
|
+
3. Delivery Format (Single Node.js Script):
|
|
117
|
+
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
118
|
+
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using a slugified version of the project name) and output all files and folders inside this newly created project folder.
|
|
119
|
+
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
120
|
+
- The script must embed and write:
|
|
121
|
+
- Your generated \`.scad\` 3D assets.
|
|
122
|
+
- Your generated Vite web project files.
|
|
123
|
+
- Ensure all string file contents inside the Node.js script are properly escaped.`,
|
|
124
|
+
buildInputRequest: (task) =>
|
|
125
|
+
`Design and implement a web-based 3D glTF game using Vite for the following concept: "${task}"`,
|
|
126
|
+
allowedTools: ["render_scad_model"],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (projectType === "godot") {
|
|
131
|
+
return {
|
|
132
|
+
buildSystemPrompt: (promptRules, options = {}) => {
|
|
133
|
+
const hasUserScadFiles =
|
|
134
|
+
Array.isArray(options.scadFiles) && options.scadFiles.length > 0;
|
|
135
|
+
|
|
136
|
+
const systemPrompt = `You are an expert Godot 4 game developer and procedural 3D technical artist.
|
|
137
|
+
|
|
138
|
+
NAMING CONVENTION REQUIREMENT:
|
|
139
|
+
- All generated files, directories, models, scripts, scenes, and root folders MUST strictly use snake_case (lowercase with underscores, e.g. \`player_character.gd\`, \`main_scene.tscn\`, \`enemy_walker.scad\`).
|
|
140
|
+
- NEVER use hyphens/minus signs (\`-\`) or spaces in any file or folder names.
|
|
141
|
+
|
|
142
|
+
What to generate:
|
|
143
|
+
1. 3D Game Assets (.scad):
|
|
144
|
+
- Generate procedural 3D models for the game using OpenSCAD.
|
|
145
|
+
- Scale & Units: 1 OpenSCAD unit = 1 Godot meter. Design your models using realistic meter-based scales (e.g., a character should be ~1.8 units tall). DO NOT use millimeter-based scaling.
|
|
146
|
+
- Coordinate System & Forward Convention: Write standard OpenSCAD Z-up code (+Z is UP, XY plane is ground). Build objects standing upright and facing Front (Positive Y-axis).
|
|
147
|
+
- Left/Right Convention: Always name and position "left" and "right" components (e.g., LeftArm, RightEye) based on the object's anatomical point of view (facing Forward towards +Y), NOT the camera/viewer's screen perspective. Because the object faces +Y, the object's Left side is along the -X axis, and the object's Right side is along the +X axis.
|
|
148
|
+
- CRITICAL Coordinate Mapping: The SCAD to glTF converter used by the Godot importer automatically converts OpenSCAD's Z-up coordinate system to Godot's Y-up coordinate system. Design your models naturally in OpenSCAD using this exact mapping:
|
|
149
|
+
* OpenSCAD +X (Right) -> Godot +X (Right)
|
|
150
|
+
* OpenSCAD -X (Left) -> Godot -X (Left)
|
|
151
|
+
* OpenSCAD +Y (Forward) -> Godot -Z (Forward)
|
|
152
|
+
* OpenSCAD -Y (Back) -> Godot +Z (Back)
|
|
153
|
+
* OpenSCAD +Z (Up) -> Godot +Y (Up)
|
|
154
|
+
DO NOT manually apply root rotations (e.g., \`rotate([90, 0, 0])\`) to compensate for Godot.
|
|
155
|
+
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
156
|
+
|
|
157
|
+
=== OPENSCAD SYNTAX RULES ===
|
|
158
|
+
${promptRules}
|
|
159
|
+
=============================
|
|
160
|
+
|
|
161
|
+
2. Godot 4 Project Files:
|
|
162
|
+
- Create the necessary GDScript (\`.gd\`) and scene (\`.tscn\`) files to implement the game logic, responsive player input controls, and a core gameplay loop.
|
|
163
|
+
- The scenes should directly instance the generated \`.scad\` files (the provided addon will handle importing them as 3D scenes).
|
|
164
|
+
- GDScript Coordinate, Forward, and Left/Right Conventions:
|
|
165
|
+
* Forward is -Z: In Godot, \`Vector3.FORWARD\` is \`Vector3(0, 0, -1)\`. A 3D node's local forward direction is \`-transform.basis.z\` (or \`-global_transform.basis.z\`). In character movement, forward input (e.g., W or ui_up) must translate along \`-transform.basis.z\`. Never treat +Z as forward.
|
|
166
|
+
* Backward is +Z: \`Vector3.BACK\` is \`Vector3(0, 0, 1)\` (\`transform.basis.z\`).
|
|
167
|
+
* Right is +X: \`Vector3.RIGHT\` is \`Vector3(1, 0, 0)\` (\`transform.basis.x\`).
|
|
168
|
+
* Left is -X: \`Vector3.LEFT\` is \`Vector3(-1, 0, 0)\` (\`-transform.basis.x\`).
|
|
169
|
+
* Left/Right Convention in Godot Script: Maintain anatomical consistency in scripts—character Right is along +X (\`transform.basis.x\`) and character Left is along -X (\`-transform.basis.x\`).
|
|
170
|
+
* Natural Model Alignment: Because OpenSCAD models face +Y (Forward), they automatically import facing Godot's Forward direction (-Z). Built-in Godot methods like \`look_at()\` orient the node's -Z axis toward the target, which perfectly aligns with the model's front. Do NOT apply compensation rotations (e.g., \`rotate_y(PI)\`) in GDScript to compensate for model orientation.
|
|
171
|
+
- Generate a \`project.godot\` file. It must configure the project and automatically enable the \`scad_importer\` plugin.
|
|
172
|
+
- Generate a \`.gitignore\` file that ignores the \`.godot/\` folder.
|
|
173
|
+
- Generate a \`README.md\` file that documents the project, gameplay mechanics, and controls.
|
|
174
|
+
|
|
175
|
+
3. Delivery Format (Single Node.js Script):
|
|
176
|
+
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
177
|
+
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using snake_case with underscores, e.g., \`my_game_project\`) and output all files and folders inside this newly created project folder.
|
|
178
|
+
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
179
|
+
- The script must embed and write:
|
|
180
|
+
- Your generated \`.scad\` game assets.
|
|
181
|
+
- Your generated Godot project files.
|
|
182
|
+
- The exact source code of the provided \`addons/scad_importer/*\` files, placed in their correct respective paths.${
|
|
183
|
+
hasUserScadFiles
|
|
184
|
+
? "\n - The exact source code of the provided user `.scad` files, placed in the appropriate project folders."
|
|
185
|
+
: ""
|
|
186
|
+
}
|
|
187
|
+
- Ensure all string file contents inside the Node.js script are properly escaped.
|
|
188
|
+
- TESTING CAPABILITY: You have access to the \`test_godot_project\` tool. If you want to verify your code before outputting your final response, you can pass your complete generated Node.js script as the \`nodejs_script\` parameter. The server will execute it in a temporary folder and run the Godot tests automatically.`;
|
|
189
|
+
|
|
190
|
+
// Gather Addon Files content
|
|
191
|
+
const addonDir = path.join(DIR, "godot", "addons", "scad_importer");
|
|
192
|
+
let addonFiles = [];
|
|
193
|
+
try {
|
|
194
|
+
if (fs.existsSync(addonDir)) {
|
|
195
|
+
const files = fs.readdirSync(addonDir);
|
|
196
|
+
for (const file of files) {
|
|
197
|
+
const fullPath = path.join(addonDir, file);
|
|
198
|
+
if (
|
|
199
|
+
fs.statSync(fullPath).isFile() &&
|
|
200
|
+
(file.endsWith(".gd") || file.endsWith(".cfg"))
|
|
201
|
+
) {
|
|
202
|
+
addonFiles.push(fullPath);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} catch (e) {
|
|
207
|
+
console.error("Warning: Could not read addon directory.", e);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let systemClipboardOutput = `${systemPrompt}\n\n`;
|
|
211
|
+
|
|
212
|
+
for (const file of addonFiles) {
|
|
213
|
+
try {
|
|
214
|
+
const content = fs
|
|
215
|
+
.readFileSync(file, "utf-8")
|
|
216
|
+
.replace(/\r\n/g, "\n");
|
|
217
|
+
const relativePath = path.relative(DIR, file).replace(/\\/g, "/");
|
|
218
|
+
const lang = file.endsWith(".gd") ? "gdscript" : "text";
|
|
219
|
+
systemClipboardOutput += `### ${relativePath}\n---\n\`\`\`${lang}\n${content}\n\`\`\`\n\n`;
|
|
220
|
+
} catch (e) {
|
|
221
|
+
console.error(
|
|
222
|
+
`Warning: Skipping '${file}'. It is not a readable file.`,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (hasUserScadFiles) {
|
|
228
|
+
systemClipboardOutput += `=== USER PROVIDED OPENSCAD FILES ===\n`;
|
|
229
|
+
systemClipboardOutput += `The following .scad files are provided as reference or base assets. You MUST embed and write them into the generated project, modifying them if necessary to fit the game logic.\n\n`;
|
|
230
|
+
for (const file of options.scadFiles) {
|
|
231
|
+
try {
|
|
232
|
+
const content = fs
|
|
233
|
+
.readFileSync(file, "utf-8")
|
|
234
|
+
.replace(/\r\n/g, "\n");
|
|
235
|
+
const relativePath = path.isAbsolute(file)
|
|
236
|
+
? path.relative(process.cwd(), file).replace(/\\/g, "/")
|
|
237
|
+
: file.replace(/\\/g, "/");
|
|
238
|
+
systemClipboardOutput += `### ${relativePath}\n---\n\`\`\`openscad\n${content}\n\`\`\`\n\n`;
|
|
239
|
+
} catch (e) {
|
|
240
|
+
console.error(
|
|
241
|
+
`Warning: Skipping user SCAD file '${file}'. It is not a readable file.`,
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return systemClipboardOutput.trimEnd() + "\n";
|
|
248
|
+
},
|
|
249
|
+
buildInputRequest: (task) =>
|
|
250
|
+
`Design and implement a Godot 4 project for the following game concept: "${task}"`,
|
|
251
|
+
allowedTools: ["render_scad_model", "test_godot_project"],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
throw new Error(`Unknown project type: ${projectType}`);
|
|
256
|
+
}
|
package/bevy/README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
```
|
package/bevy/examples/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
package/bevy/examples/README.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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).
|