Browse Source

I think i finalised it?

master
cailean 4 months ago
parent
commit
563414c773
  1. BIN
      bin/data/new_tree.bin
  2. 2
      bin/data/shaders/map_depth.frag
  3. BIN
      bin/image-to-mesh
  4. 4
      src/Bullet.cpp
  5. 44
      src/ofApp.cpp
  6. 3
      src/ofApp.h

BIN
bin/data/new_tree.bin

Binary file not shown.

2
bin/data/shaders/map_depth.frag

@ -12,5 +12,5 @@ void main()
float remappedDepth = mix(0.0, 1.0, depth); // Maps 0-1 to 0.5-1
//float adjustedDepth = pow(depth, 0.5);
outputColor = vec4(1.0 - depth, 1.0 - depth, 1.0 - depth, remappedDepth);
outputColor = vec4(1.0 - depth, 1.0 - depth, 1.0 - depth, 1.0);
}

BIN
bin/image-to-mesh

Binary file not shown.

4
src/Bullet.cpp

@ -14,8 +14,8 @@ void Bullet::setup(vector<Node>& _nodes){
camera.setScale(0.05);
camera.setNearClip(-10000);
camera.setFarClip(10000);
// camera.disableMouseInput();
// camera.removeAllInteractions();
camera.disableMouseInput();
camera.removeAllInteractions();
world.setup();
world.setCamera(&camera);

44
src/ofApp.cpp

@ -4,12 +4,12 @@
void ofApp::setup(){
/* allocated fbo's */
map_fbo.allocate(ofGetWindowWidth(), map_h, GL_RGB);
map_fbo.allocate(ofGetWindowWidth() / 3, map_h, GL_RGB);
map_fbo_alpha.allocate(map_fbo.getWidth(), map_h, GL_RGBA);
map_fbo_post.allocate(map_fbo.getWidth(), map_h, GL_RGBA);
portrait_fbo.allocate(ofGetWindowWidth(), map_h, GL_RGBA);
portrait_pre_fbo.allocate(portrait_fbo.getWidth(), map_h, GL_RGB);
portrait_pre_fbo_alpha.allocate(portrait_fbo.getWidth(), map_h, GL_RGBA);
portrait_fbo.allocate((ofGetWindowWidth() / 3) * 2, map_h, GL_RGBA); // this shoould be full with
portrait_pre_fbo.allocate((ofGetWindowWidth() / 3) * 1, map_h, GL_RGB); // this should be full, and same below
portrait_pre_fbo_alpha.allocate((ofGetWindowWidth() / 3) * 1, map_h, GL_RGBA);
comp_fbo.allocate(ofGetWindowWidth(), map_h, GL_RGBA);
model_outptut_fbo.allocate(map_fbo.getWidth(), map_h, GL_RGB);
@ -72,16 +72,17 @@ void ofApp::setup(){
depth_portrait.setup(&model_image_portrait, &model_portrait_out_fbo, &depth_onnx_portrait);
/* camera settings for portrait */
glm::quat rot(0.93, 0.33, -0.14, 0.0565);
glm::quat rot(0.9155, 0.3170, 0.02, -0.035);
portrait_camera.enableOrtho();
portrait_camera.setNearClip(-10000);
portrait_camera.setFarClip(10000);
portrait_camera.setPosition(-183.191, -341.348, 776.852);
/* settings */
// portrait_camera.enableOrtho();
// portrait_camera.setNearClip(-10000);
// portrait_camera.setFarClip(10000);
portrait_camera.setPosition(116.388, -441.054, 967.724);
portrait_camera.setOrientation(rot);
portrait_camera.setScale(0.5);
portrait_camera.removeAllInteractions();
portrait_camera.disableMouseInput();
// portrait_camera.removeAllInteractions();
// portrait_camera.disableMouseInput();
createNodes("data/json/embeddings.json");
@ -143,7 +144,7 @@ void ofApp::update(){
//mapper.update();
bullet.update(server->is_active, server->getChosenNode());
//std::cout << portrait_camera.getPosition() << " : " <<portrait_camera.getOrientationQuat()<< " : " <<portrait_camera.getScale() << std::endl;
std::cout << portrait_camera.getPosition() << " : " <<portrait_camera.getOrientationQuat()<< " : " <<portrait_camera.getScale() << std::endl;
}
//--------------------------------------------------------------
@ -192,9 +193,11 @@ void ofApp::draw(){
drawPortrait();
comp_fbo.begin();
ofClear(ofColor::white);
ofClear(ofColor::lightGrey); //uncommet when changing to map
ofBackgroundGradient(ofColor::darkGrey, ofColor::whiteSmoke, OF_GRADIENT_LINEAR);
//ofClear(0);
shaders.begin();
portrait_fbo.draw(0, 0);
portrait_fbo.draw(ofGetWindowWidth() / 3, 0);
shaders.setUniformTexture("tex0", t, 0);
shaders.setUniformTexture("tex1", bayer, 1);
shaders.setUniform2f("resolution", map_w, map_h);
@ -204,6 +207,9 @@ void ofApp::draw(){
/* actual map */
map_fbo_alpha.draw(0,0);
//model_portrait_out_fbo.draw(0,0);
//portrait_fbo.draw(0, 0);
//portrait_fbo.draw(map_w * 0.333, 0);
//portrait_fbo.draw(map_w * 0.666, 0);
shaders.end();
comp_fbo.end();
@ -235,7 +241,7 @@ void ofApp::drawPortrait(){
ofPushMatrix();
// Move to center of FBO
ofTranslate(portrait_pre_fbo.getWidth()/2, portrait_pre_fbo.getHeight() * 0.8);
ofTranslate(portrait_pre_fbo.getWidth()/2, portrait_pre_fbo.getHeight() * 0.6); // 0.8
// Apply scale
ofScale(p_scale);
// Move back by half the scaled image dimensions
@ -249,7 +255,7 @@ void ofApp::drawPortrait(){
portrait_pre_fbo_alpha.begin();
ofPushMatrix();
ofClear(0, 0, 0, 0);
ofTranslate(portrait_pre_fbo.getWidth()/2, portrait_pre_fbo.getHeight() * 0.8);
ofTranslate(portrait_pre_fbo.getWidth()/2, portrait_pre_fbo.getHeight() * 0.6);
// Apply scale
ofScale(p_scale);
// Move back by half the scaled image dimensions
@ -265,6 +271,8 @@ void ofApp::drawPortrait(){
}
void ofApp::drawPortraitZ(){
ofBackgroundGradient(ofColor::white, ofColor::orange, OF_GRADIENT_LINEAR);
ofTexture tex_color = portrait_pre_fbo_alpha.getTexture();
ofTexture tex_depth = model_portrait_out_fbo.getTexture();
@ -291,7 +299,7 @@ void ofApp::drawPortraitZ(){
portrait_camera.begin();
ofEnableDepthTest();
float time = ofGetElapsedTimef() / 10;
float p_noise_x = ofSignedNoise(time, time) * 20;
float p_noise_y = ofSignedNoise(time + 100, time + 100) * 20;
@ -319,8 +327,6 @@ void ofApp::drawPortraitZ(){
ofTranslate(p_noise_x, p_noise_y, 0);
plane.draw();
p_depth.end();
ofPopMatrix();
ofDisableDepthTest();

3
src/ofApp.h

@ -107,8 +107,9 @@ class ofApp : public ofBaseApp{
std::unique_ptr<KDTree> kd_tree;
std::vector<pointIndex> kd_result;
/* settings */
float g_size = 5;
float plane_size = 110;
float plane_size = 55;
/* pi mapper */
ofxPiMapper mapper;

Loading…
Cancel
Save