Skip to content

Commit

Permalink
Kyle wedding
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfdanJ committed Jun 4, 2016
1 parent 247b451 commit b526c04
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 30 deletions.
2 changes: 1 addition & 1 deletion 1-ProCamScan/src/ofApp.cpp
Expand Up @@ -83,7 +83,7 @@ void ofApp::setup() {
ofSetLogLevel(OF_LOG_VERBOSE);

//calibration.loadLcp("_lensprofiles/5dmkii-28-105mm-jpg.lcp", 28);
calibration.loadLcp("_lensprofiles/efs18-135.lcp", 18);
calibration.loadLcp("_lensprofiles/16-35mm.lcp", 18);


// projector mask
Expand Down
23 changes: 14 additions & 9 deletions 2-camamok/src/ofApp.cpp
Expand Up @@ -57,7 +57,9 @@ void ofApp::setup() {
range = MAX(MAX(diagonal.x, diagonal.y), diagonal.z);
cout << "Using min " << min << " max " << max << " and range " << range << endl;

referenceImage.load("referenceImage.jpg");
bool referenceImageLoaded = referenceImage.load("referenceImage.jpg");
if(!referenceImageLoaded) throw "referenceImage.jpg is needed";

referenceImage.resize(referenceImage.getWidth() / 4, referenceImage.getHeight() / 4);
ofSetWindowShape(referenceImage.getWidth(), referenceImage.getHeight());

Expand All @@ -68,6 +70,9 @@ void ofApp::setup() {
settings.internalformat = GL_RGBA32F_ARB;
fboPositions.allocate(settings);
fboNormals.allocate(settings);

cam.setFarClip(100000000000000);

}

void ofApp::update() {
Expand Down Expand Up @@ -125,7 +130,7 @@ void ofApp::draw() {
center /= 2;
center.x -= message.size() * 8 / 2;
center.y -= 8;
drawHighlightString(message, center);
ofDrawBitmapStringHighlight(message, center);
ofPopStyle();
}
}
Expand Down Expand Up @@ -223,11 +228,11 @@ void ofApp::render() {
ofColor transparentBlack(0, 0, 0, 0);
switch(geti("drawMode")) {
case 0: // faces
if(useShader) shader.begin();
if(useShader) xyzShader.begin();
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
objectMesh.drawFaces();
if(useShader) shader.end();
if(useShader) xyzShader.end();
break;
case 1: // fullWireframe
if(useShader) shader.begin();
Expand Down Expand Up @@ -332,7 +337,7 @@ void ofApp::setupControlPanel() {

panel.addPanel("Interaction");
panel.addToggle("setupMode", true);
panel.addSlider("scale", 1, .1, 25);
panel.addSlider("scale", 1, .01, 2);
panel.addSlider("backgroundColor", 0, 0, 255, true);
panel.addMultiToggle("drawMode", 3, variadic("faces")("fullWireframe")("outlineWireframe")("occludedWireframe"));
panel.addMultiToggle("shading", 0, variadic("none")("lights")("shader"));
Expand Down Expand Up @@ -439,7 +444,7 @@ void ofApp::drawLabeledPoint(int label, ofVec2f position, ofColor color, ofColor
ofLine(position - ofVec2f(w,0), position + ofVec2f(w,0));
ofLine(position - ofVec2f(0,h), position + ofVec2f(0,h));
ofCircle(position, geti("selectedPointSize"));
drawHighlightString(ofToString(label), position + tooltipOffset, bg, fg);
ofDrawBitmapStringHighlight(ofToString(label), position + tooltipOffset, bg, fg);
glPopAttrib();
ofPopStyle();
}
Expand Down Expand Up @@ -514,7 +519,7 @@ void ofApp::drawOverlay() {
glMatrixMode(GL_MODELVIEW);

if(calibrationReady) {
intrinsics.loadProjectionMatrix(10, 2000);
intrinsics.loadProjectionMatrix(10, 20000000);
applyMatrix(modelMatrix);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
Expand Down Expand Up @@ -542,7 +547,7 @@ void ofApp::drawOverlay() {
glMatrixMode(GL_MODELVIEW);

if(calibrationReady) {
intrinsics.loadProjectionMatrix(10, 2000);
intrinsics.loadProjectionMatrix(10, 20000000);
applyMatrix(modelMatrix);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
Expand Down Expand Up @@ -574,7 +579,7 @@ void ofApp::drawRenderMode() {
glMatrixMode(GL_MODELVIEW);

if(calibrationReady) {
intrinsics.loadProjectionMatrix(10, 2000);
intrinsics.loadProjectionMatrix(10, 20000000);
applyMatrix(modelMatrix);
render();
if(getb("setupMode")) {
Expand Down
Expand Up @@ -25,7 +25,7 @@ uniform float stageAmp;

uniform vec2 mouse;

const vec3 center = vec3(0.1, 0.25, 0.5);
const vec3 center = vec3(0.0, .5, 0.5);

vec2 rotate(vec2 position, float amount) {
mat2 rotation = mat2(vec2( cos(amount), sin(amount)),
Expand All @@ -50,18 +50,18 @@ void main() {
if(useConfidence == 0) {
confidence = 1.;
}

if(confidence < .1) {
gl_FragColor = vec4(vec3(0), 1);
return;
}

float b = 0.;

// handle time
float time = elapsedTime;
time = elapsedTime + sin(elapsedTime); // step time

// handle space
if(stage == 0) {
//Lighthouse beam
Expand Down Expand Up @@ -112,17 +112,16 @@ void main() {
else if(stage == 3){
// Linescan
float scan = mouse.x;

float dist = abs(scan - position[substage]);

if(dist < 0.1){
b = 1.0;
}
}


// b *= smoothStep(stageAmp); // should be more like fast in/out near 0
// b *= confidence; // for previs
gl_FragColor = vec4(vec3(b), 1.);
}

File renamed without changes.
2 changes: 1 addition & 1 deletion 4-LightLeaks/src/main.cpp
Expand Up @@ -54,7 +54,7 @@ int main() {
settings.shareContextWith = ofGetMainLoop()->getCurrentWindow();

shared_ptr<ofAppBaseWindow> win2 = ofCreateWindow(settings);
win2->setWindowTitle("Projector 2+3");
win2->setWindowTitle("Projector 2");
win2->setVerticalSync(false);
windows.push_back(win2);

Expand Down
24 changes: 16 additions & 8 deletions 4-LightLeaks/src/ofApp.cpp
Expand Up @@ -42,6 +42,8 @@ string getStageName(int stage) {

void ofApp::setup() {
if(!setupCalled){
oscSender.setup("localhost", 7777);

setupCalled = true;
ofSetLogLevel(OF_LOG_VERBOSE);
ofSetVerticalSync(false);
Expand All @@ -63,7 +65,7 @@ void ofApp::setup() {
previousTime = 0;

//Shader
shader.setup("shader");
shader.load("shader");

xyzMap.load("../../../SharedData/xyzMap.exr");
normalMap.load("../../../SharedData/normalMap.exr");
Expand All @@ -85,7 +87,6 @@ void ofApp::setup() {
setupTracker();
#endif

oscSender.setup("localhost", 7777);
}

int numWindows = windows.size();
Expand All @@ -99,15 +100,15 @@ void ofApp::setup() {
if(curWindow == 0){

// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ofSetWindowPosition(1600, 0);
ofSetWindowPosition(0, 0);
ofSetWindowShape(1920, 1200);


// });
}
if(curWindow == 1){
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ofSetWindowPosition(1600+1920, 0);
ofSetWindowPosition(1920, 0);
ofSetWindowShape(1920*2, 1200);

// });
Expand Down Expand Up @@ -146,6 +147,10 @@ void ofApp::setupSpeakers() {

void ofApp::update() {

if(ofGetFrameNum() % 60 == 0){
shader.load("shader");
}

int numWindows = windows.size();
int curWindow = -1;
for(int i=0;i<numWindows;i++){
Expand All @@ -157,16 +162,16 @@ void ofApp::update() {
if(curWindow == 0){

// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ofSetWindowPosition(1600, 0);
ofSetWindowPosition(0, 0);
ofSetWindowShape(1920, 1200);


// });
}
if(curWindow == 1){
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ofSetWindowPosition(1600+1920, 0);
ofSetWindowShape(1920*2, 1200);
ofSetWindowPosition(0+1920, 0);
ofSetWindowShape(1920, 1200);

// });
}
Expand Down Expand Up @@ -349,7 +354,7 @@ void ofApp::draw() {
//xyzMap.drawSubsection(0, 0, ofGetWidth(), ofGetHeight(),curWindow * xyzMap.getWidth()/numWindows,0,xyzMap.getWidth()/numWindows, xyzMap.getHeight());

// Special: Draw 1 projector in window 1, 2 projectors in window 2
xyzMap.drawSubsection(0, 0, ofGetWidth(), ofGetHeight(),curWindow * xyzMap.getWidth()/3,0,ofGetWidth(), xyzMap.getHeight());
xyzMap.drawSubsection(0, 0, ofGetWidth(), ofGetHeight(),curWindow * xyzMap.getWidth()/2,0,ofGetWidth(), xyzMap.getHeight());
} shader.end();


Expand Down Expand Up @@ -466,6 +471,9 @@ void ofApp::keyPressed(int key) {
if(key == 'd'){
debugMode = !debugMode;
}
if(key == 's'){
shader.load("shader");
}
if(debugMode){
#ifdef USE_CAMERA
if(key == '1'){
Expand Down
2 changes: 1 addition & 1 deletion 4-LightLeaks/src/ofApp.h
Expand Up @@ -41,7 +41,7 @@ class ofApp : public ofBaseApp {
ofFloatImage xyzMap;
ofFloatImage normalMap;
ofFloatImage confidenceMap;
ofAutoShader shader;
ofShader shader;

//Settings
ofxXmlSettings settings;
Expand Down
2 changes: 1 addition & 1 deletion SharedData/settings.xml
Expand Up @@ -8,7 +8,7 @@
<singlepass>1</singlepass>
</sample>
<buildXyz>
<confidenceThreshold>0.05</confidenceThreshold>
<confidenceThreshold>0.01</confidenceThreshold>
<viewBetternes>1.0</viewBetternes>
<scaleFactor>4</scaleFactor>
</buildXyz>
Expand Down

0 comments on commit b526c04

Please sign in to comment.