← Back

ofxGodot

github.com/danoli3/ofxGodot · @danoli3
OF 0.12 Bridges Web/Networking 3D / Point Cloud

openFrameworks addon linking oF apps to the Godot editor: live parameter control plus a JSON scene loader

0 0 Last commit 10d ago Created 14d ago

README

ofxGodot

openFrameworks addon linking oF apps to the Godot editor: live parameter control plus a JSON scene loader. Pairs with ofxGodotBridge (Godot editor plugin + GDExtension).

Install



Clone into your openFrameworks addons folder as ofxGodot:

cd OF_ROOT/addons git clone https://github.com/danoli3/ofxGodot.git

Add to your app's addons.make:

ofxPoco ofxGodot

Layout



ofParameterGroup both ways (see protocol below). box/sphere/plane/cylinder/cone meshes, diffuse/emissive materials, point/spot/directional lights, camera fov).

Usage



#include "ofxGodot.h"

ofParameterGroup params;
ofParameter<float> speed;
ofxGodotLink link;
ofxGodotScene scene;

void ofApp::setup() {
    params.setName("demo");
    params.add(speed.set("speed", 1.5f, 0.0f, 10.0f));
    link.setSceneCallback([this](const ofJson & s) { return scene.load(s); });
    link.setup(params, 17432);
}
void ofApp::update() {
    link.update(); // pump inbound commands, flush outbound; call every frame
}
void ofApp::draw() {
    scene.draw();
}
void ofApp::exit() {
    link.exit();
}


Threading: the server reads on its own threads, but every socket write and every parameter touch happens in update(), same shape as ofxOscParameterSync.

Link protocol (v1)



Godot → oF:

oF → Godot:

Param paths are slash-joined names; names containing / are ambiguous (v1 limitation). Supported kinds: bool, int, float, double, string, vec2, vec3, vec4, color. The first update() after setup pushes full state; remote-applied values update the baseline so they never echo.

Scene schema: nodes[] with position/rotation (XYZ euler degrees) / scale, mesh{box,sphere,plane,cylinder,cone}, material{diffuse, emissive}, light{point,spot,directional}, camera{fov}. See ofxGodotScene.h for the exact shape.

Test



cd example && make python3 ../demo-link-test.py

Expect LIVE_RESULT=PASS. (Rerun in a real terminal if you get SKIP — sandboxed shells block bind().) Headless oF apps still run draw() against a noop renderer: anything issuing raw GL (e.g. ofDrawBitmapStringHighlight) segfaults there, so the example guards it — see example/src/ofApp.cpp.

License



MIT, see LICENSE.

Get this addon

HTTPS
SSH