Browse Source

eveyrthing is working, need to update dace detection for depth model

master
cailean 4 months ago
parent
commit
afd3ce3b50
  1. BIN
      bin/data/new_tree.bin
  2. 6
      bin/data/shaders/p_depth.vert
  3. BIN
      bin/image-to-mesh
  4. 2
      src/Bullet.cpp
  5. 29
      src/network/Server.cpp
  6. 11
      src/ofApp.cpp

BIN
bin/data/new_tree.bin

Binary file not shown.

6
bin/data/shaders/p_depth.vert

@ -19,14 +19,14 @@ void main()
//float depth = pow(texture(tex1, tex_c).r, 2);
vec2 depthCoord = texcoord * vec2(1920.0/2.0, 960.0);
float depth = pow(texture(tex1, depthCoord).r, 2);
float depth = texture(tex1, depthCoord).r;
// Normalize the depth value between 0 and 1 based on min/max
float normalizedDepth = (depth) / threshold.y;
float normalizedDepth = (depth);
vec4 displaced = position;
displaced.z = normalizedDepth * 800.0;
displaced.z = normalizedDepth * 400.0;
// Transform the vertex position to clip space
vec4 clipPos = modelViewProjectionMatrix * displaced;

BIN
bin/image-to-mesh

Binary file not shown.

2
src/Bullet.cpp

@ -237,7 +237,7 @@ float Bullet::easeInOutCubic(float t) {
float Bullet::calculateGridSize(float zoom){
const float ref_zoom = 0.01;
const float ref_scale = 20;
const float ref_scale = 40;
float new_grid_size = (ref_zoom * ref_scale) / zoom;
if(new_grid_size < 5){
new_grid_size = 5;

29
src/network/Server.cpp

@ -67,7 +67,6 @@ void Server::update(ofFbo& esp_comp){
/* check if inactive -> query vptree -> move camera */
checkActivity();
//sendOSCMessage();
}
void Server::disconnectAllClients(){
@ -169,31 +168,11 @@ void Server::sendOSCMessage(){
ofxOscMessage me_2;
ofxOscMessage me_3;
ofxOscMessage me_file;
ofxOscMessage bang_new_mesh;
std::string audio_file = vp_resp.folder;
// Check if file exists in a given dir
ofFile file("/home/cailean/Desktop/rave/all_wav_files/" + audio_file + ".wav");
if(!is_active && (audio_file != past_audio_file) && file.exists()){
me_file.setAddress("/emote/filename");
me_file.addStringArg(audio_file + ".wav");
messages.push_back(me_file);
past_audio_file = audio_file;
}
me_0.setAddress("/emote/0");
me_0.addFloatArg(embedding.emotions["neutral"]);
messages.push_back(me_0);
me_1.setAddress("/emote/1");
me_1.addFloatArg(embedding.emotions["neutral"]);
messages.push_back(me_1);
me_2.setAddress("/emote/2");
me_2.addFloatArg(embedding.emotions["neutral"]);
messages.push_back(me_2);
me_3.setAddress("/emote/3");
me_3.addFloatArg(embedding.emotions["neutral"]);
messages.push_back(me_3);
bang_new_mesh.setAddress("/emote/bang");
bang_new_mesh.addTriggerArg();
messages.push_back(bang_new_mesh);
for (auto& msg : messages){
osc_sender.sendMessage(msg, false);

11
src/ofApp.cpp

@ -300,7 +300,7 @@ void ofApp::drawPortrait(){
}
// Give the depth processing some time to complete (adjust timeout as needed)
const float PROCESS_TIMEOUT = 0.5; // half second timeout
const float PROCESS_TIMEOUT = 0.1; // half second timeout
if(!depth_ready && (current_time - last_process_time) > PROCESS_TIMEOUT) {
depth_onnx_portrait.SetPixels(model_portrait_out_fbo);
depth_ready = true;
@ -319,8 +319,11 @@ void ofApp::drawPortrait(){
plane.mapTexCoords(0, 0, planeWidth, planeHeight);
custom_mesh = createCustomPlane(planeWidth, planeHeight, planeColumns, planeRows);
ofLog() << "Generated new mesh at time: " << current_time;
//ofLog() << "Generated new mesh at time: " << current_time;
mesh_ready = true;
/* send osc message when new node selected*/
server->sendOSCMessage();
}
}
@ -624,8 +627,8 @@ ofMesh ofApp::createCustomPlane(float width, float height, int numX, int numY) {
float cellWidth = width/numX;
float cellHeight = height/numY;
xPos += ofRandom(-cellWidth * 0.1, cellWidth * 0.1);
yPos += ofRandom(-cellHeight * 0.1, cellHeight * 0.1);
xPos += ofRandom(-cellWidth * 0.2, cellWidth * 0.2);
yPos += ofRandom(-cellHeight * 0.2, cellHeight * 0.2);
}
mesh.addVertex(glm::vec3(xPos, yPos, 0));

Loading…
Cancel
Save