added STATE_SYNTHESISING - animation loop - for each analysis - comments needs cleaning up but they all seem to work...
NOT SURE I'M USING THE STATES CORRECTLY!?
This commit is contained in:
parent
b045f44bf1
commit
12d210327b
@ -98,9 +98,9 @@ void RefractiveIndex::setup()
|
|||||||
|
|
||||||
//TODO: whichever one of these is first - it always runs twice ?
|
//TODO: whichever one of these is first - it always runs twice ?
|
||||||
|
|
||||||
_analysisVector.push_back(new ShadowScapesAnalysis(V));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||||
_analysisVector.push_back(new ShadowScapesAnalysis(H));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||||
_analysisVector.push_back(new ShadowScapesAnalysis(D));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||||
|
|
||||||
_analysisVector.push_back(new RelaxRateAnalysis());
|
_analysisVector.push_back(new RelaxRateAnalysis());
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "CamNoiseAnalysis.h"
|
#include "CamNoiseAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -28,6 +23,10 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_frame_cnt = 0;
|
_frame_cnt = 0;
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +47,8 @@ void CamNoiseAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
|
||||||
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -119,7 +119,8 @@ void CamNoiseAnalysis::draw()
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_RUN_DONE = true;
|
_state = STATE_SYNTHESISING;
|
||||||
|
// _RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -130,12 +131,90 @@ void CamNoiseAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,8 +27,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
int _run_cnt, _save_cnt;
|
|
||||||
float c, _frame_cnt, _frame_cnt_max,_save_cnt_max ;
|
|
||||||
|
|
||||||
|
|
||||||
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,35 +1,3 @@
|
|||||||
/*
|
|
||||||
- copyright (c) 2011 Copenhagen Institute of Interaction Design (CIID)
|
|
||||||
- all rights reserved.
|
|
||||||
|
|
||||||
+ redistribution and use in source and binary forms, with or without
|
|
||||||
+ modification, are permitted provided that the following conditions
|
|
||||||
+ are met:
|
|
||||||
+ > redistributions of source code must retain the above copyright
|
|
||||||
+ notice, this list of conditions and the following disclaimer.
|
|
||||||
+ > redistributions in binary form must reproduce the above copyright
|
|
||||||
+ notice, this list of conditions and the following disclaimer in
|
|
||||||
+ the documentation and/or other materials provided with the
|
|
||||||
+ distribution.
|
|
||||||
|
|
||||||
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
||||||
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
+ SUCH DAMAGE.
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ColorMultiAnalysis.h"
|
#include "ColorMultiAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -55,6 +23,10 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_fade_cnt=0;
|
_fade_cnt=0;
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorMultiAnalysis::acquire()
|
void ColorMultiAnalysis::acquire()
|
||||||
@ -74,7 +46,8 @@ void ColorMultiAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
|
||||||
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -141,8 +114,9 @@ void ColorMultiAnalysis::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
_state = STATE_SYNTHESISING;
|
||||||
|
|
||||||
_RUN_DONE = true;
|
//_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,12 +128,89 @@ void ColorMultiAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
int _run_cnt, _save_cnt, _fade_cnt;
|
|
||||||
float c, _frame_cnt, _frame_cnt_max;
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ColorSingleAnalysis.h"
|
#include "ColorSingleAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -32,6 +27,11 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
|||||||
|
|
||||||
_fade_cnt=0;
|
_fade_cnt=0;
|
||||||
fileNameTag = "";
|
fileNameTag = "";
|
||||||
|
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +52,8 @@ void ColorSingleAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
|
||||||
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -125,7 +126,8 @@ void ColorSingleAnalysis::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_RUN_DONE = true;
|
_state = STATE_SYNTHESISING;
|
||||||
|
//_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -136,12 +138,89 @@ void ColorSingleAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@ protected:
|
|||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
string fileNameTag;
|
string fileNameTag;
|
||||||
int _run_cnt, _save_cnt, _fade_cnt;
|
float r,g,b;
|
||||||
float r,g,b, _frame_cnt, _frame_cnt_max;
|
|
||||||
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "DiffNoiseAnalysis.h"
|
#include "DiffNoiseAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -28,6 +23,10 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_frame_cnt = 0;
|
_frame_cnt = 0;
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +47,8 @@ void DiffNoiseAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
|
||||||
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -133,7 +133,7 @@ void DiffNoiseAnalysis::draw()
|
|||||||
ofDisableAlphaBlending();
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -146,12 +146,89 @@ void DiffNoiseAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
int _run_cnt, _save_cnt, _fade_cnt;
|
|
||||||
float c, _frame_cnt, _frame_cnt_max;
|
|
||||||
|
|
||||||
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "IResponseAnalysis.h"
|
#include "IResponseAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -17,7 +12,7 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void IResponseAnalysis::setup(int camWidth, int camHeight)
|
void IResponseAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
DELTA_T_SAVE = 100;
|
DELTA_T_SAVE = 50; //150 is about right
|
||||||
NUM_PHASE = 1;
|
NUM_PHASE = 1;
|
||||||
NUM_RUN = 1;
|
NUM_RUN = 1;
|
||||||
NUM_SAVE_PER_RUN = 100;
|
NUM_SAVE_PER_RUN = 100;
|
||||||
@ -26,6 +21,10 @@ void IResponseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_frame_cnt = 0;
|
_frame_cnt = 0;
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 5; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ void IResponseAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -80,7 +79,9 @@ void IResponseAnalysis::draw()
|
|||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
||||||
} else {
|
} else {
|
||||||
_RUN_DONE = true;
|
_state = STATE_SYNTHESISING;
|
||||||
|
//_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -91,12 +92,89 @@ void IResponseAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,8 +27,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
int _run_cnt, _save_cnt;
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
float c, _frame_cnt, _frame_cnt_max;
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RelaxRateAnalysis.h"
|
#include "RelaxRateAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -18,7 +13,7 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
DELTA_T_SAVE = 100; //300 is the correct number
|
DELTA_T_SAVE = 50; //300 is the correct number
|
||||||
NUM_PHASE = 1;
|
NUM_PHASE = 1;
|
||||||
NUM_RUN = 1;
|
NUM_RUN = 1;
|
||||||
NUM_SAVE_PER_RUN = 100;
|
NUM_SAVE_PER_RUN = 100;
|
||||||
@ -30,6 +25,10 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_frame_cnt = 0;
|
_frame_cnt = 0;
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 5; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ void RelaxRateAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -92,9 +91,10 @@ void RelaxRateAnalysis::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cout << "RELAXRATE RUN COMPLETED" << endl;
|
|
||||||
//_state = STATE_SYNTHESISING;
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
|
||||||
|
//_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -106,12 +106,97 @@ void RelaxRateAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = MIDDLE OF ANIMATION...\n";
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt << endl;
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADE OUT OF ANIMATION...\n";
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
cout << "c_anim = " << c_anim << endl;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
|
cout << "RELAXRATE RUN COMPLETED" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,6 @@ protected:
|
|||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
float _flip, _level;
|
float _flip, _level;
|
||||||
int _run_cnt, _save_cnt;
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
float c, _frame_cnt, _frame_cnt_max;
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,35 +1,3 @@
|
|||||||
/*
|
|
||||||
- copyright (c) 2011 Copenhagen Institute of Interaction Design (CIID)
|
|
||||||
- all rights reserved.
|
|
||||||
|
|
||||||
+ redistribution and use in source and binary forms, with or without
|
|
||||||
+ modification, are permitted provided that the following conditions
|
|
||||||
+ are met:
|
|
||||||
+ > redistributions of source code must retain the above copyright
|
|
||||||
+ notice, this list of conditions and the following disclaimer.
|
|
||||||
+ > redistributions in binary form must reproduce the above copyright
|
|
||||||
+ notice, this list of conditions and the following disclaimer in
|
|
||||||
+ the documentation and/or other materials provided with the
|
|
||||||
+ distribution.
|
|
||||||
|
|
||||||
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
||||||
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
+ SUCH DAMAGE.
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ShadowScapesAnalysis.h"
|
#include "ShadowScapesAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -47,20 +15,21 @@ using Poco::Thread;
|
|||||||
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
DELTA_T_SAVE = 50;
|
||||||
DELTA_T_SAVE = 100;
|
|
||||||
NUM_PHASE = 1;
|
NUM_PHASE = 1;
|
||||||
NUM_RUN = 1;
|
NUM_RUN = 1;
|
||||||
NUM_SAVE_PER_RUN = 100;
|
NUM_SAVE_PER_RUN = 100;
|
||||||
|
|
||||||
create_dir();
|
create_dir();
|
||||||
|
|
||||||
|
|
||||||
_speed = 100.0; // 900.0 is the correct number
|
_speed = 100.0; // 900.0 is the correct number
|
||||||
_scanLineWidth = 100.0;
|
_scanLineWidth = 100.0;
|
||||||
_run_cnt = 0;
|
_run_cnt = 0;
|
||||||
_save_cnt = 0;
|
_save_cnt = 0;
|
||||||
|
|
||||||
int anim_time = 5; // 5 seconds
|
int anim_time = 5; // 10 seconds
|
||||||
_anim_cnt_max = 5*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowScapesAnalysis::acquire()
|
void ShadowScapesAnalysis::acquire()
|
||||||
@ -197,68 +166,63 @@ void ShadowScapesAnalysis::draw()
|
|||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
ofEnableAlphaBlending();
|
ofEnableAlphaBlending();
|
||||||
ofSetRectMode(OF_RECTMODE_CENTER);
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
if(_anim_cnt < _anim_cnt_max){
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
ofColor aColour;
|
ofColor aColour;
|
||||||
int rectSizeW = ofGetWidth()/4;
|
int rectSizeW = ofGetWidth()/4;
|
||||||
int rectSizeH = ofGetWidth()/4;
|
int rectSizeH = ofGetHeight()/4;
|
||||||
int _fade_in_frames = _anim_cnt_max/10;
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
int c_anim = 10;
|
int c_anim = 10;
|
||||||
int fade;
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
if (_anim_cnt < _fade_in_frames) {
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
cout << "fade up = " << fade << endl;
|
|
||||||
for (int i=0; i < ofGetHeight() ; i=i+rectSizeH)
|
for (int i=0; i <= 15; i++){
|
||||||
{
|
c_anim = 0+17*i;
|
||||||
for (int j=0; j < ofGetWidth(); j=j+rectSizeW)
|
|
||||||
{
|
|
||||||
c_anim = ofRandom(150,255);
|
|
||||||
|
|
||||||
aColour.set(c_anim, c_anim, c_anim, fade);
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
ofSetColor(aColour);
|
ofSetColor(aColour);
|
||||||
ofRect(ofGetWidth()/2, ofGetHeight()/2, rectSizeW, rectSizeH);
|
|
||||||
}
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
for (int i=0; i < ofGetHeight() ; i=i+rectSizeH)
|
for (int i=0; i <= 15; i++){
|
||||||
{
|
c_anim = 255;
|
||||||
for (int j=0; j < ofGetWidth(); j=j+rectSizeW)
|
|
||||||
{
|
|
||||||
c_anim = ofRandom(150,255);
|
|
||||||
|
|
||||||
//c = ofRandom(0,255);
|
|
||||||
aColour.set(c_anim, c_anim, c_anim, 255);
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
ofSetColor(aColour);
|
ofSetColor(aColour);
|
||||||
ofRect(ofGetWidth()/2, ofGetHeight()/2, rectSizeW, rectSizeH);
|
|
||||||
|
|
||||||
}
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _frame_cnt <= _anim_cnt_max) {
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
cout << "fade down = " << fade << endl;
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
for (int i=0; i < ofGetHeight() ; i=i+rectSizeH)
|
for (int i=0; i <= 15; i++){
|
||||||
{
|
|
||||||
for (int j=0; j < ofGetWidth(); j=j+rectSizeW)
|
c_anim = (17*i);
|
||||||
{
|
|
||||||
c_anim = ofRandom(150,255);
|
|
||||||
//c = ofRandom(0,255);
|
|
||||||
|
|
||||||
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
ofSetColor(aColour);
|
ofSetColor(aColour);
|
||||||
ofRect(ofGetWidth()/2, ofGetHeight()/2, rectSizeW, rectSizeH);
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
}
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -268,6 +232,7 @@ void ShadowScapesAnalysis::draw()
|
|||||||
_state = STATE_DISPLAY_RESULTS;
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
_anim_cnt=0;
|
_anim_cnt=0;
|
||||||
}
|
}
|
||||||
|
ofPopMatrix();
|
||||||
ofSetRectMode(OF_RECTMODE_CORNER);
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
ofDisableAlphaBlending();
|
ofDisableAlphaBlending();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ShapeFromShadingAnalysis.h"
|
#include "ShapeFromShadingAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -18,7 +13,7 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
DELTA_T_SAVE = 300; //300 is about the right number
|
DELTA_T_SAVE = 50; //300 is about the right number
|
||||||
NUM_PHASE = 1;
|
NUM_PHASE = 1;
|
||||||
NUM_RUN = 1;
|
NUM_RUN = 1;
|
||||||
NUM_SAVE_PER_RUN = 100;
|
NUM_SAVE_PER_RUN = 100;
|
||||||
@ -31,9 +26,14 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
|||||||
|
|
||||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ShapeFromShadingAnalysis::acquire()
|
void ShapeFromShadingAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -51,7 +51,8 @@ void ShapeFromShadingAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
_animation_cnt1 = 0;
|
_animation_cnt1 = 0;
|
||||||
_animation_cnt2 = 0;
|
_animation_cnt2 = 0;
|
||||||
_animation_cnt3 = 0;
|
_animation_cnt3 = 0;
|
||||||
@ -307,8 +308,8 @@ void ShapeFromShadingAnalysis::draw()
|
|||||||
|
|
||||||
ofDisableAlphaBlending();
|
ofDisableAlphaBlending();
|
||||||
} else {
|
} else {
|
||||||
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
//_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -320,12 +321,89 @@ void ShapeFromShadingAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@ protected:
|
|||||||
string quad;
|
string quad;
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
float _flip, _level;
|
float _flip, _level;
|
||||||
int _run_cnt, _save_cnt;
|
|
||||||
int _animation_cnt1;
|
int _animation_cnt1;
|
||||||
int _animation_cnt2;
|
int _animation_cnt2;
|
||||||
int _animation_cnt3;
|
int _animation_cnt3;
|
||||||
@ -48,6 +47,7 @@ protected:
|
|||||||
int _animation_cnt15;
|
int _animation_cnt15;
|
||||||
int _animation_cnt16;
|
int _animation_cnt16;
|
||||||
int _animation_reset; // this reset part didn't get working - so using 16 different counters! yay!
|
int _animation_reset; // this reset part didn't get working - so using 16 different counters! yay!
|
||||||
float c, _frame_cnt, _frame_cnt_max;
|
|
||||||
|
|
||||||
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
~ author: dviid
|
|
||||||
~ contact: dviid@labs.ciid.dk
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "StrobeAnalysis.h"
|
#include "StrobeAnalysis.h"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
@ -27,10 +22,12 @@ void StrobeAnalysis::setup(int camWidth, int camHeight)
|
|||||||
|
|
||||||
// The British Health and Safety Executive recommend that a net flash rate for a bank of strobe lights does not exceed 5 flashes per second, at which only 5% of photosensitive epileptics are at risk. It also recommends that no strobing effect continue for more than 30 seconds, due to the potential for discomfort and disorientation.
|
// The British Health and Safety Executive recommend that a net flash rate for a bank of strobe lights does not exceed 5 flashes per second, at which only 5% of photosensitive epileptics are at risk. It also recommends that no strobing effect continue for more than 30 seconds, due to the potential for discomfort and disorientation.
|
||||||
|
|
||||||
//or 20 times, every one second...
|
|
||||||
_save_cnt_max = _strobe_cnt_max*_strobe_interval/DELTA_T_SAVE;
|
|
||||||
|
|
||||||
create_dir();
|
create_dir();
|
||||||
|
|
||||||
|
|
||||||
|
int anim_time = 10; // 10 seconds
|
||||||
|
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +50,8 @@ void StrobeAnalysis::acquire()
|
|||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
_frame_cnt = 0; _save_cnt = 0;
|
|
||||||
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||||
|
|
||||||
while(!_RUN_DONE)
|
while(!_RUN_DONE)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
@ -98,13 +96,13 @@ void StrobeAnalysis::draw()
|
|||||||
//cout << "frame_cnt % 15: " << _frame_cnt%15 << endl;
|
//cout << "frame_cnt % 15: " << _frame_cnt%15 << endl;
|
||||||
//cout << "MAIN STROBE TIME " << endl;
|
//cout << "MAIN STROBE TIME " << endl;
|
||||||
|
|
||||||
if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) < (ofGetFrameRate()*_strobe_interval/1000)/2)
|
if (int(_frame_cnt)%int(ofGetFrameRate()*_strobe_interval/1000) < (ofGetFrameRate()*_strobe_interval/1000)/2)
|
||||||
{
|
{
|
||||||
ofSetColor(255, 255, 255);
|
ofSetColor(255, 255, 255);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
_strobe_cnt++;
|
_strobe_cnt++;
|
||||||
_strobe_on = 1;
|
_strobe_on = 1;
|
||||||
} else if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) >= (ofGetFrameRate()*_strobe_interval/1000)/2)
|
} else if (int(_frame_cnt)%int(ofGetFrameRate()*_strobe_interval/1000) >= (ofGetFrameRate()*_strobe_interval/1000)/2)
|
||||||
{
|
{
|
||||||
ofSetColor(0, 0, 0);
|
ofSetColor(0, 0, 0);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
@ -122,7 +120,8 @@ void StrobeAnalysis::draw()
|
|||||||
|
|
||||||
ofDisableAlphaBlending();
|
ofDisableAlphaBlending();
|
||||||
} else {
|
} else {
|
||||||
_RUN_DONE = true;
|
_state = STATE_SYNTHESISING;
|
||||||
|
//_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -133,12 +132,89 @@ void StrobeAnalysis::draw()
|
|||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
{
|
{
|
||||||
// display animation of something while the synthesis in on-going...
|
// display animation of something while the synthesis in on-going...
|
||||||
|
|
||||||
|
cout << "RelaxRateAnalysis = STATE_SYNTHESISING...\n";
|
||||||
|
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CENTER);
|
||||||
|
ofPushMatrix();
|
||||||
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
|
||||||
|
|
||||||
|
if(_anim_cnt < _anim_cnt_max){
|
||||||
|
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSizeW = ofGetWidth()/4;
|
||||||
|
int rectSizeH = ofGetHeight()/4;
|
||||||
|
int _fade_in_frames = _anim_cnt_max/2;
|
||||||
|
|
||||||
|
int c_anim = 10;
|
||||||
|
int fade;
|
||||||
|
|
||||||
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
|
cout << "ShadowScapesAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 0+17*i;
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt >= _fade_in_frames && _anim_cnt <= (_anim_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
c_anim = 255;
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_anim_cnt > (_anim_cnt_max-_fade_in_frames) && _anim_cnt <= _anim_cnt_max) {
|
||||||
|
|
||||||
|
cout << "_anim_cnt = " << _anim_cnt-(_anim_cnt_max-_fade_in_frames) << endl;
|
||||||
|
fade = ofMap(_anim_cnt-(_anim_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255);
|
||||||
|
cout << "fade down = " << fade << endl;
|
||||||
|
|
||||||
|
for (int i=0; i <= 15; i++){
|
||||||
|
|
||||||
|
c_anim = (17*i);
|
||||||
|
|
||||||
|
aColour.set(c_anim, c_anim, c_anim, 255-fade);
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, rectSizeW+10*i, rectSizeH+10*i);
|
||||||
|
ofRect(0, 0, rectSizeW-10*i, rectSizeH-10*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_anim_cnt++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
|
_anim_cnt=0;
|
||||||
|
}
|
||||||
|
ofPopMatrix();
|
||||||
|
ofSetRectMode(OF_RECTMODE_CORNER);
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool _RUN_DONE;
|
bool _RUN_DONE;
|
||||||
int _strobe_cnt, _run_cnt, _strobe_cnt_max;
|
int _strobe_cnt, _strobe_cnt_max;
|
||||||
int _save_cnt;
|
|
||||||
|
|
||||||
int _frame_cnt, _frame_cnt_max, _save_cnt_max ;
|
|
||||||
int _strobe_interval;
|
int _strobe_interval;
|
||||||
bool _strobe_on;
|
bool _strobe_on;
|
||||||
|
|
||||||
|
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||||
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user