protosprite-geom 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/README.md +122 -0
- package/dist/core.js +1 -1
- package/dist/proto_dist/sprite_geometry_pb.d.ts +108 -36
- package/dist/proto_dist/sprite_geometry_pb.js +17 -7
- package/dist/proto_dist/sprite_geometry_pb.js.map +1 -1
- package/dist/src/core/data.d.ts +18 -5
- package/dist/src/core/data.js +60 -18
- package/dist/src/core/data.js.map +1 -1
- package/dist/src/core/index.d.ts +2 -1
- package/dist/src/core/protosprite-geom.d.ts +17 -1
- package/dist/src/core/protosprite-geom.js +54 -1
- package/dist/src/core/protosprite-geom.js.map +1 -1
- package/dist/trace.js +67 -5
- package/dist/trace.js.map +1 -1
- package/package.json +3 -3
- package/proto_dist/sprite_geometry_pb.ts +124 -46
- package/src/core/data.ts +72 -28
- package/src/core/index.ts +8 -0
- package/src/core/protosprite-geom.ts +87 -1
- package/src/trace/index.ts +80 -5
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# protosprite-geom
|
|
2
|
+
|
|
3
|
+
Polygon geometry tracing and encoding for `protosprite`, a protobuf-based sprite sheet encoding format. This package traces sprite images into vector polygon geometry, performs convex decomposition for physics/collision use, and serializes the results using Protocol Buffers.
|
|
4
|
+
|
|
5
|
+
Check out the Three.js-based demo [here](https://brownstein.github.io/protosprite/).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install protosprite-geom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Main Exports
|
|
14
|
+
|
|
15
|
+
- `ProtoSpriteGeometry`: top-level container for sprite geometry data. Handles serialization to/from binary protobuf (`.prsg` files) and provides accessor methods for resolved geometry.
|
|
16
|
+
- `Protos`: protobuf types and schemas under a single key.
|
|
17
|
+
- `Data`: all data classes under a single key.
|
|
18
|
+
|
|
19
|
+
### Data Classes
|
|
20
|
+
|
|
21
|
+
- `SpriteGeometryData` - top-level geometry container for multiple sprites.
|
|
22
|
+
- `SpriteGeometryEntryData` - geometry for a single sprite across all frames, including the de-duplicated shape pool.
|
|
23
|
+
- `ShapePoolEntryData` - a de-duplicated (polygon, convex decomposition) pair stored in the shape pool.
|
|
24
|
+
- `FrameGeometryData` - geometry for a single frame, with per-layer and composite data.
|
|
25
|
+
- `FrameLayerGeometryData` - shape indices for a single layer within a frame.
|
|
26
|
+
- `CompositeFrameGeometryData` - shape indices from all layers of a frame composited together.
|
|
27
|
+
- `PolygonData` - a closed polygon (ordered ring of vertices).
|
|
28
|
+
- `ConvexDecompositionData` - convex decomposition of a polygon into convex components.
|
|
29
|
+
- `Vec2Data` - a 2D vector with sub-pixel precision.
|
|
30
|
+
|
|
31
|
+
### Shape Pool
|
|
32
|
+
|
|
33
|
+
Geometry data is de-duplicated using a **shape pool** on each `SpriteGeometryEntryData`. Instead of storing full polygon vertex data on every frame, each frame stores integer indices into `entry.shapePool`. Identical shapes across frames (common in animations where layers don't change between frames) are stored only once.
|
|
34
|
+
|
|
35
|
+
The `ShapePoolEntryData` pairs a `PolygonData` with its corresponding `ConvexDecompositionData`.
|
|
36
|
+
|
|
37
|
+
### Resolved Geometry Types
|
|
38
|
+
|
|
39
|
+
For convenience, `ProtoSpriteGeometry` provides methods that resolve shape pool indices into concrete polygon data:
|
|
40
|
+
|
|
41
|
+
- `ResolvedFrameGeometry` - resolved geometry for a frame, with layers and optional composite.
|
|
42
|
+
- `ResolvedLayerGeometry` - resolved polygons and convex decompositions for a single layer.
|
|
43
|
+
- `ResolvedCompositeGeometry` - resolved polygons and convex decompositions for the composite frame.
|
|
44
|
+
|
|
45
|
+
### Trace Utilities
|
|
46
|
+
|
|
47
|
+
This package provides geometry tracing utilities under the `protosprite-geom/trace` subpath:
|
|
48
|
+
|
|
49
|
+
- `traceSpriteSheet(sheet, options)` - traces polygon geometry from a `ProtoSpriteSheet`. Supports per-layer and composite tracing modes. Automatically de-duplicates shapes into the shape pool.
|
|
50
|
+
- `traceContours(imageData, alphaThreshold?)` - traces polygon contours from image data using the marching squares algorithm.
|
|
51
|
+
- `simplifyPolygon(polygon, tolerance, highQuality?)` - reduces polygon vertex count using the Ramer-Douglas-Peucker algorithm.
|
|
52
|
+
- `decomposeConvex(polygon)` - decomposes a polygon into convex components.
|
|
53
|
+
|
|
54
|
+
#### TraceSpriteSheetOptions
|
|
55
|
+
|
|
56
|
+
| Option | Type | Default | Description |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| `tolerance` | `number` | required | Simplification tolerance (higher = fewer vertices) |
|
|
59
|
+
| `alphaThreshold` | `number` | `1` | Alpha value threshold for contour detection |
|
|
60
|
+
| `highQuality` | `boolean` | `true` | Use higher quality simplification |
|
|
61
|
+
| `composite` | `boolean` | `true` | Generate composite frame geometry |
|
|
62
|
+
| `perLayer` | `boolean` | `false` | Generate per-layer geometry |
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Tracing geometry from a sprite sheet
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { ProtoSpriteGeometry } from "protosprite-geom";
|
|
70
|
+
import { traceSpriteSheet } from "protosprite-geom/trace";
|
|
71
|
+
|
|
72
|
+
const geomData = await traceSpriteSheet(spriteSheet, {
|
|
73
|
+
tolerance: 0.5,
|
|
74
|
+
composite: true,
|
|
75
|
+
perLayer: false,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const geom = new ProtoSpriteGeometry(geomData);
|
|
79
|
+
geom.embedSpriteSheet(spriteSheet);
|
|
80
|
+
|
|
81
|
+
const bytes = geom.toArray(); // Uint8Array
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Loading and reading geometry
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { ProtoSpriteGeometry } from "protosprite-geom";
|
|
88
|
+
|
|
89
|
+
const bytes = new Uint8Array(buffer);
|
|
90
|
+
const geom = ProtoSpriteGeometry.fromArray(bytes);
|
|
91
|
+
|
|
92
|
+
// Use the accessor API to get resolved geometry for a frame
|
|
93
|
+
const frame = geom.getFrameGeometry("my-sprite", 0);
|
|
94
|
+
if (frame) {
|
|
95
|
+
for (const layer of frame.layers) {
|
|
96
|
+
console.log(layer.polygons); // PolygonData[]
|
|
97
|
+
console.log(layer.convexDecompositions); // ConvexDecompositionData[]
|
|
98
|
+
}
|
|
99
|
+
if (frame.composite) {
|
|
100
|
+
console.log(frame.composite.polygons);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Or access the raw shape pool directly
|
|
105
|
+
const entry = geom.getEntry("my-sprite");
|
|
106
|
+
if (entry) {
|
|
107
|
+
console.log(`${entry.shapePool.length} unique shapes`);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Low-level contour tracing
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { traceContours, simplifyPolygon, decomposeConvex } from "protosprite-geom/trace";
|
|
115
|
+
|
|
116
|
+
const contours = traceContours({ width, height, data: rgbaBuffer });
|
|
117
|
+
|
|
118
|
+
for (const contour of contours) {
|
|
119
|
+
const simplified = simplifyPolygon(contour, 1.0);
|
|
120
|
+
const convexParts = decomposeConvex(simplified);
|
|
121
|
+
}
|
|
122
|
+
```
|
package/dist/core.js
CHANGED
|
@@ -2,6 +2,6 @@ import * as sprite_geometry_pb from './proto_dist/sprite_geometry_pb.js';
|
|
|
2
2
|
export { sprite_geometry_pb as Protos };
|
|
3
3
|
import * as data from './src/core/data.js';
|
|
4
4
|
export { data as Data };
|
|
5
|
-
export { CompositeFrameGeometryData, ConvexDecompositionData, FrameGeometryData, FrameLayerGeometryData, PolygonData, SpriteGeometryData, SpriteGeometryEntryData, Vec2Data } from './src/core/data.js';
|
|
5
|
+
export { CompositeFrameGeometryData, ConvexDecompositionData, FrameGeometryData, FrameLayerGeometryData, IndexedPolygonData, PolygonData, ShapePoolEntryData, SpriteGeometryData, SpriteGeometryEntryData, Vec2Data } from './src/core/data.js';
|
|
6
6
|
export { ProtoSpriteGeometry } from './src/core/protosprite-geom.js';
|
|
7
7
|
//# sourceMappingURL=core.js.map
|
|
@@ -101,6 +101,74 @@ export type ConvexDecompositionJson = {
|
|
|
101
101
|
export declare const ConvexDecompositionSchema: GenMessage<ConvexDecomposition, {
|
|
102
102
|
jsonType: ConvexDecompositionJson;
|
|
103
103
|
}>;
|
|
104
|
+
/**
|
|
105
|
+
* A polygon represented as indices into a vertex pool.
|
|
106
|
+
*
|
|
107
|
+
* @generated from message protosprite.IndexedPolygon
|
|
108
|
+
*/
|
|
109
|
+
export type IndexedPolygon = Message<"protosprite.IndexedPolygon"> & {
|
|
110
|
+
/**
|
|
111
|
+
* @generated from field: repeated int32 vertex_indices = 1;
|
|
112
|
+
*/
|
|
113
|
+
vertexIndices: number[];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* A polygon represented as indices into a vertex pool.
|
|
117
|
+
*
|
|
118
|
+
* @generated from message protosprite.IndexedPolygon
|
|
119
|
+
*/
|
|
120
|
+
export type IndexedPolygonJson = {
|
|
121
|
+
/**
|
|
122
|
+
* @generated from field: repeated int32 vertex_indices = 1;
|
|
123
|
+
*/
|
|
124
|
+
vertexIndices?: number[];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Describes the message protosprite.IndexedPolygon.
|
|
128
|
+
* Use `create(IndexedPolygonSchema)` to create a new message.
|
|
129
|
+
*/
|
|
130
|
+
export declare const IndexedPolygonSchema: GenMessage<IndexedPolygon, {
|
|
131
|
+
jsonType: IndexedPolygonJson;
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* A de-duplicated (polygon, convex decomposition) pair stored in the shape pool.
|
|
135
|
+
* Vertices are referenced by index into the parent SpriteGeometryEntry.vertex_pool.
|
|
136
|
+
*
|
|
137
|
+
* @generated from message protosprite.ShapePoolEntry
|
|
138
|
+
*/
|
|
139
|
+
export type ShapePoolEntry = Message<"protosprite.ShapePoolEntry"> & {
|
|
140
|
+
/**
|
|
141
|
+
* @generated from field: protosprite.IndexedPolygon polygon = 1;
|
|
142
|
+
*/
|
|
143
|
+
polygon?: IndexedPolygon;
|
|
144
|
+
/**
|
|
145
|
+
* @generated from field: repeated protosprite.IndexedPolygon convex_decomposition_components = 2;
|
|
146
|
+
*/
|
|
147
|
+
convexDecompositionComponents: IndexedPolygon[];
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* A de-duplicated (polygon, convex decomposition) pair stored in the shape pool.
|
|
151
|
+
* Vertices are referenced by index into the parent SpriteGeometryEntry.vertex_pool.
|
|
152
|
+
*
|
|
153
|
+
* @generated from message protosprite.ShapePoolEntry
|
|
154
|
+
*/
|
|
155
|
+
export type ShapePoolEntryJson = {
|
|
156
|
+
/**
|
|
157
|
+
* @generated from field: protosprite.IndexedPolygon polygon = 1;
|
|
158
|
+
*/
|
|
159
|
+
polygon?: IndexedPolygonJson;
|
|
160
|
+
/**
|
|
161
|
+
* @generated from field: repeated protosprite.IndexedPolygon convex_decomposition_components = 2;
|
|
162
|
+
*/
|
|
163
|
+
convexDecompositionComponents?: IndexedPolygonJson[];
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Describes the message protosprite.ShapePoolEntry.
|
|
167
|
+
* Use `create(ShapePoolEntrySchema)` to create a new message.
|
|
168
|
+
*/
|
|
169
|
+
export declare const ShapePoolEntrySchema: GenMessage<ShapePoolEntry, {
|
|
170
|
+
jsonType: ShapePoolEntryJson;
|
|
171
|
+
}>;
|
|
104
172
|
/**
|
|
105
173
|
* Traced geometry for one layer within one frame.
|
|
106
174
|
*
|
|
@@ -112,17 +180,12 @@ export type FrameLayerGeometry = Message<"protosprite.FrameLayerGeometry"> & {
|
|
|
112
180
|
*/
|
|
113
181
|
layerIndex: number;
|
|
114
182
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* @generated from field: repeated protosprite.Polygon polygons = 2;
|
|
118
|
-
*/
|
|
119
|
-
polygons: Polygon[];
|
|
120
|
-
/**
|
|
121
|
-
* Convex decompositions corresponding 1:1 to `polygons`.
|
|
183
|
+
* Fields 2 and 3 removed (previously polygons / convex_decompositions).
|
|
184
|
+
* Indices into the parent SpriteGeometryEntry.shape_pool.
|
|
122
185
|
*
|
|
123
|
-
* @generated from field: repeated
|
|
186
|
+
* @generated from field: repeated int32 shape_indices = 4;
|
|
124
187
|
*/
|
|
125
|
-
|
|
188
|
+
shapeIndices: number[];
|
|
126
189
|
};
|
|
127
190
|
/**
|
|
128
191
|
* Traced geometry for one layer within one frame.
|
|
@@ -135,17 +198,12 @@ export type FrameLayerGeometryJson = {
|
|
|
135
198
|
*/
|
|
136
199
|
layerIndex?: number;
|
|
137
200
|
/**
|
|
138
|
-
*
|
|
201
|
+
* Fields 2 and 3 removed (previously polygons / convex_decompositions).
|
|
202
|
+
* Indices into the parent SpriteGeometryEntry.shape_pool.
|
|
139
203
|
*
|
|
140
|
-
* @generated from field: repeated
|
|
204
|
+
* @generated from field: repeated int32 shape_indices = 4;
|
|
141
205
|
*/
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Convex decompositions corresponding 1:1 to `polygons`.
|
|
145
|
-
*
|
|
146
|
-
* @generated from field: repeated protosprite.ConvexDecomposition convex_decompositions = 3;
|
|
147
|
-
*/
|
|
148
|
-
convexDecompositions?: ConvexDecompositionJson[];
|
|
206
|
+
shapeIndices?: number[];
|
|
149
207
|
};
|
|
150
208
|
/**
|
|
151
209
|
* Describes the message protosprite.FrameLayerGeometry.
|
|
@@ -162,17 +220,12 @@ export declare const FrameLayerGeometrySchema: GenMessage<FrameLayerGeometry, {
|
|
|
162
220
|
*/
|
|
163
221
|
export type CompositeFrameGeometry = Message<"protosprite.CompositeFrameGeometry"> & {
|
|
164
222
|
/**
|
|
165
|
-
*
|
|
223
|
+
* Fields 1 and 2 removed (previously polygons / convex_decompositions).
|
|
224
|
+
* Indices into the parent SpriteGeometryEntry.shape_pool.
|
|
166
225
|
*
|
|
167
|
-
* @generated from field: repeated
|
|
226
|
+
* @generated from field: repeated int32 shape_indices = 3;
|
|
168
227
|
*/
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Convex decompositions corresponding 1:1 to `polygons`.
|
|
172
|
-
*
|
|
173
|
-
* @generated from field: repeated protosprite.ConvexDecomposition convex_decompositions = 2;
|
|
174
|
-
*/
|
|
175
|
-
convexDecompositions: ConvexDecomposition[];
|
|
228
|
+
shapeIndices: number[];
|
|
176
229
|
};
|
|
177
230
|
/**
|
|
178
231
|
* Composite geometry for the entire frame (all layers flattened).
|
|
@@ -182,17 +235,12 @@ export type CompositeFrameGeometry = Message<"protosprite.CompositeFrameGeometry
|
|
|
182
235
|
*/
|
|
183
236
|
export type CompositeFrameGeometryJson = {
|
|
184
237
|
/**
|
|
185
|
-
*
|
|
238
|
+
* Fields 1 and 2 removed (previously polygons / convex_decompositions).
|
|
239
|
+
* Indices into the parent SpriteGeometryEntry.shape_pool.
|
|
186
240
|
*
|
|
187
|
-
* @generated from field: repeated
|
|
241
|
+
* @generated from field: repeated int32 shape_indices = 3;
|
|
188
242
|
*/
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Convex decompositions corresponding 1:1 to `polygons`.
|
|
192
|
-
*
|
|
193
|
-
* @generated from field: repeated protosprite.ConvexDecomposition convex_decompositions = 2;
|
|
194
|
-
*/
|
|
195
|
-
convexDecompositions?: ConvexDecompositionJson[];
|
|
243
|
+
shapeIndices?: number[];
|
|
196
244
|
};
|
|
197
245
|
/**
|
|
198
246
|
* Describes the message protosprite.CompositeFrameGeometry.
|
|
@@ -272,6 +320,18 @@ export type SpriteGeometryEntry = Message<"protosprite.SpriteGeometryEntry"> & {
|
|
|
272
320
|
* @generated from field: float simplify_tolerance = 3;
|
|
273
321
|
*/
|
|
274
322
|
simplifyTolerance: number;
|
|
323
|
+
/**
|
|
324
|
+
* De-duplicated shape pool. Frames reference shapes by index into this pool.
|
|
325
|
+
*
|
|
326
|
+
* @generated from field: repeated protosprite.ShapePoolEntry shape_pool = 4;
|
|
327
|
+
*/
|
|
328
|
+
shapePool: ShapePoolEntry[];
|
|
329
|
+
/**
|
|
330
|
+
* De-duplicated vertex pool. ShapePoolEntry indices reference vertices here.
|
|
331
|
+
*
|
|
332
|
+
* @generated from field: repeated protosprite.Vec2 vertex_pool = 5;
|
|
333
|
+
*/
|
|
334
|
+
vertexPool: Vec2[];
|
|
275
335
|
};
|
|
276
336
|
/**
|
|
277
337
|
* Top-level geometry container for one sprite.
|
|
@@ -293,6 +353,18 @@ export type SpriteGeometryEntryJson = {
|
|
|
293
353
|
* @generated from field: float simplify_tolerance = 3;
|
|
294
354
|
*/
|
|
295
355
|
simplifyTolerance?: number | "NaN" | "Infinity" | "-Infinity";
|
|
356
|
+
/**
|
|
357
|
+
* De-duplicated shape pool. Frames reference shapes by index into this pool.
|
|
358
|
+
*
|
|
359
|
+
* @generated from field: repeated protosprite.ShapePoolEntry shape_pool = 4;
|
|
360
|
+
*/
|
|
361
|
+
shapePool?: ShapePoolEntryJson[];
|
|
362
|
+
/**
|
|
363
|
+
* De-duplicated vertex pool. ShapePoolEntry indices reference vertices here.
|
|
364
|
+
*
|
|
365
|
+
* @generated from field: repeated protosprite.Vec2 vertex_pool = 5;
|
|
366
|
+
*/
|
|
367
|
+
vertexPool?: Vec2Json[];
|
|
296
368
|
};
|
|
297
369
|
/**
|
|
298
370
|
* Describes the message protosprite.SpriteGeometryEntry.
|
|
@@ -6,7 +6,7 @@ import { fileDesc, messageDesc } from '@bufbuild/protobuf/codegenv2';
|
|
|
6
6
|
/**
|
|
7
7
|
* Describes the file sprite_geometry.proto.
|
|
8
8
|
*/
|
|
9
|
-
const file_sprite_geometry = /*@__PURE__*/ fileDesc("
|
|
9
|
+
const file_sprite_geometry = /*@__PURE__*/ fileDesc("ChVzcHJpdGVfZ2VvbWV0cnkucHJvdG8SC3Byb3Rvc3ByaX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KB2VudHJpZXMYASADKAsyIC5wcm90b3Nwcml0ZS5TcHJpdGVHZW9tZXRyeUVudHJ5EhYKDGVtYmVkZGVkX3BycxgCIAEoDEgAEhsKEWV4dGVybmFsX3Byc19maWxlGAMgASgJSAASGgoQZXh0ZXJuYWxfcHJzX3VybBgEIAEoCUgAQg8KDXNwcml0ZV9zb3VyY2ViBnByb3RvMw");
|
|
10
10
|
/**
|
|
11
11
|
* Describes the message protosprite.Vec2.
|
|
12
12
|
* Use `create(Vec2Schema)` to create a new message.
|
|
@@ -22,31 +22,41 @@ const PolygonSchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 1);
|
|
|
22
22
|
* Use `create(ConvexDecompositionSchema)` to create a new message.
|
|
23
23
|
*/
|
|
24
24
|
const ConvexDecompositionSchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 2);
|
|
25
|
+
/**
|
|
26
|
+
* Describes the message protosprite.IndexedPolygon.
|
|
27
|
+
* Use `create(IndexedPolygonSchema)` to create a new message.
|
|
28
|
+
*/
|
|
29
|
+
const IndexedPolygonSchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 3);
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message protosprite.ShapePoolEntry.
|
|
32
|
+
* Use `create(ShapePoolEntrySchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
const ShapePoolEntrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 4);
|
|
25
35
|
/**
|
|
26
36
|
* Describes the message protosprite.FrameLayerGeometry.
|
|
27
37
|
* Use `create(FrameLayerGeometrySchema)` to create a new message.
|
|
28
38
|
*/
|
|
29
|
-
const FrameLayerGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry,
|
|
39
|
+
const FrameLayerGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 5);
|
|
30
40
|
/**
|
|
31
41
|
* Describes the message protosprite.CompositeFrameGeometry.
|
|
32
42
|
* Use `create(CompositeFrameGeometrySchema)` to create a new message.
|
|
33
43
|
*/
|
|
34
|
-
const CompositeFrameGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry,
|
|
44
|
+
const CompositeFrameGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 6);
|
|
35
45
|
/**
|
|
36
46
|
* Describes the message protosprite.FrameGeometry.
|
|
37
47
|
* Use `create(FrameGeometrySchema)` to create a new message.
|
|
38
48
|
*/
|
|
39
|
-
const FrameGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry,
|
|
49
|
+
const FrameGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 7);
|
|
40
50
|
/**
|
|
41
51
|
* Describes the message protosprite.SpriteGeometryEntry.
|
|
42
52
|
* Use `create(SpriteGeometryEntrySchema)` to create a new message.
|
|
43
53
|
*/
|
|
44
|
-
const SpriteGeometryEntrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry,
|
|
54
|
+
const SpriteGeometryEntrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 8);
|
|
45
55
|
/**
|
|
46
56
|
* Describes the message protosprite.SpriteGeometry.
|
|
47
57
|
* Use `create(SpriteGeometrySchema)` to create a new message.
|
|
48
58
|
*/
|
|
49
|
-
const SpriteGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry,
|
|
59
|
+
const SpriteGeometrySchema = /*@__PURE__*/ messageDesc(file_sprite_geometry, 9);
|
|
50
60
|
|
|
51
|
-
export { CompositeFrameGeometrySchema, ConvexDecompositionSchema, FrameGeometrySchema, FrameLayerGeometrySchema, PolygonSchema, SpriteGeometryEntrySchema, SpriteGeometrySchema, Vec2Schema, file_sprite_geometry };
|
|
61
|
+
export { CompositeFrameGeometrySchema, ConvexDecompositionSchema, FrameGeometrySchema, FrameLayerGeometrySchema, IndexedPolygonSchema, PolygonSchema, ShapePoolEntrySchema, SpriteGeometryEntrySchema, SpriteGeometrySchema, Vec2Schema, file_sprite_geometry };
|
|
52
62
|
//# sourceMappingURL=sprite_geometry_pb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprite_geometry_pb.js","sources":["../../proto_dist/sprite_geometry_pb.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AACA;AAMA;;AAEG;AACI,MAAM,oBAAoB,iBAC/B,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"sprite_geometry_pb.js","sources":["../../proto_dist/sprite_geometry_pb.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AACA;AAMA;;AAEG;AACI,MAAM,oBAAoB,iBAC/B,QAAQ,CAAC,ozCAAozC;AAsC/zC;;;AAGG;AACI,MAAM,UAAU,iBACrB,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA0BrC;;;AAGG;AACI,MAAM,aAAa,iBACxB,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA0BrC;;;AAGG;AACI,MAAM,yBAAyB,iBACpC,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA0BrC;;;AAGG;AACI,MAAM,oBAAoB,iBAC/B,WAAW,CAAC,oBAAoB,EAAE,CAAC;AAsCrC;;;AAGG;AACI,MAAM,oBAAoB,iBAC/B,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA0CrC;;;AAGG;AACI,MAAM,wBAAwB,iBACnC,WAAW,CAAC,oBAAoB,EAAE,CAAC;AAkCrC;;;AAGG;AACI,MAAM,4BAA4B,iBACvC,WAAW,CAAC,oBAAoB,EAAE,CAAC;AAoDrC;;;AAGG;AACI,MAAM,mBAAmB,iBAC9B,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA8ErC;;;AAGG;AACI,MAAM,yBAAyB,iBACpC,WAAW,CAAC,oBAAoB,EAAE,CAAC;AA8ErC;;;AAGG;AACI,MAAM,oBAAoB,iBAC/B,WAAW,CAAC,oBAAoB,EAAE,CAAC;;;;"}
|
package/dist/src/core/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompositeFrameGeometry, ConvexDecomposition, FrameGeometry, FrameLayerGeometry, Polygon, SpriteGeometry, SpriteGeometryEntry, Vec2 } from "../../proto_dist/sprite_geometry_pb.js";
|
|
1
|
+
import { CompositeFrameGeometry, ConvexDecomposition, FrameGeometry, FrameLayerGeometry, IndexedPolygon, Polygon, ShapePoolEntry, SpriteGeometry, SpriteGeometryEntry, Vec2 } from "../../proto_dist/sprite_geometry_pb.js";
|
|
2
2
|
export declare class Vec2Data {
|
|
3
3
|
x: number;
|
|
4
4
|
y: number;
|
|
@@ -18,17 +18,28 @@ export declare class ConvexDecompositionData {
|
|
|
18
18
|
toProto(protoIn?: ConvexDecomposition): ConvexDecomposition;
|
|
19
19
|
clone(): ConvexDecompositionData;
|
|
20
20
|
}
|
|
21
|
+
export declare class IndexedPolygonData {
|
|
22
|
+
vertexIndices: number[];
|
|
23
|
+
static fromProto(proto: IndexedPolygon): IndexedPolygonData;
|
|
24
|
+
toProto(protoIn?: IndexedPolygon): IndexedPolygon;
|
|
25
|
+
clone(): IndexedPolygonData;
|
|
26
|
+
}
|
|
27
|
+
export declare class ShapePoolEntryData {
|
|
28
|
+
polygon: IndexedPolygonData;
|
|
29
|
+
convexDecompositionComponents: IndexedPolygonData[];
|
|
30
|
+
static fromProto(proto: ShapePoolEntry): ShapePoolEntryData;
|
|
31
|
+
toProto(protoIn?: ShapePoolEntry): ShapePoolEntry;
|
|
32
|
+
clone(): ShapePoolEntryData;
|
|
33
|
+
}
|
|
21
34
|
export declare class FrameLayerGeometryData {
|
|
22
35
|
layerIndex: number;
|
|
23
|
-
|
|
24
|
-
convexDecompositions: ConvexDecompositionData[];
|
|
36
|
+
shapeIndices: number[];
|
|
25
37
|
static fromProto(proto: FrameLayerGeometry): FrameLayerGeometryData;
|
|
26
38
|
toProto(protoIn?: FrameLayerGeometry): FrameLayerGeometry;
|
|
27
39
|
clone(): FrameLayerGeometryData;
|
|
28
40
|
}
|
|
29
41
|
export declare class CompositeFrameGeometryData {
|
|
30
|
-
|
|
31
|
-
convexDecompositions: ConvexDecompositionData[];
|
|
42
|
+
shapeIndices: number[];
|
|
32
43
|
static fromProto(proto: CompositeFrameGeometry): CompositeFrameGeometryData;
|
|
33
44
|
toProto(protoIn?: CompositeFrameGeometry): CompositeFrameGeometry;
|
|
34
45
|
clone(): CompositeFrameGeometryData;
|
|
@@ -45,6 +56,8 @@ export declare class SpriteGeometryEntryData {
|
|
|
45
56
|
spriteName: string;
|
|
46
57
|
frames: FrameGeometryData[];
|
|
47
58
|
simplifyTolerance: number;
|
|
59
|
+
shapePool: ShapePoolEntryData[];
|
|
60
|
+
vertexPool: Vec2Data[];
|
|
48
61
|
static fromProto(proto: SpriteGeometryEntry): SpriteGeometryEntryData;
|
|
49
62
|
toProto(protoIn?: SpriteGeometryEntry): SpriteGeometryEntry;
|
|
50
63
|
clone(): SpriteGeometryEntryData;
|
package/dist/src/core/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { create } from '@bufbuild/protobuf';
|
|
2
|
-
import { Vec2Schema, PolygonSchema, ConvexDecompositionSchema, FrameLayerGeometrySchema, CompositeFrameGeometrySchema, FrameGeometrySchema, SpriteGeometryEntrySchema, SpriteGeometrySchema } from '../../proto_dist/sprite_geometry_pb.js';
|
|
2
|
+
import { Vec2Schema, PolygonSchema, ConvexDecompositionSchema, IndexedPolygonSchema, ShapePoolEntrySchema, FrameLayerGeometrySchema, CompositeFrameGeometrySchema, FrameGeometrySchema, SpriteGeometryEntrySchema, SpriteGeometrySchema } from '../../proto_dist/sprite_geometry_pb.js';
|
|
3
3
|
|
|
4
4
|
class Vec2Data {
|
|
5
5
|
x = 0;
|
|
@@ -59,51 +59,85 @@ class ConvexDecompositionData {
|
|
|
59
59
|
return other;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
class IndexedPolygonData {
|
|
63
|
+
vertexIndices = [];
|
|
64
|
+
static fromProto(proto) {
|
|
65
|
+
const instance = new IndexedPolygonData();
|
|
66
|
+
instance.vertexIndices = [...proto.vertexIndices];
|
|
67
|
+
return instance;
|
|
68
|
+
}
|
|
69
|
+
toProto(protoIn) {
|
|
70
|
+
const proto = protoIn ?? create(IndexedPolygonSchema);
|
|
71
|
+
proto.vertexIndices = [...this.vertexIndices];
|
|
72
|
+
return proto;
|
|
73
|
+
}
|
|
74
|
+
clone() {
|
|
75
|
+
const other = new IndexedPolygonData();
|
|
76
|
+
other.vertexIndices = [...this.vertexIndices];
|
|
77
|
+
return other;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
class ShapePoolEntryData {
|
|
81
|
+
polygon = new IndexedPolygonData();
|
|
82
|
+
convexDecompositionComponents = [];
|
|
83
|
+
static fromProto(proto) {
|
|
84
|
+
const instance = new ShapePoolEntryData();
|
|
85
|
+
if (proto.polygon) {
|
|
86
|
+
instance.polygon = IndexedPolygonData.fromProto(proto.polygon);
|
|
87
|
+
}
|
|
88
|
+
instance.convexDecompositionComponents = proto.convexDecompositionComponents.map(IndexedPolygonData.fromProto);
|
|
89
|
+
return instance;
|
|
90
|
+
}
|
|
91
|
+
toProto(protoIn) {
|
|
92
|
+
const proto = protoIn ?? create(ShapePoolEntrySchema);
|
|
93
|
+
proto.polygon = this.polygon.toProto();
|
|
94
|
+
proto.convexDecompositionComponents = this.convexDecompositionComponents.map((c) => c.toProto());
|
|
95
|
+
return proto;
|
|
96
|
+
}
|
|
97
|
+
clone() {
|
|
98
|
+
const other = new ShapePoolEntryData();
|
|
99
|
+
other.polygon = this.polygon.clone();
|
|
100
|
+
other.convexDecompositionComponents = this.convexDecompositionComponents.map((c) => c.clone());
|
|
101
|
+
return other;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
62
104
|
class FrameLayerGeometryData {
|
|
63
105
|
layerIndex = 0;
|
|
64
|
-
|
|
65
|
-
convexDecompositions = [];
|
|
106
|
+
shapeIndices = [];
|
|
66
107
|
static fromProto(proto) {
|
|
67
108
|
const instance = new FrameLayerGeometryData();
|
|
68
109
|
instance.layerIndex = proto.layerIndex;
|
|
69
|
-
instance.
|
|
70
|
-
instance.convexDecompositions = proto.convexDecompositions.map(ConvexDecompositionData.fromProto);
|
|
110
|
+
instance.shapeIndices = [...proto.shapeIndices];
|
|
71
111
|
return instance;
|
|
72
112
|
}
|
|
73
113
|
toProto(protoIn) {
|
|
74
114
|
const proto = protoIn ?? create(FrameLayerGeometrySchema);
|
|
75
115
|
proto.layerIndex = this.layerIndex;
|
|
76
|
-
proto.
|
|
77
|
-
proto.convexDecompositions = this.convexDecompositions.map((d) => d.toProto());
|
|
116
|
+
proto.shapeIndices = [...this.shapeIndices];
|
|
78
117
|
return proto;
|
|
79
118
|
}
|
|
80
119
|
clone() {
|
|
81
120
|
const other = new FrameLayerGeometryData();
|
|
82
121
|
other.layerIndex = this.layerIndex;
|
|
83
|
-
other.
|
|
84
|
-
other.convexDecompositions = this.convexDecompositions.map((d) => d.clone());
|
|
122
|
+
other.shapeIndices = [...this.shapeIndices];
|
|
85
123
|
return other;
|
|
86
124
|
}
|
|
87
125
|
}
|
|
88
126
|
class CompositeFrameGeometryData {
|
|
89
|
-
|
|
90
|
-
convexDecompositions = [];
|
|
127
|
+
shapeIndices = [];
|
|
91
128
|
static fromProto(proto) {
|
|
92
129
|
const instance = new CompositeFrameGeometryData();
|
|
93
|
-
instance.
|
|
94
|
-
instance.convexDecompositions = proto.convexDecompositions.map(ConvexDecompositionData.fromProto);
|
|
130
|
+
instance.shapeIndices = [...proto.shapeIndices];
|
|
95
131
|
return instance;
|
|
96
132
|
}
|
|
97
133
|
toProto(protoIn) {
|
|
98
134
|
const proto = protoIn ?? create(CompositeFrameGeometrySchema);
|
|
99
|
-
proto.
|
|
100
|
-
proto.convexDecompositions = this.convexDecompositions.map((d) => d.toProto());
|
|
135
|
+
proto.shapeIndices = [...this.shapeIndices];
|
|
101
136
|
return proto;
|
|
102
137
|
}
|
|
103
138
|
clone() {
|
|
104
139
|
const other = new CompositeFrameGeometryData();
|
|
105
|
-
other.
|
|
106
|
-
other.convexDecompositions = this.convexDecompositions.map((d) => d.clone());
|
|
140
|
+
other.shapeIndices = [...this.shapeIndices];
|
|
107
141
|
return other;
|
|
108
142
|
}
|
|
109
143
|
}
|
|
@@ -139,11 +173,15 @@ class SpriteGeometryEntryData {
|
|
|
139
173
|
spriteName = "";
|
|
140
174
|
frames = [];
|
|
141
175
|
simplifyTolerance = 1.0;
|
|
176
|
+
shapePool = [];
|
|
177
|
+
vertexPool = [];
|
|
142
178
|
static fromProto(proto) {
|
|
143
179
|
const instance = new SpriteGeometryEntryData();
|
|
144
180
|
instance.spriteName = proto.spriteName;
|
|
145
181
|
instance.frames = proto.frames.map(FrameGeometryData.fromProto);
|
|
146
182
|
instance.simplifyTolerance = proto.simplifyTolerance;
|
|
183
|
+
instance.shapePool = proto.shapePool.map(ShapePoolEntryData.fromProto);
|
|
184
|
+
instance.vertexPool = proto.vertexPool.map(Vec2Data.fromProto);
|
|
147
185
|
return instance;
|
|
148
186
|
}
|
|
149
187
|
toProto(protoIn) {
|
|
@@ -151,6 +189,8 @@ class SpriteGeometryEntryData {
|
|
|
151
189
|
proto.spriteName = this.spriteName;
|
|
152
190
|
proto.frames = this.frames.map((f) => f.toProto());
|
|
153
191
|
proto.simplifyTolerance = this.simplifyTolerance;
|
|
192
|
+
proto.shapePool = this.shapePool.map((s) => s.toProto());
|
|
193
|
+
proto.vertexPool = this.vertexPool.map((v) => v.toProto());
|
|
154
194
|
return proto;
|
|
155
195
|
}
|
|
156
196
|
clone() {
|
|
@@ -158,6 +198,8 @@ class SpriteGeometryEntryData {
|
|
|
158
198
|
other.spriteName = this.spriteName;
|
|
159
199
|
other.frames = this.frames.map((f) => f.clone());
|
|
160
200
|
other.simplifyTolerance = this.simplifyTolerance;
|
|
201
|
+
other.shapePool = this.shapePool.map((s) => s.clone());
|
|
202
|
+
other.vertexPool = this.vertexPool.map((v) => v.clone());
|
|
161
203
|
return other;
|
|
162
204
|
}
|
|
163
205
|
}
|
|
@@ -234,5 +276,5 @@ class SpriteGeometryData {
|
|
|
234
276
|
}
|
|
235
277
|
}
|
|
236
278
|
|
|
237
|
-
export { CompositeFrameGeometryData, ConvexDecompositionData, FrameGeometryData, FrameLayerGeometryData, PolygonData, SpriteGeometryData, SpriteGeometryEntryData, Vec2Data };
|
|
279
|
+
export { CompositeFrameGeometryData, ConvexDecompositionData, FrameGeometryData, FrameLayerGeometryData, IndexedPolygonData, PolygonData, ShapePoolEntryData, SpriteGeometryData, SpriteGeometryEntryData, Vec2Data };
|
|
238
280
|
//# sourceMappingURL=data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sources":["../../../src/core/data.ts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"data.js","sources":["../../../src/core/data.ts"],"sourcesContent":[null],"names":[],"mappings":";;;MAyBa,QAAQ,CAAA;IACZ,CAAC,GAAG,CAAC;IACL,CAAC,GAAG,CAAC;IAEZ,OAAO,SAAS,CAAC,KAAW,EAAA;AAC1B,QAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE;AAC/B,QAAA,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,QAAA,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,QAAA,OAAO,QAAQ;IACjB;AAEA,IAAA,OAAO,CAAC,OAAc,EAAA;QACpB,MAAM,KAAK,GAAG,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC;AAC3C,QAAA,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAChB,QAAA,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAChB,QAAA,OAAO,KAAK;IACd;IAEA,KAAK,GAAA;AACH,QAAA,MAAM,KAAK,GAAG,IAAI,QAAQ,EAAE;AAC5B,QAAA,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAChB,QAAA,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AA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b.js";
|
|
|
2
2
|
import * as Data from "./data.js";
|
|
3
3
|
import { ProtoSpriteGeometry } from "./protosprite-geom.js";
|
|
4
4
|
export { ProtoSpriteGeometry, Protos, Data };
|
|
5
|
-
export { Vec2Data, PolygonData, ConvexDecompositionData, FrameLayerGeometryData, CompositeFrameGeometryData, FrameGeometryData, SpriteGeometryEntryData, SpriteGeometryData } from "./data.js";
|
|
5
|
+
export { Vec2Data, PolygonData, ConvexDecompositionData, IndexedPolygonData, ShapePoolEntryData, FrameLayerGeometryData, CompositeFrameGeometryData, FrameGeometryData, SpriteGeometryEntryData, SpriteGeometryData } from "./data.js";
|
|
6
6
|
export type { SpriteSourceData } from "./data.js";
|
|
7
|
+
export type { ResolvedLayerGeometry, ResolvedCompositeGeometry, ResolvedFrameGeometry } from "./protosprite-geom.js";
|