@axion-engine/core 0.0.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.
- package/README.md +81 -0
- package/dist/axion-platform/index.d.ts +4 -0
- package/dist/axion-platform/index.d.ts.map +1 -0
- package/dist/axion-platform/src/components/AxionCanvas.d.ts +5 -0
- package/dist/axion-platform/src/components/AxionCanvas.d.ts.map +1 -0
- package/dist/axion-platform/src/context/AxionContext.d.ts +7 -0
- package/dist/axion-platform/src/context/AxionContext.d.ts.map +1 -0
- package/dist/axion-platform/src/index.d.ts +4 -0
- package/dist/axion-platform/src/index.d.ts.map +1 -0
- package/dist/axion-worker.js +4110 -0
- package/dist/axion-worker.js.map +7 -0
- package/dist/core/src/SceneRegistry/types.d.ts +17 -0
- package/dist/core/src/SceneRegistry/types.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +1 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/worker/AxionWorker.d.ts +7 -0
- package/dist/worker/AxionWorker.d.ts.map +1 -0
- package/dist/worker/src/defaultScene.d.ts +3 -0
- package/dist/worker/src/defaultScene.d.ts.map +1 -0
- package/dist/worker/src/index.d.ts +2 -0
- package/dist/worker/src/index.d.ts.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @axion-engine/core 🚀
|
|
2
|
+
|
|
3
|
+
> **Experimental:** A web-native 3D engine currently focused on running **React Three Fiber** entirely inside a Web Worker.
|
|
4
|
+
|
|
5
|
+
**Axion Engine** is a specialized, experimental alternative to `@react-three/offscreen`. It is designed for developers who need to move their entire rendering loop, React hooks, and scene logic off the main thread to ensure the UI remains responsive even during heavy 3D computations.
|
|
6
|
+
|
|
7
|
+
## ✨ Current State
|
|
8
|
+
|
|
9
|
+
* **Multi-threaded R3F:** Execute your React Three Fiber components, state, and Three.js objects inside a dedicated Web Worker.
|
|
10
|
+
* **Vite Native:** Optimized for modern Vite projects; handles worker bundling automatically via standard URL patterns.
|
|
11
|
+
* **Offscreen Handshake:** Simplified canvas transfer logic between the Main thread UI and the Worker thread engine.
|
|
12
|
+
* **Performance-First:** Decouples the rendering loop from the browser's main thread to prevent frame drops in complex apps.
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @axion-engine/core three @react-three/fiber react react-dom
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
## 🚀 Usage
|
|
21
|
+
Axion consists of a Bridge (Main Thread) and an Engine (Worker Thread). Below is the standard setup for a Vite-based project.
|
|
22
|
+
|
|
23
|
+
1. Main Thread Setup (App.tsx)
|
|
24
|
+
Initialize your worker and wrap your application in the AxionEngine provider.
|
|
25
|
+
|
|
26
|
+
```tsc
|
|
27
|
+
TypeScript
|
|
28
|
+
|
|
29
|
+
import { useMemo } from 'react';
|
|
30
|
+
import { AxionCanvas, AxionEngine } from "@axion-engine/core";
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
// Vite automatically bundles the worker using this syntax
|
|
34
|
+
const engineWorker = useMemo(() => {
|
|
35
|
+
return new Worker(
|
|
36
|
+
new URL('@axion-engine/core/worker', import.meta.url),
|
|
37
|
+
{ type: 'classic' } // Axion worker is bundled as an IIFE
|
|
38
|
+
);
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="app-container">
|
|
43
|
+
{/* 1. The Engine Provider manages the worker instance */}
|
|
44
|
+
<AxionEngine worker={engineWorker}>
|
|
45
|
+
|
|
46
|
+
<div className="engine-viewport">
|
|
47
|
+
{/* 2. The Canvas Component handles the Offscreen Handshake */}
|
|
48
|
+
<AxionCanvas shadows>
|
|
49
|
+
{/* Your scene content is managed within the worker */}
|
|
50
|
+
</AxionCanvas>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
</AxionEngine>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default App;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🛠 Local Development & Testing
|
|
62
|
+
You can test the engine locally using the built-in test environment.
|
|
63
|
+
|
|
64
|
+
Install dependencies:
|
|
65
|
+
|
|
66
|
+
```Bash
|
|
67
|
+
npm install
|
|
68
|
+
```
|
|
69
|
+
Run the test suite:
|
|
70
|
+
|
|
71
|
+
```Bash
|
|
72
|
+
npm run test
|
|
73
|
+
```
|
|
74
|
+
Open the test page:
|
|
75
|
+
Navigate to http://localhost:3000/test/ to see the worker-side React scene rendering in action.
|
|
76
|
+
|
|
77
|
+
## 🏗 Why Axion?
|
|
78
|
+
Axion Engine is currently an experiment in creating a more "monolithic" and self-contained worker architecture for 3D web applications. While @react-three/offscreen provides a versatile bridge, Axion is being built as a dedicated foundation for large-scale simulations (such as Orion Realms) where worker-thread stability and high-performance threading are the primary requirements.
|
|
79
|
+
|
|
80
|
+
## 📄 License
|
|
81
|
+
MIT © Vikas
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/axion-platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAA;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxionCanvas.d.ts","sourceRoot":"","sources":["../../../../packages/axion-platform/src/components/AxionCanvas.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAO7D,eAAO,MAAM,WAAW,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,KAAK,CAAC,GAAG,CAAC,OAuD1E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { Context, ReactNode } from "react";
|
|
2
|
+
export declare const AxionContext: Context<Worker | null>;
|
|
3
|
+
export declare const AxionEngine: ({ worker, children }: {
|
|
4
|
+
worker: Worker;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=AxionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxionContext.d.ts","sourceRoot":"","sources":["../../../../packages/axion-platform/src/context/AxionContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAsC,CAAC;AAGvF,eAAO,MAAM,WAAW,GAAI,sBAAsB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAG,KAAK,CAAC,GAAG,CAAC,OAMrG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/axion-platform/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA"}
|