@bitbybit-dev/create-app 0.21.1

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.
Files changed (28) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +279 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +69 -0
  8. package/templates/vite/babylonjs/typescript/index.html +27 -0
  9. package/templates/vite/babylonjs/typescript/package.json +18 -0
  10. package/templates/vite/babylonjs/typescript/public/vite.svg +1 -0
  11. package/templates/vite/babylonjs/typescript/src/main.ts +121 -0
  12. package/templates/vite/babylonjs/typescript/src/style.css +31 -0
  13. package/templates/vite/babylonjs/typescript/src/vite-env.d.ts +1 -0
  14. package/templates/vite/babylonjs/typescript/tsconfig.json +25 -0
  15. package/templates/vite/playcanvas/typescript/index.html +27 -0
  16. package/templates/vite/playcanvas/typescript/package.json +19 -0
  17. package/templates/vite/playcanvas/typescript/public/vite.svg +1 -0
  18. package/templates/vite/playcanvas/typescript/src/main.ts +114 -0
  19. package/templates/vite/playcanvas/typescript/src/style.css +25 -0
  20. package/templates/vite/playcanvas/typescript/src/vite-env.d.ts +1 -0
  21. package/templates/vite/playcanvas/typescript/tsconfig.json +25 -0
  22. package/templates/vite/threejs/typescript/index.html +27 -0
  23. package/templates/vite/threejs/typescript/package.json +19 -0
  24. package/templates/vite/threejs/typescript/public/vite.svg +1 -0
  25. package/templates/vite/threejs/typescript/src/main.ts +115 -0
  26. package/templates/vite/threejs/typescript/src/style.css +25 -0
  27. package/templates/vite/threejs/typescript/src/vite-env.d.ts +1 -0
  28. package/templates/vite/threejs/typescript/tsconfig.json +25 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Bit By Bit Developers
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/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # @bitbybit-dev/create-app
2
+
3
+ 🚀 **CLI tool to scaffold Bit By Bit Developers 3D/CAD projects with your favorite game engine**
4
+
5
+ Create stunning 3D/CAD applications with ease using our powerful geometry kernels: OCCT (OpenCascade), JSCAD, and Manifold.
6
+
7
+ ## Quick Start
8
+
9
+ ### Using npm init (Recommended)
10
+
11
+ ```bash
12
+ npm init @bitbybit-dev/app my-project
13
+ ```
14
+
15
+ ### Using npx
16
+
17
+ ```bash
18
+ npx @bitbybit-dev/create-app my-project
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Interactive Mode
24
+
25
+ Simply run the command without options to enter interactive mode:
26
+
27
+ ```bash
28
+ npm init @bitbybit-dev/app my-project
29
+ ```
30
+
31
+ You'll be prompted to select:
32
+ - 🎮 **Game Engine**: Three.js, Babylon.js, or PlayCanvas
33
+
34
+ ### CLI Options
35
+
36
+ ```bash
37
+ npm init @bitbybit-dev/app my-project --engine threejs
38
+ ```
39
+
40
+ Available engines:
41
+ - `threejs` - Three.js: Lightweight and flexible 3D library
42
+ - `babylonjs` - Babylon.js: Powerful and feature-rich game engine
43
+ - `playcanvas` - PlayCanvas: Fast and lightweight WebGL game engine
44
+
45
+ ## What You Get
46
+
47
+ Each scaffolded project includes:
48
+
49
+ - ⚡ **Vite** - Lightning fast build tool
50
+ - 📘 **TypeScript** - Type-safe development
51
+ - 🎨 **Bitbybit** - All geometry kernels pre-configured:
52
+ - **OCCT** (OpenCascade) - Professional CAD kernel
53
+ - **JSCAD** - Programmatic solid modeling
54
+ - **Manifold** - Fast mesh boolean operations
55
+ - 🎮 **Your chosen 3D engine** - Three.js, Babylon.js, or PlayCanvas
56
+
57
+ ## After Scaffolding
58
+
59
+ Navigate to your project and start developing:
60
+
61
+ ```bash
62
+ cd my-project
63
+ npm install
64
+ npm run dev
65
+ ```
66
+
67
+ ## Project Structure
68
+
69
+ ```
70
+ my-project/
71
+ ├── index.html
72
+ ├── package.json
73
+ ├── tsconfig.json
74
+ ├── public/
75
+ │ └── vite.svg
76
+ └── src/
77
+ ├── main.ts
78
+ ├── style.css
79
+ └── vite-env.d.ts
80
+ ```
81
+
82
+ ## Links
83
+
84
+ - 🌐 **Website**: [https://bitbybit.dev](https://bitbybit.dev)
85
+ - 📚 **Documentation**: [https://bitbybit.dev/docs](https://bitbybit.dev/docs)
86
+ - 💬 **Discord Community**: [https://discord.gg/GSe3VMe](https://discord.gg/GSe3VMe)
87
+ - 🐛 **Issues**: [https://github.com/bitbybit-dev/bitbybit/issues](https://github.com/bitbybit-dev/bitbybit/issues)
88
+
89
+ ## Support Us
90
+
91
+ ⭐ **The best way to support Bit By Bit Developers is with a Silver or Gold plan subscription!**
92
+
93
+ [Subscribe Now](https://bitbybit.dev/auth/pick-plan)
94
+
95
+ ## License
96
+
97
+ MIT © [Bit By Bit Developers](https://bitbybit.dev)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,279 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import inquirer from "inquirer";
4
+ import chalk from "chalk";
5
+ import gradient from "gradient-string";
6
+ import ora from "ora";
7
+ import fs from "fs-extra";
8
+ import path from "path";
9
+ import { fileURLToPath } from "url";
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ // Simplified, cleaner ASCII logo
13
+ const BITBYBIT_LOGO = `
14
+ ╭──────────────────────────────────────────────────────────────────────╮
15
+ │ │
16
+ │ ░█▀▄░▀█▀░▀█▀░█▀▄░█░█░█▀▄░▀█▀░▀█▀░░░░░█▀▄░█▀▀░█░█ │
17
+ │ ░█▀▄░░█░░░█░░█▀▄░░█░░█▀▄░░█░░░█░░░░░░█░█░█▀▀░▀▄▀ │
18
+ │ ░▀▀░░▀▀▀░░▀░░▀▀░░░▀░░▀▀░░▀▀▀░░▀░░░▀░░▀▀░░▀▀▀░░▀░ │
19
+ │ │
20
+ │ 3D CAD Development on the Web │
21
+ ╰──────────────────────────────────────────────────────────────────────╯
22
+ `;
23
+ const ENGINE_DISPLAY_NAMES = {
24
+ "threejs": "Three.js",
25
+ "babylonjs": "Babylon.js",
26
+ "playcanvas": "PlayCanvas"
27
+ };
28
+ const ENGINE_DESCRIPTIONS = {
29
+ "threejs": "Lightweight and flexible 3D library",
30
+ "babylonjs": "Powerful and feature-rich game engine",
31
+ "playcanvas": "Fast and lightweight WebGL game engine"
32
+ };
33
+ const ENGINE_COLORS = {
34
+ "threejs": chalk.hex("#049EF4"), // Three.js blue
35
+ "babylonjs": chalk.hex("#E0684B"), // Babylon.js red/orange
36
+ "playcanvas": chalk.hex("#FF6600") // PlayCanvas orange
37
+ };
38
+ async function displayWelcome() {
39
+ console.clear();
40
+ // Create a beautiful gold gradient for the logo
41
+ const goldGradient = gradient(["#F0CEBB", "#fff6f3", "#d6b39f", "#F0CEBB"]);
42
+ console.log(goldGradient(BITBYBIT_LOGO));
43
+ console.log();
44
+ console.log(chalk.gray("─".repeat(72)));
45
+ console.log();
46
+ console.log(chalk.white.bold(" Welcome to the Bit By Bit Developers Project Scaffolder! 🚀"));
47
+ console.log();
48
+ console.log(chalk.gray(" Create stunning 3D/CAD applications using our powerful"));
49
+ console.log(chalk.gray(" geometry kernels: OCCT (OpenCascade), JSCAD, and Manifold."));
50
+ console.log();
51
+ console.log(chalk.gray("─".repeat(72)));
52
+ console.log();
53
+ console.log(chalk.cyan(" 🌐 Website: ") + chalk.underline.cyan("https://bitbybit.dev"));
54
+ console.log(chalk.yellow(" ⭐ Subscribe: ") + chalk.underline.yellow("https://bitbybit.dev/auth/pick-plan"));
55
+ console.log(chalk.gray(" Best way to support us is Silver or Gold plan subscription!"));
56
+ console.log();
57
+ console.log(chalk.gray("─".repeat(72)));
58
+ console.log();
59
+ }
60
+ async function promptProjectOptions(projectNameArg) {
61
+ let answers;
62
+ // Only ask for project name if not provided as argument
63
+ if (!projectNameArg) {
64
+ answers = await inquirer.prompt([
65
+ {
66
+ type: "input",
67
+ name: "projectName",
68
+ message: chalk.cyan("📁 What is your project name?"),
69
+ default: "my-bitbybit-app",
70
+ validate: (input) => {
71
+ if (!input.trim()) {
72
+ return "Project name is required";
73
+ }
74
+ if (!/^[a-z0-9-_]+$/i.test(input)) {
75
+ return "Project name can only contain letters, numbers, hyphens, and underscores";
76
+ }
77
+ return true;
78
+ }
79
+ },
80
+ {
81
+ type: "list",
82
+ name: "engine",
83
+ message: chalk.cyan("🎮 Which 3D engine would you like to use?"),
84
+ choices: [
85
+ {
86
+ name: `${ENGINE_COLORS["threejs"]("● Three.js")} ${chalk.gray("- Lightweight and popular 3D library")}`,
87
+ value: "threejs",
88
+ short: "Three.js"
89
+ },
90
+ {
91
+ name: `${ENGINE_COLORS["babylonjs"]("● Babylon.js")} ${chalk.gray("- Powerful and feature-rich game engine")}`,
92
+ value: "babylonjs",
93
+ short: "Babylon.js"
94
+ },
95
+ {
96
+ name: `${ENGINE_COLORS["playcanvas"]("● PlayCanvas")} ${chalk.gray("- Fast and lightweight WebGL game engine")}`,
97
+ value: "playcanvas",
98
+ short: "PlayCanvas"
99
+ }
100
+ ],
101
+ default: "threejs"
102
+ }
103
+ ]);
104
+ }
105
+ else {
106
+ answers = await inquirer.prompt([
107
+ {
108
+ type: "list",
109
+ name: "engine",
110
+ message: chalk.cyan("🎮 Which 3D engine would you like to use?"),
111
+ choices: [
112
+ {
113
+ name: `${ENGINE_COLORS["threejs"]("● Three.js")} ${chalk.gray("- Lightweight and flexible 3D library")}`,
114
+ value: "threejs",
115
+ short: "Three.js"
116
+ },
117
+ {
118
+ name: `${ENGINE_COLORS["babylonjs"]("● Babylon.js")} ${chalk.gray("- Powerful and feature-rich game engine")}`,
119
+ value: "babylonjs",
120
+ short: "Babylon.js"
121
+ },
122
+ {
123
+ name: `${ENGINE_COLORS["playcanvas"]("● PlayCanvas")} ${chalk.gray("- Fast and lightweight WebGL game engine")}`,
124
+ value: "playcanvas",
125
+ short: "PlayCanvas"
126
+ }
127
+ ],
128
+ default: "threejs"
129
+ }
130
+ ]);
131
+ }
132
+ return {
133
+ projectName: projectNameArg || answers.projectName,
134
+ engine: answers.engine,
135
+ bundler: "vite",
136
+ language: "typescript"
137
+ };
138
+ }
139
+ async function createProject(options) {
140
+ const { projectName, engine, bundler, language } = options;
141
+ const targetDir = path.resolve(process.cwd(), projectName);
142
+ console.log();
143
+ console.log(chalk.gray("─".repeat(72)));
144
+ console.log();
145
+ console.log(chalk.white.bold(" 📋 Project Configuration:"));
146
+ console.log();
147
+ console.log(` ${chalk.gray("Project:")} ${chalk.white.bold(projectName)}`);
148
+ console.log(` ${chalk.gray("Engine:")} ${ENGINE_COLORS[engine](ENGINE_DISPLAY_NAMES[engine])}`);
149
+ console.log(` ${chalk.gray("Bundler:")} ${chalk.magenta("Vite")}`);
150
+ console.log(` ${chalk.gray("Language:")} ${chalk.blue("TypeScript")}`);
151
+ console.log();
152
+ console.log(chalk.gray("─".repeat(72)));
153
+ console.log();
154
+ // Check if directory exists
155
+ if (fs.existsSync(targetDir)) {
156
+ const { overwrite } = await inquirer.prompt([
157
+ {
158
+ type: "confirm",
159
+ name: "overwrite",
160
+ message: chalk.yellow(`⚠️ Directory "${projectName}" already exists. Do you want to overwrite it?`),
161
+ default: false
162
+ }
163
+ ]);
164
+ if (!overwrite) {
165
+ console.log(chalk.red("\n ✖ Project creation cancelled.\n"));
166
+ process.exit(0);
167
+ }
168
+ const spinner = ora("Removing existing directory...").start();
169
+ await fs.remove(targetDir);
170
+ spinner.succeed("Existing directory removed");
171
+ }
172
+ // Create project directory
173
+ const spinner = ora({
174
+ text: "Creating project structure...",
175
+ color: "cyan"
176
+ }).start();
177
+ try {
178
+ // Copy template files
179
+ const templateDir = path.join(__dirname, "..", "templates", bundler, engine, language);
180
+ if (!fs.existsSync(templateDir)) {
181
+ spinner.fail("Template not found");
182
+ console.error(chalk.red(`\n ✖ Template for ${bundler}/${engine}/${language} not found.`));
183
+ console.error(chalk.gray(` Looking in: ${templateDir}`));
184
+ process.exit(1);
185
+ }
186
+ await fs.copy(templateDir, targetDir);
187
+ spinner.succeed("Project structure created");
188
+ // Update package.json with project name
189
+ const packageJsonPath = path.join(targetDir, "package.json");
190
+ if (fs.existsSync(packageJsonPath)) {
191
+ const packageJson = await fs.readJson(packageJsonPath);
192
+ packageJson.name = projectName;
193
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
194
+ }
195
+ // Success message
196
+ console.log();
197
+ console.log(chalk.gray("─".repeat(72)));
198
+ console.log();
199
+ console.log(chalk.gray(" Home: ") + chalk.underline.cyan("https://bitbybit.dev"));
200
+ console.log(chalk.gray(" Learn: ") + chalk.underline.cyan("https://learn.bitbybit.dev"));
201
+ console.log(chalk.gray(" Blog: ") + chalk.underline.cyan("https://learn.bitbybit.dev/blog"));
202
+ console.log(chalk.gray(" Documentation: ") + chalk.underline.cyan("https://docs.bitbybit.dev"));
203
+ console.log(chalk.gray(" Community: ") + chalk.underline.cyan("https://discord.gg/GSe3VMe"));
204
+ console.log(chalk.gray(" GitHub: ") + chalk.underline.cyan("https://github.com/bitbybit-dev/bitbybit"));
205
+ console.log(chalk.gray(" LinkedIn: ") + chalk.underline.cyan("https://www.linkedin.com/company/bitbybit-dev/"));
206
+ console.log(chalk.gray(" X: ") + chalk.underline.cyan("https://x.com/bitbybit_dev"));
207
+ console.log(chalk.gray(" YouTube: ") + chalk.underline.cyan("https://www.youtube.com/@bitbybitdev"));
208
+ console.log(chalk.gray(" Facebook: ") + chalk.underline.cyan("https://www.facebook.com/bitbybitdev"));
209
+ console.log();
210
+ console.log(chalk.green.bold(" ✔ Project created successfully! 🎉"));
211
+ console.log();
212
+ console.log(chalk.white(" Next steps:"));
213
+ console.log();
214
+ console.log(chalk.gray(" 1. Navigate to your project:"));
215
+ console.log(chalk.cyan(` cd ${projectName}`));
216
+ console.log();
217
+ console.log(chalk.gray(" 2. Install dependencies:"));
218
+ console.log(chalk.cyan(" npm install"));
219
+ console.log();
220
+ console.log(chalk.gray(" 3. Start the development server:"));
221
+ console.log(chalk.cyan(" npm run dev"));
222
+ console.log();
223
+ console.log(chalk.gray("─".repeat(72)));
224
+ console.log();
225
+ console.log(chalk.yellow.bold(" ⭐ Support Bit By Bit Developers with a Silver or Gold subscription:"));
226
+ console.log(chalk.yellow.italic(" https://bitbybit.dev/auth/pick-plan"));
227
+ console.log();
228
+ console.log(chalk.gray("─".repeat(72)));
229
+ console.log();
230
+ console.log(chalk.white(" Happy coding! 💻✨"));
231
+ console.log();
232
+ }
233
+ catch (error) {
234
+ spinner.fail("Failed to create project");
235
+ console.error(chalk.red("\n ✖ Error creating project:"), error);
236
+ process.exit(1);
237
+ }
238
+ }
239
+ async function main() {
240
+ const program = new Command();
241
+ program
242
+ .name("@bitbybit-dev/create-app")
243
+ .description("Scaffold a new Bit By Bit Developers 3D/CAD project")
244
+ .version("0.21.1")
245
+ .argument("[project-name]", "Name of the project to create")
246
+ .option("-e, --engine <engine>", "Game engine to use (threejs, babylonjs, playcanvas)")
247
+ .action(async (projectName, cmdOptions) => {
248
+ await displayWelcome();
249
+ let options;
250
+ // If engine is provided via CLI, validate it
251
+ if (cmdOptions.engine) {
252
+ const validEngines = ["threejs", "babylonjs", "playcanvas"];
253
+ if (!validEngines.includes(cmdOptions.engine)) {
254
+ console.error(chalk.red(`\n ✖ Invalid engine: ${cmdOptions.engine}`));
255
+ console.error(chalk.gray(` Valid options: ${validEngines.join(", ")}`));
256
+ process.exit(1);
257
+ }
258
+ }
259
+ // If both project name and engine are provided, skip prompts
260
+ if (projectName && cmdOptions.engine) {
261
+ options = {
262
+ projectName,
263
+ engine: cmdOptions.engine,
264
+ bundler: "vite",
265
+ language: "typescript"
266
+ };
267
+ }
268
+ else {
269
+ options = await promptProjectOptions(projectName);
270
+ }
271
+ await createProject(options);
272
+ });
273
+ await program.parseAsync(process.argv);
274
+ }
275
+ main().catch((error) => {
276
+ console.error(chalk.red("\n ✖ Unexpected error:"), error);
277
+ process.exit(1);
278
+ });
279
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;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,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@bitbybit-dev/create-app",
3
+ "version": "0.21.1",
4
+ "description": "CLI tool to scaffold Bit By Bit Developers 3D/CAD projects with your favorite game engine",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-bitbybit-app": "./dist/index.js",
8
+ "@bitbybit-dev/create-app": "./dist/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "files": [
12
+ "dist",
13
+ "templates"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/bitbybit-dev/bitbybit"
18
+ },
19
+ "keywords": [
20
+ "Bit By Bit Developers",
21
+ "bitbybit",
22
+ "bitbybit.dev",
23
+ "Geometry",
24
+ "CAD",
25
+ "3D",
26
+ "JSCAD",
27
+ "OCCT",
28
+ "OpenCascade",
29
+ "Creative coding",
30
+ "ThreeJS",
31
+ "Three.js",
32
+ "BabylonJS",
33
+ "Babylon.js",
34
+ "PlayCanvas",
35
+ "Vite",
36
+ "scaffolding",
37
+ "cli",
38
+ "create-app"
39
+ ],
40
+ "author": "Bit By Bit Developers (https://bitbybit.dev)",
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/bitbybit-dev/bitbybit/issues"
44
+ },
45
+ "homepage": "https://bitbybit.dev",
46
+ "scripts": {
47
+ "build": "tsc",
48
+ "dev": "tsc --watch",
49
+ "prepublishOnly": "npm run build"
50
+ },
51
+ "dependencies": {
52
+ "chalk": "^5.3.0",
53
+ "commander": "^12.1.0",
54
+ "fs-extra": "^11.2.0",
55
+ "gradient-string": "^3.0.0",
56
+ "inquirer": "^9.3.7",
57
+ "ora": "^8.1.1"
58
+ },
59
+ "devDependencies": {
60
+ "@types/fs-extra": "^11.0.4",
61
+ "@types/gradient-string": "^1.1.6",
62
+ "@types/inquirer": "^9.0.7",
63
+ "@types/node": "^22.10.2",
64
+ "typescript": "~5.8.3"
65
+ },
66
+ "engines": {
67
+ "node": ">=18.0.0"
68
+ }
69
+ }
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Bitbybit & Babylon.js Project</title>
8
+ </head>
9
+ <body>
10
+ <a
11
+ class="logo"
12
+ href="https://bitbybit.dev"
13
+ target="_blank"
14
+ rel="noopener noreferrer"
15
+ >
16
+ <img
17
+ alt="Logo of Bit by bit developers company"
18
+ src="https://bitbybit.dev/assets/logo-gold-small.png"
19
+ />
20
+ <div>bitbybit.dev</div>
21
+ <br />
22
+ <div>support the mission - subscribe</div>
23
+ </a>
24
+ <canvas id="babylon-canvas"></canvas>
25
+ <script type="module" src="/src/main.ts"></script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "bitbybit-babylonjs-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@bitbybit-dev/babylonjs": "0.21.1"
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "~5.8.3",
16
+ "vite": "^6.3.2"
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFBD4F"></stop><stop offset="100%" stop-color="#FF980E"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,121 @@
1
+ import "./style.css";
2
+ import { BitByBitBase, Inputs, initBitByBit, initBabylonJS, type InitBitByBitOptions } from "@bitbybit-dev/babylonjs";
3
+
4
+ start();
5
+
6
+ async function start() {
7
+ const sceneOptions = new Inputs.BabylonJSScene.InitBabylonJSDto();
8
+ sceneOptions.canvasId = "babylon-canvas";
9
+ sceneOptions.sceneSize = 10;
10
+ sceneOptions.enableShadows = true;
11
+ sceneOptions.enableGround = true;
12
+ sceneOptions.groundColor = "#333333";
13
+
14
+ const { scene, engine } = initBabylonJS(sceneOptions);
15
+ const bitbybit = new BitByBitBase();
16
+ const options: InitBitByBitOptions = {
17
+ enableOCCT: true,
18
+ enableJSCAD: true,
19
+ enableManifold: true,
20
+ };
21
+
22
+ await initBitByBit(scene, bitbybit, options);
23
+
24
+ if (options.enableOCCT) {
25
+ await createOCCTGeometry(bitbybit, "#ff0000");
26
+ }
27
+ if (options.enableManifold) {
28
+ await createManifoldGeometry(bitbybit, "#00ff00");
29
+ }
30
+ if (options.enableJSCAD) {
31
+ await createJSCADGeometry(bitbybit, "#0000ff");
32
+ }
33
+
34
+ engine.runRenderLoop(() => {
35
+ if (scene.activeCamera) {
36
+ scene.render();
37
+ }
38
+ });
39
+ }
40
+
41
+ async function createOCCTGeometry(bitbybit: BitByBitBase, color: string) {
42
+ const cubeOptions = new Inputs.OCCT.CubeDto();
43
+ cubeOptions.size = 2.5;
44
+ cubeOptions.center = [0, 1.25, 0];
45
+
46
+ const cube = await bitbybit.occt.shapes.solid.createCube(cubeOptions);
47
+
48
+ const filletOptions =
49
+ new Inputs.OCCT.FilletDto<Inputs.OCCT.TopoDSShapePointer>();
50
+ filletOptions.shape = cube;
51
+ filletOptions.radius = 0.4;
52
+ const roundedCube = await bitbybit.occt.fillets.filletEdges(filletOptions);
53
+
54
+ const drawOptions = new Inputs.Draw.DrawOcctShapeOptions();
55
+ drawOptions.edgeWidth = 0.5;
56
+ drawOptions.faceColour = color;
57
+ drawOptions.drawVertices = true;
58
+ drawOptions.vertexSize = 0.05;
59
+ drawOptions.vertexColour = "#ffffff";
60
+ await bitbybit.draw.drawAnyAsync({
61
+ entity: roundedCube,
62
+ options: drawOptions,
63
+ });
64
+ }
65
+
66
+ async function createManifoldGeometry(bitbybit: BitByBitBase, color: string) {
67
+ const sphereOptions = new Inputs.Manifold.SphereDto();
68
+ sphereOptions.radius = 1.5;
69
+ sphereOptions.circularSegments = 32;
70
+ const sphere = await bitbybit.manifold.manifold.shapes.sphere(sphereOptions);
71
+
72
+ const cubeOptions = new Inputs.Manifold.CubeDto();
73
+ cubeOptions.size = 2.5;
74
+ const cube = await bitbybit.manifold.manifold.shapes.cube(cubeOptions);
75
+
76
+ const diffedShape = await bitbybit.manifold.manifold.booleans.differenceTwo({
77
+ manifold1: cube,
78
+ manifold2: sphere,
79
+ });
80
+
81
+ const translationOptions =
82
+ new Inputs.Manifold.TranslateDto<Inputs.Manifold.ManifoldPointer>();
83
+ translationOptions.manifold = diffedShape;
84
+ translationOptions.vector = [0, 1.25, -4]; // Position below OCCT
85
+ const movedShape = await bitbybit.manifold.manifold.transforms.translate(
86
+ translationOptions
87
+ );
88
+
89
+ const drawOptions = new Inputs.Draw.DrawManifoldOrCrossSectionOptions();
90
+ drawOptions.faceColour = color;
91
+ await bitbybit.draw.drawAnyAsync({
92
+ entity: movedShape,
93
+ options: drawOptions,
94
+ });
95
+ }
96
+
97
+ async function createJSCADGeometry(bitbybit: BitByBitBase, color: string) {
98
+ const geodesicSphereOptions = new Inputs.JSCAD.GeodesicSphereDto();
99
+ geodesicSphereOptions.radius = 1.5;
100
+ geodesicSphereOptions.center = [0, 1.5, 4];
101
+ const geodesicSphere = await bitbybit.jscad.shapes.geodesicSphere(
102
+ geodesicSphereOptions
103
+ );
104
+
105
+ const sphereOptions = new Inputs.JSCAD.SphereDto();
106
+ sphereOptions.radius = 1;
107
+ sphereOptions.center = [0, 3, 4.5];
108
+ const simpleSphere = await bitbybit.jscad.shapes.sphere(sphereOptions);
109
+
110
+ const unionOptions = new Inputs.JSCAD.BooleanTwoObjectsDto();
111
+ unionOptions.first = geodesicSphere;
112
+ unionOptions.second = simpleSphere;
113
+ const unionShape = await bitbybit.jscad.booleans.unionTwo(unionOptions);
114
+
115
+ const drawOptions = new Inputs.Draw.DrawBasicGeometryOptions();
116
+ drawOptions.colours = color;
117
+ await bitbybit.draw.drawAnyAsync({
118
+ entity: unionShape,
119
+ options: drawOptions,
120
+ });
121
+ }
@@ -0,0 +1,31 @@
1
+ body {
2
+ margin: 0px;
3
+ overflow: hidden;
4
+ }
5
+
6
+ #babylon-canvas {
7
+ outline: none;
8
+ width: 100%;
9
+ height: 100vh;
10
+ }
11
+
12
+ a.logo {
13
+ position: absolute;
14
+ color: white;
15
+ vertical-align: middle;
16
+ bottom: 10px;
17
+ left: 10px;
18
+ font-family: 'Courier New', Courier, monospace;
19
+ text-decoration: none;
20
+ width: 100%;
21
+ }
22
+
23
+ .logo {
24
+ margin-bottom: 20px;
25
+ text-align: center;
26
+ }
27
+
28
+ .logo img {
29
+ width: 50px;
30
+ height: 50px;
31
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "verbatimModuleSyntax": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedSideEffectImports": true
23
+ },
24
+ "include": ["src"]
25
+ }
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Bitbybit & PlayCanvas Project</title>
8
+ </head>
9
+ <body>
10
+ <a
11
+ class="logo"
12
+ href="https://bitbybit.dev"
13
+ target="_blank"
14
+ rel="noopener noreferrer"
15
+ >
16
+ <img
17
+ alt="Logo of Bit by bit developers company"
18
+ src="https://bitbybit.dev/assets/logo-gold-small.png"
19
+ />
20
+ <div>bitbybit.dev</div>
21
+ <br />
22
+ <div>support the mission - subscribe</div>
23
+ </a>
24
+ <canvas id="playcanvas-canvas"> </canvas>
25
+ <script type="module" src="/src/main.ts"></script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "bitbybit-playcanvas-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@bitbybit-dev/playcanvas": "0.21.1",
13
+ "playcanvas": "2.15.1"
14
+ },
15
+ "devDependencies": {
16
+ "typescript": "~5.8.3",
17
+ "vite": "^6.3.2"
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFBD4F"></stop><stop offset="100%" stop-color="#FF980E"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,114 @@
1
+ import "./style.css";
2
+ import { BitByBitBase, Inputs, initBitByBit, initPlayCanvas, type InitBitByBitOptions } from "@bitbybit-dev/playcanvas";
3
+
4
+
5
+ start();
6
+
7
+ async function start() {
8
+ const sceneOptions = new Inputs.PlayCanvasScene.InitPlayCanvasDto();
9
+ sceneOptions.canvasId = "playcanvas-canvas";
10
+ sceneOptions.sceneSize = 10;
11
+ const { scene, app } = initPlayCanvas(sceneOptions);
12
+ const bitbybit = new BitByBitBase();
13
+
14
+ const options: InitBitByBitOptions = {
15
+ enableOCCT: true,
16
+ enableJSCAD: true,
17
+ enableManifold: true,
18
+ };
19
+
20
+ await initBitByBit(app, scene, bitbybit, options);
21
+
22
+ if (options.enableOCCT) {
23
+ await createOCCTGeometry(bitbybit, "#ff0000"); // Red
24
+ }
25
+ if (options.enableManifold) {
26
+ await createManifoldGeometry(bitbybit, "#00ff00"); // Green
27
+ }
28
+ if (options.enableJSCAD) {
29
+ await createJSCADGeometry(bitbybit, "#0000ff"); // Blue
30
+ }
31
+
32
+ }
33
+
34
+ async function createOCCTGeometry(bitbybit: BitByBitBase, color: string) {
35
+ const cubeOptions = new Inputs.OCCT.CubeDto();
36
+ cubeOptions.size = 2.5;
37
+ cubeOptions.center = [0, 1.25, 0];
38
+
39
+ const cube = await bitbybit.occt.shapes.solid.createCube(cubeOptions);
40
+
41
+ const filletOptions =
42
+ new Inputs.OCCT.FilletDto<Inputs.OCCT.TopoDSShapePointer>();
43
+ filletOptions.shape = cube;
44
+ filletOptions.radius = 0.4;
45
+ const roundedCube = await bitbybit.occt.fillets.filletEdges(filletOptions);
46
+
47
+ const drawOptions = new Inputs.Draw.DrawOcctShapeOptions();
48
+ drawOptions.edgeWidth = 0.5;
49
+ drawOptions.faceColour = color;
50
+ drawOptions.drawVertices = true;
51
+ drawOptions.vertexSize = 0.05;
52
+ drawOptions.vertexColour = "#ffffff";
53
+ await bitbybit.draw.drawAnyAsync({
54
+ entity: roundedCube,
55
+ options: drawOptions,
56
+ });
57
+ }
58
+
59
+ async function createManifoldGeometry(bitbybit: BitByBitBase, color: string) {
60
+ const sphereOptions = new Inputs.Manifold.SphereDto();
61
+ sphereOptions.radius = 1.5;
62
+ sphereOptions.circularSegments = 32;
63
+ const sphere = await bitbybit.manifold.manifold.shapes.sphere(sphereOptions);
64
+
65
+ const cubeOptions = new Inputs.Manifold.CubeDto();
66
+ cubeOptions.size = 2.5;
67
+ const cube = await bitbybit.manifold.manifold.shapes.cube(cubeOptions);
68
+
69
+ const diffedShape = await bitbybit.manifold.manifold.booleans.differenceTwo({
70
+ manifold1: cube,
71
+ manifold2: sphere,
72
+ });
73
+
74
+ const translationOptions =
75
+ new Inputs.Manifold.TranslateDto<Inputs.Manifold.ManifoldPointer>();
76
+ translationOptions.manifold = diffedShape;
77
+ translationOptions.vector = [0, 1.25, -4]; // Position below OCCT
78
+ const movedShape = await bitbybit.manifold.manifold.transforms.translate(
79
+ translationOptions
80
+ );
81
+
82
+ const drawOptions = new Inputs.Draw.DrawManifoldOrCrossSectionOptions();
83
+ drawOptions.faceColour = color;
84
+ await bitbybit.draw.drawAnyAsync({
85
+ entity: movedShape,
86
+ options: drawOptions,
87
+ });
88
+ }
89
+
90
+ async function createJSCADGeometry(bitbybit: BitByBitBase, color: string) {
91
+ const geodesicSphereOptions = new Inputs.JSCAD.GeodesicSphereDto();
92
+ geodesicSphereOptions.radius = 1.5;
93
+ geodesicSphereOptions.center = [0, 1.5, 4];
94
+ const geodesicSphere = await bitbybit.jscad.shapes.geodesicSphere(
95
+ geodesicSphereOptions
96
+ );
97
+
98
+ const sphereOptions = new Inputs.JSCAD.SphereDto();
99
+ sphereOptions.radius = 1;
100
+ sphereOptions.center = [0, 3, 4.5];
101
+ const simpleSphere = await bitbybit.jscad.shapes.sphere(sphereOptions);
102
+
103
+ const unionOptions = new Inputs.JSCAD.BooleanTwoObjectsDto();
104
+ unionOptions.first = geodesicSphere;
105
+ unionOptions.second = simpleSphere;
106
+ const unionShape = await bitbybit.jscad.booleans.unionTwo(unionOptions);
107
+
108
+ const drawOptions = new Inputs.Draw.DrawBasicGeometryOptions();
109
+ drawOptions.colours = color;
110
+ await bitbybit.draw.drawAnyAsync({
111
+ entity: unionShape,
112
+ options: drawOptions,
113
+ });
114
+ }
@@ -0,0 +1,25 @@
1
+ body {
2
+ margin: 0px;
3
+ overflow: hidden;
4
+ }
5
+
6
+ a.logo {
7
+ position: absolute;
8
+ color: white;
9
+ vertical-align: middle;
10
+ bottom: 10px;
11
+ left: 10px;
12
+ font-family: 'Courier New', Courier, monospace;
13
+ text-decoration: none;
14
+ width: 100%;
15
+ }
16
+
17
+ .logo {
18
+ margin-bottom: 20px;
19
+ text-align: center;
20
+ }
21
+
22
+ .logo img {
23
+ width: 50px;
24
+ height: 50px;
25
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "verbatimModuleSyntax": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedSideEffectImports": true
23
+ },
24
+ "include": ["src"]
25
+ }
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Bitbybit & Three.js Project</title>
8
+ </head>
9
+ <body>
10
+ <a
11
+ class="logo"
12
+ href="https://bitbybit.dev"
13
+ target="_blank"
14
+ rel="noopener noreferrer"
15
+ >
16
+ <img
17
+ alt="Logo of Bit by bit developers company"
18
+ src="https://bitbybit.dev/assets/logo-gold-small.png"
19
+ />
20
+ <div>bitbybit.dev</div>
21
+ <br />
22
+ <div>support the mission - subscribe</div>
23
+ </a>
24
+ <canvas id="three-canvas"> </canvas>
25
+ <script type="module" src="/src/main.ts"></script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "bitbybit-threejs-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@bitbybit-dev/threejs": "0.21.1"
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "~5.8.3",
16
+ "vite": "^6.3.2",
17
+ "@types/three": "0.182.0"
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFBD4F"></stop><stop offset="100%" stop-color="#FF980E"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,115 @@
1
+ import "./style.css";
2
+ import { BitByBitBase, Inputs, initBitByBit, initThreeJS, type InitBitByBitOptions } from "@bitbybit-dev/threejs";
3
+
4
+
5
+ start();
6
+
7
+ async function start() {
8
+ const sceneOptions = new Inputs.ThreeJSScene.InitThreeJSDto();
9
+ sceneOptions.canvasId = "three-canvas";
10
+ sceneOptions.sceneSize = 10;
11
+ const { scene, startAnimationLoop } = initThreeJS(sceneOptions);
12
+ startAnimationLoop();
13
+ const bitbybit = new BitByBitBase();
14
+
15
+ const options: InitBitByBitOptions = {
16
+ enableOCCT: true,
17
+ enableJSCAD: true,
18
+ enableManifold: true,
19
+ };
20
+
21
+ await initBitByBit(scene, bitbybit, options);
22
+
23
+ if (options.enableOCCT) {
24
+ await createOCCTGeometry(bitbybit, "#ff0000"); // Red
25
+ }
26
+ if (options.enableManifold) {
27
+ await createManifoldGeometry(bitbybit, "#00ff00"); // Green
28
+ }
29
+ if (options.enableJSCAD) {
30
+ await createJSCADGeometry(bitbybit, "#0000ff"); // Blue
31
+ }
32
+
33
+ }
34
+
35
+ async function createOCCTGeometry(bitbybit: BitByBitBase, color: string) {
36
+ const cubeOptions = new Inputs.OCCT.CubeDto();
37
+ cubeOptions.size = 2.5;
38
+ cubeOptions.center = [0, 1.25, 0];
39
+
40
+ const cube = await bitbybit.occt.shapes.solid.createCube(cubeOptions);
41
+
42
+ const filletOptions =
43
+ new Inputs.OCCT.FilletDto<Inputs.OCCT.TopoDSShapePointer>();
44
+ filletOptions.shape = cube;
45
+ filletOptions.radius = 0.4;
46
+ const roundedCube = await bitbybit.occt.fillets.filletEdges(filletOptions);
47
+
48
+ const drawOptions = new Inputs.Draw.DrawOcctShapeOptions();
49
+ drawOptions.edgeWidth = 0.5;
50
+ drawOptions.faceColour = color;
51
+ drawOptions.drawVertices = true;
52
+ drawOptions.vertexSize = 0.05;
53
+ drawOptions.vertexColour = "#ffffff";
54
+ await bitbybit.draw.drawAnyAsync({
55
+ entity: roundedCube,
56
+ options: drawOptions,
57
+ });
58
+ }
59
+
60
+ async function createManifoldGeometry(bitbybit: BitByBitBase, color: string) {
61
+ const sphereOptions = new Inputs.Manifold.SphereDto();
62
+ sphereOptions.radius = 1.5;
63
+ sphereOptions.circularSegments = 32;
64
+ const sphere = await bitbybit.manifold.manifold.shapes.sphere(sphereOptions);
65
+
66
+ const cubeOptions = new Inputs.Manifold.CubeDto();
67
+ cubeOptions.size = 2.5;
68
+ const cube = await bitbybit.manifold.manifold.shapes.cube(cubeOptions);
69
+
70
+ const diffedShape = await bitbybit.manifold.manifold.booleans.differenceTwo({
71
+ manifold1: cube,
72
+ manifold2: sphere,
73
+ });
74
+
75
+ const translationOptions =
76
+ new Inputs.Manifold.TranslateDto<Inputs.Manifold.ManifoldPointer>();
77
+ translationOptions.manifold = diffedShape;
78
+ translationOptions.vector = [0, 1.25, -4]; // Position below OCCT
79
+ const movedShape = await bitbybit.manifold.manifold.transforms.translate(
80
+ translationOptions
81
+ );
82
+
83
+ const drawOptions = new Inputs.Draw.DrawManifoldOrCrossSectionOptions();
84
+ drawOptions.faceColour = color;
85
+ await bitbybit.draw.drawAnyAsync({
86
+ entity: movedShape,
87
+ options: drawOptions,
88
+ });
89
+ }
90
+
91
+ async function createJSCADGeometry(bitbybit: BitByBitBase, color: string) {
92
+ const geodesicSphereOptions = new Inputs.JSCAD.GeodesicSphereDto();
93
+ geodesicSphereOptions.radius = 1.5;
94
+ geodesicSphereOptions.center = [0, 1.5, 4];
95
+ const geodesicSphere = await bitbybit.jscad.shapes.geodesicSphere(
96
+ geodesicSphereOptions
97
+ );
98
+
99
+ const sphereOptions = new Inputs.JSCAD.SphereDto();
100
+ sphereOptions.radius = 1;
101
+ sphereOptions.center = [0, 3, 4.5];
102
+ const simpleSphere = await bitbybit.jscad.shapes.sphere(sphereOptions);
103
+
104
+ const unionOptions = new Inputs.JSCAD.BooleanTwoObjectsDto();
105
+ unionOptions.first = geodesicSphere;
106
+ unionOptions.second = simpleSphere;
107
+ const unionShape = await bitbybit.jscad.booleans.unionTwo(unionOptions);
108
+
109
+ const drawOptions = new Inputs.Draw.DrawBasicGeometryOptions();
110
+ drawOptions.colours = color;
111
+ await bitbybit.draw.drawAnyAsync({
112
+ entity: unionShape,
113
+ options: drawOptions,
114
+ });
115
+ }
@@ -0,0 +1,25 @@
1
+ body {
2
+ margin: 0px;
3
+ overflow: hidden;
4
+ }
5
+
6
+ a.logo {
7
+ position: absolute;
8
+ color: white;
9
+ vertical-align: middle;
10
+ bottom: 10px;
11
+ left: 10px;
12
+ font-family: 'Courier New', Courier, monospace;
13
+ text-decoration: none;
14
+ width: 100%;
15
+ }
16
+
17
+ .logo {
18
+ margin-bottom: 20px;
19
+ text-align: center;
20
+ }
21
+
22
+ .logo img {
23
+ width: 50px;
24
+ height: 50px;
25
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "verbatimModuleSyntax": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedSideEffectImports": true
23
+ },
24
+ "include": ["src"]
25
+ }