added zmapper from inverse square law saves from main app draw()

This commit is contained in:
Tom Schofield
2012-04-12 10:21:37 +01:00
parent e29accb9ce
commit 21791b9769
7 changed files with 190 additions and 48 deletions
+28 -3
View File
@@ -19,7 +19,7 @@
#define CAMERA_ACQU_WIDTH 640
#define CAMERA_ACQU_HEIGHT 480
#define LOCATION "MIDDLESBOROUGH"
#define LOCATION "BRADFORD"
#define ISTATE_UNDEF 0xEEEE
#define ISTATE_START 0xAAAA
@@ -101,7 +101,7 @@ void RefractiveIndex::setup()
//void ofPixels::allocate(int w, int h, ofImageType type)
_pixels.allocate(_vid_w, _vid_h, OF_IMAGE_COLOR);
//TODO: whichever one of these is first - it always runs twice ?
_analysisVector.push_back(new ShadowScapesAnalysis(V));
@@ -133,6 +133,9 @@ void RefractiveIndex::setup()
_currentAnalysis = NULL;
_state = ISTATE_UNDEF;
fbo.allocate(_vid_w,_vid_h);
_meshRotation=0;
}
void RefractiveIndex::analysis_cb(string & analysis)
@@ -211,8 +214,30 @@ void RefractiveIndex::draw()
// black
ofBackground(0, 0, 0);
if(_currentAnalysis)
if(_currentAnalysis){
_currentAnalysis->draw();
cout<<_currentAnalysis->meshIsComplete<<endl;
if(_currentAnalysis->meshIsComplete){
fbo.begin();
ofSetColor(0, 0, 0);
ofRect(0, 0, fbo.getWidth(), fbo.getHeight());
ofPushMatrix();
ofTranslate(fbo.getWidth()/2, fbo.getHeight()/2);
ofRotateY(_meshRotation );
ofTranslate(-fbo.getWidth()/2, -fbo.getHeight()/2);
_meshRotation+=0.5;
_currentAnalysis->aMesh.draw();
fbo.end();
ofPixels pixels;
fbo.readToPixels(pixels);
cout<<_currentAnalysis->meshFileName<<endl;
ofSaveImage(pixels,_currentAnalysis->meshFileName, OF_IMAGE_QUALITY_BEST);
//saving jpgs doesn't work maybe because of of_image_quality
}
}
}
void RefractiveIndex::setup_camera()
+5
View File
@@ -54,6 +54,8 @@ protected:
AnalysisAdaptor* _analysisAdapator;
vector<AbstractAnalysis*> _analysisVector;
float _meshRotation;
public:
// acquisition
static ofPixels _pixels;
@@ -69,4 +71,7 @@ public:
static string _location;
static ofxXmlSettings XML; // made this static so we can access RUN_NUM in the analyses
ofFbo fbo;
};