@nakednous/tree 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 +125 -0
- package/dist/index.js +1819 -0
- package/dist/index.js.map +1 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# `@nakednous/tree`
|
|
2
|
+
|
|
3
|
+
Backend for **animations, scene-space queries, visibility tests, and shader-space transforms**.
|
|
4
|
+
|
|
5
|
+
The package is **renderer-agnostic**, has **no dependencies**, and can run in both browser and server environments.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @nakednous/tree
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import * as tree from '@nakednous/tree'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Role
|
|
22
|
+
|
|
23
|
+
`@nakednous/tree` is intended to sit behind a host library or engine.
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
application / renderer
|
|
27
|
+
│
|
|
28
|
+
▼
|
|
29
|
+
integration layer
|
|
30
|
+
(e.g. p5.tree)
|
|
31
|
+
│
|
|
32
|
+
▼
|
|
33
|
+
@nakednous/tree
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The host layer provides camera state, projection parameters, and scene data.
|
|
37
|
+
`@nakednous/tree` performs the underlying computations: animation interpolation, spatial mapping, and visibility testing.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Capabilities
|
|
42
|
+
|
|
43
|
+
### Animation tracks
|
|
44
|
+
|
|
45
|
+
Keyframe animation with playback control.
|
|
46
|
+
|
|
47
|
+
Tracks support:
|
|
48
|
+
|
|
49
|
+
* interpolation between poses
|
|
50
|
+
* rate control
|
|
51
|
+
* seeking
|
|
52
|
+
* looping and ping-pong modes
|
|
53
|
+
|
|
54
|
+
Tracks are renderer-agnostic and can drive cameras, objects, or any transform-like structure.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Scene-space queries
|
|
59
|
+
|
|
60
|
+
Utilities for converting between coordinate spaces.
|
|
61
|
+
|
|
62
|
+
Common queries include:
|
|
63
|
+
|
|
64
|
+
* mapping locations between spaces
|
|
65
|
+
* mapping directions between spaces
|
|
66
|
+
* deriving projection parameters
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### Visibility tests
|
|
71
|
+
|
|
72
|
+
Frustum-based visibility checks for:
|
|
73
|
+
|
|
74
|
+
* points
|
|
75
|
+
* spheres
|
|
76
|
+
* axis-aligned boxes
|
|
77
|
+
|
|
78
|
+
These functions operate on numeric camera descriptions and do not depend on renderer classes.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Shader-space helpers
|
|
83
|
+
|
|
84
|
+
Projection queries and coordinate transforms useful when developing GPU shaders and rendering pipelines.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Philosophy
|
|
89
|
+
|
|
90
|
+
The backend follows a **query-oriented design**.
|
|
91
|
+
|
|
92
|
+
Instead of managing scene graphs or renderer state, it focuses on answering spatial and animation questions:
|
|
93
|
+
|
|
94
|
+
* mapping coordinates between spaces
|
|
95
|
+
* interpolating transforms over time
|
|
96
|
+
* determining whether objects are visible
|
|
97
|
+
|
|
98
|
+
This keeps the core portable and easy to integrate with different engines.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Use cases
|
|
103
|
+
|
|
104
|
+
Typical uses include:
|
|
105
|
+
|
|
106
|
+
* animation backend for cameras or scene objects
|
|
107
|
+
* coordinate-space mapping utilities
|
|
108
|
+
* CPU-side frustum culling
|
|
109
|
+
* shader development tooling
|
|
110
|
+
* server-side scene analysis or preprocessing
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Relationship to `p5.tree`
|
|
115
|
+
|
|
116
|
+
`p5.tree` provides a p5.js integration layer built on top of this backend.
|
|
117
|
+
|
|
118
|
+
It handles renderer-specific tasks such as retrieving camera matrices and applying transforms to p5 objects, while `@nakednous/tree` provides the underlying algorithms.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
GPL-3.0-only
|
|
125
|
+
© JP Charalambos
|