Skip to content

Java library for parsing and receiving Free-D camera data

License

Notifications You must be signed in to change notification settings

spannercodes/FreeD4j

Repository files navigation

FreeD4j

FreeD4j is a Java library for parsing and receiving Free-D camera tracking data. It is currently work in progress.

What is Free-D?

Free-D is an old, but widely-used protocol for exchanging live camera tracking data. You can find more information here, but please let me know if you find any more resources! They seem to be few and far between.

Usage

Requirements

  • Java 17

Setup

  1. Add the following Maven repository to your project: https://mvn.spnr.dev/releases
  2. Add the dependency: implementation("dev.spnr:freed4j:VERSION") (where "VERSION" is the latest version, you'll find that in build.gradle.kts here)

Developing

For now, it is up to you to create a UDP server. This is planned to change very soon.
When you have a payload to parse, simply use the FreeD4j#readMessage method like so:

byte[] payload;
// ...

Message message = FreeD4j.readMessage(payload); // Parse the data
switch (message) { // If you're using Java 21, you can use the new pattern switching!
  case PositionMessage positionMessage -> {
    int camera = positionMessage.camera();
    int x = positionMessage.metricPosition().x();
    int y = positionMessage.metricPosition().y();
    int z = positionMessage.metricPosition().z();
  }
}

// ...

Quirks

  • By default, PositionMessage keeps the raw values sent. Use .metricPosition() to convert the values into metric.

Related Projects

About

Java library for parsing and receiving Free-D camera data

Topics

Resources

License

Stars

Watchers

Forks

Languages