Library to to work UDP packet (FreeD protocol) from local network and convert it to camera parameters: position, rotation and lens value.
- Windows (MSVC)
- macOS
- WorLibrary v0.7
- Network
- Log
- Math
Example file contains simple code to use worTCS.
#include "Wor/Network/Utils/IoService.hpp"
#include "speaker/TrackingCameraSpeaker.hpp"
int main() {
constexpr std::string_view targetAddress = "127.0.0.1";
constexpr std::uint16_t targetPort = 6001;
WorTCS::TrackingCameraSpeaker reader;
if (!reader.startSpeaker(targetAddress, targetPort)) {
/// Error
...
}
Network::Utils::IoService::run();
Wor::Math::Vector::Vector3<float> position = reader.position();
Wor::Math::Vector::Vector3<float> rotation = reader.rotation();
int zoom = reader.zoom();
int focus = reader.focus();
return 0;
}#include "Wor/Network/Utils/IoService.hpp"
#include "speaker/TrackingCameraSpeaker.hpp"
int main() {
constexpr std::string_view targetAddress{"127.0.0.1"};
constexpr std::uint16_t targetPort{6001};
WorTCS::TrackingCameraSpeaker reader;
if (!reader.startSpeaker(targetAddress, targetPort)) {
/// Error
...
}
Network::Utils::IoService::run();
std::array<std::byte, WorTCS::FreeDPacket::length> buffer{reader.rawBuffer()};
return 0;
}#include "Wor/Network/Utils/IoService.hpp"
#include "speaker/TrackingCameraSpeaker.hpp"
int main() {
constexpr std::string_view targetAddress{"127.0.0.1"};
constexpr std::uint16_t targetPort{6001};
WorTCS::TrackingCameraSpeaker reader;
if (!reader.startSpeaker(targetAddress, targetPort)) {
/// Error
...
}
Network::Utils::IoService::run();
std::string str{reader.str(WorTCS::FreeDPacket::StrView::Rot
| WorTCS::FreeDPacket::StrView::Pos
| WorTCS::FreeDPacket::StrView::Lens);
/// str ->
/// Position:
/// x: ...
/// y: ...
/// z: ...
/// Rotation:
/// rx: ...
/// ry: ...
/// rz: ...
/// Lens:
/// focus: ...
/// zoom: ...
return 0;
}