Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/recolude/rap
Official format for time series data captured from 3D Engines.
https://github.com/recolude/rap
3d cli golang recording unity3d
Last synced: 3 months ago
JSON representation
Official format for time series data captured from 3D Engines.
- Host: GitHub
- URL: https://github.com/recolude/rap
- Owner: recolude
- Created: 2021-01-24T19:44:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-14T21:56:34.000Z (over 1 year ago)
- Last Synced: 2024-11-15T01:17:21.380Z (3 months ago)
- Topics: 3d, cli, golang, recording, unity3d
- Language: Go
- Homepage:
- Size: 287 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RAP
[![Build Status](https://travis-ci.com/recolude/rap.svg?branch=main)](https://travis-ci.com/recolude/rap) [![codecov](https://codecov.io/gh/recolude/rap/branch/main/graph/badge.svg?token=hOfjiGvwAj)](https://codecov.io/gh/recolude/rap)
[![Go Report Card](https://goreportcard.com/badge/github.com/recolude/rap)](https://goreportcard.com/report/github.com/recolude/rap)**RAP is in Beta**
Recolude's official recording file format. Ain't no kill like overkill.
## Install
```
git clone https://github.com/recolude/rap
cd rap
go install ./cmd/rap-cli
```## CLI Usage
```
NAME:
RAP CLI - Utils around recolude file formatUSAGE:
rap-cli [global options] command [command options] [arguments...]VERSION:
1.0.0AUTHOR:
Eli DavisCOMMANDS:
from-csv Builds a recording from CSV
json Transforms a file to json
summarize Summarizes a file
upgrade Upgrades a file from v1 to v2
help, h Shows a list of commands or help for one commandGLOBAL OPTIONS:
--help, -h show help (default: false)
--version, -v print the version (default: false)
```## Building Recordings Programmatically
With this new library you can create your own recordings programmatically. The below example creates a recording of the sin wave and then writes it to disk.
```golang
package mainimport (
"math"
"os"
"time""github.com/recolude/rap/format"
"github.com/recolude/rap/format/collection/position"
"github.com/recolude/rap/format/encoding"
positionEncoder "github.com/recolude/rap/format/encoding/position"
"github.com/recolude/rap/format/io"
"github.com/recolude/rap/format/metadata"
)func main() {
iterations := 1000
positions := make([]position.Capture, iterations)start := time.Now()
for i := 0; i < iterations; i++ {
currentTime := float64(i)
positions[i] = position.NewCapture(currentTime, 0, math.Sin(currentTime), 0)
}
duration := time.Since(start)rec := format.NewRecording(
"",
"Sin Wave Demo",
[]format.CaptureCollection{
position.NewCollection("Sin Wave", positions),
},
nil,
metadata.NewBlock(map[string]metadata.Property{
"iterations": metadata.NewIntProperty(iterations),
"benchmark": metadata.NewStringProperty(duration.String()),
}),
nil,
nil,
)f, _ := os.Create("sin demo.rap")
recordingWriter := io.NewWriter(
[]encoding.Encoder{
positionEncoder.NewEncoder(positionEncoder.Oct24),
},
true,
f,
io.BST16,
)
// Writes a recording in 1,171 bytes
recordingWriter.Write(rec)
}```
## Testing Locally
You need to generate mocks before you can run parts of the test suite.
```
go generate ./...
```There are also benchmark(s)
```
go test ./format/io -bench=. -cpuprofile cpu.prof
go tool pprof -svg cpu.prof > cpu.svg
```