-
Notifications
You must be signed in to change notification settings - Fork 333
Binary Curve File Format
François Beaune edited this page Dec 5, 2018
·
7 revisions
The purpose of the BinaryCurve file format is to store 3D curves in a compact and efficient-to-read form.
Binary Curve files conventionally use the .binarycurve
file extension.
- All offsets are zero-based (the first byte of the file is at offset 0).
- All offsets and lengths are expressed in bytes.
- All multi-byte fields are using the little-endian (Intel) convention.
Field Length | Field Type | Description |
---|---|---|
11 | string | File signature. Must be equal to BINARYCURVE (in capitals) for the file to be considered valid. |
2 | uint16 | File format version |
variable | composite | Data block (see below) |
The format of the data block depends on the value of the file format version field.
Field Length | Field Type | Description |
---|---|---|
1 | uint8 | Curve basis: 1 = Linear, 2 = Bézier, 3 = B-spline, 4 = Catmull-Rom |
4 | uint32 | Number of curves |
4 | uint32 | Number of vertices of curve #1 |
4 | float | X coordinate of vertex #1 |
4 | float | Y coordinate of vertex #1 |
4 | float | Z coordinate of vertex #1 |
4 | float | X coordinate of vertex #2 |
... | ||
4 | float | Curve width at vertex #1 |
4 | float | Curve width at vertex #2 |
... | ||
4 | float | Curve opacity at vertex #1 |
4 | float | Curve opacity at vertex #2 |
... | ||
4 | float | Red component of curve color at vertex #1 |
4 | float | Green component of curve color at vertex #1 |
4 | float | Blue component of curve color at vertex #1 |
4 | float | Red component of curve color at vertex #2 |
... |
In version 2, the data block has the same format as in version 1 but it is compressed with the LZ4 library.
The data block is split into multiple sub-blocks that are compressed independently. Each sub-block has the following format:
Field Length | Field Type | Description |
---|---|---|
8 | uint64 | Length of uncompressed sub-block |
8 | uint64 | Length of compressed sub-block |
variable | bytes[] | Compressed sub-block |