Esempio n. 1
0
//--------------------------------------------------------------
void captureApp::keyPressed(int key) {
	if(key == 'f') {
		ofToggleFullscreen();
	}
	if(key == '\t') {
	
		if( !hidden &&  ofxFileHelper::doesFileExist(capturePrefix+"capture") && ofxFileHelper::doesFileExist(capturePrefix+"capture/0.jpg") ){
			string unique = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds());
			ofxFileHelper::moveFromTo(capturePrefix+"capture", capturePrefix+"savedFolder"+unique);
			ofxFileHelper::makeDirectory(capturePrefix+"capture");
			cameraFrameNum = 0;
		}
	
		hidden = !hidden;
		panel.hidden = hidden;
		if(hidden)
			ofHideCursor();
		else
			ofShowCursor();
		if(!hidden)
			imageSaver.saveAll();
	}
	if(panel.getValueB("frameByFrame") && key == OF_KEY_UP){
		patternFrame--;
	}

	if(panel.getValueB("frameByFrame") && key == OF_KEY_DOWN){
		patternFrame++;
	}
}
void testApp::fireCamera(){
	
	ofDirectory dir;
	char pathc[1024];
	sprintf(pathc, "%02d_%02d_%02d_%02d", ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
	string path(pathc);
	dir.createDirectory(path);
	
	cameraFiredTime = ofGetElapsedTimef();
	
	cout << "Firing camera at time "<< cameraFiredTime << endl;
	
	shouldFireCamera = false;
	
	camera1.takePhoto();
	pullBackRender = true;
	pullFrontRender = true;
	
	
	ofFile f(path);
	currentSaveDirectory = f.getAbsolutePath();
	
	cout << " absolute path is " << f.getAbsolutePath() << endl;
	
	//front.getColorImage().saveImage(f.getAbsolutePath() + "/backTexture.png");
}
Esempio n. 3
0
void nebulaEye::csvRecordCb(bool & flag){
  if ( flag ){
    csvRecorder.clear();
    ofResetElapsedTimeCounter();

    stringstream ss;
    ss << ofGetYear();
    ss << setfill('0') << setw(2) << ofGetMonth();
    ss << setfill('0') << setw(2) << ofGetDay() << "-";
    ss << setfill('0') << setw(2) << ofGetHours();
    ss << setfill('0') << setw(2) << ofGetMinutes();
    ss << setfill('0') << setw(2) << ofGetSeconds() << ".csv";
    ofLog() << "try to create file : " << ss.str();
    csvRecorder.filePath = ofToDataPath(ss.str());
    ofLog() << "record CSV to : " << csvRecorder.filePath;

    int idx(0);
    csvRecorder.setString(0,idx++,"date");
    csvRecorder.setString(0,idx++,"time");
    csvRecorder.setString(0,idx++,"blob x");
    csvRecorder.setString(0,idx++,"blob y");
    csvRecorder.setString(0,idx++,"flow zone 0");
    csvRecorder.setString(0,idx++,"flow zone 1");
    csvRecorder.setString(0,idx++,"flow zone 2");
    csvRecorder.setString(0,idx++,"flow zone 3");

  } else {
    csvRecorder.saveFile();
    // Save the recorded values in the csvRecorder ofxCsv object
    // csvRecorder.saveFile( ofToDataPath( csvFileName ));
    ofLog() << "Saved " << csvRecorder.numRows << " rows to " << csvRecorder.filePath;
  }
}
Esempio n. 4
0
//--------------------------------------------------
void simpleLogger::log(int logLevel, const char* format, ...){
	//thanks stefan!
	//http://www.ozzu.com/cpp-tutorials/tutorial-writing-custom-printf-wrapper-function-t89166.html

	logRecord record;
	record.year     = ofGetYear();
	record.month    = ofGetMonth();
	record.day      = ofGetDay();
	record.hour     = ofGetHours();
	record.minute   = ofGetMinutes();
	record.seconds  = ofGetSeconds();
	record.level    = logLevel;

	char str[2048] = {0};

	va_list args;
	va_start( args, format );
	vsprintf(str, format, args );
	va_end( args );

	record.msg      = str;
	record.logStr   =  convertToString(record);

	logs.push_back(record);
	logToXml(record);
}
Esempio n. 5
0
//--------------------------------------------------------------
void testApp::keyPressed  (int key){
	if( key == 'r' ){
		bRefresh = true;
	}
	
	if( key == 'c' ){
		string unique = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds());
		ofxFileHelper::copyFromTo("sampleFileDontDelete.txt", "copiedFile"+unique+".txt");
		
		bRefresh = true;
	}
	
	if( key == 'm' ){
		
		if( ofxFileHelper::doesDirectoryExist("dummyFolder/") ){
			//be careful with slashes here - appending a slash when moving a folder will causes mad headaches
			ofxFileHelper::moveFromTo("dummyFolder", "aMovedFolder");
		}else if( ofxFileHelper::doesDirectoryExist("aMovedFolder/") ){
			//be careful with slashes here - appending a slash when moving a folder will causes mad headaches
			ofxFileHelper::moveFromTo("aMovedFolder", "dummyFolder");
		}
		
		bRefresh = true;
	}
}
void ScreenRecorder::setupNewDirectory()
{
    counter = 0;
    
    string year = ofToString(ofGetYear());
    string month = ofToString(ofGetMonth());
    if (month.size() == 1) month.insert(0, "0");
    string day = ofToString(ofGetDay());
    if (day.size() == 1) day.insert(0, "0");
    string hour = ofToString(ofGetHours());
    if (hour.size() == 1) hour.insert(0, "0");
    string minute = ofToString(ofGetMinutes());
    if (minute.size() == 1) minute.insert(0, "0");
    string second = ofToString(ofGetSeconds());
    if (second.size() == 1) second.insert(0, "0");
    
    currentPath = rootFolderName + "/recording_" + year + "-" + month + "-" + day + "_" + hour + "." + minute + "." + second;
    
    printf("rootFolderName = %s, currentPath = %s \n", rootFolderName.c_str(), currentPath.c_str());
    ofDirectory dir(currentPath);
    if(!dir.exists())
        dir.create(true);
    
    millisAtLastFrame = ofGetElapsedTimeMillis();
}
/* EmergenceLog::dateTimeString
 * Returns the current date/time in following format:
 * 2011-05-26,14-36-587,28.469
 */
string EmergenceLog::fileDateTimeString(float beatTime)
{
    string output = "";
    
    int year = ofGetYear();
    int month = ofGetMonth();
    int day = ofGetDay();
    int hours = ofGetHours();
    int minutes = ofGetMinutes();
    int seconds = ofGetSeconds();
    
    output = output + ofToString(year) + ".";
    if (month < 10) output = output + "0";
    output = output + ofToString(month) + ".";
    if (day < 10) output = output + "0";
    output = output + ofToString(day) + ", ";
    if (hours < 10) output = output + "0";
    output = output + ofToString(hours) + ".";
    if (minutes < 10) output = output + "0";
    output = output + ofToString(minutes) + ".";
    if (seconds < 10) output = output + "0";
    output = output + ofToString(seconds) + ", ";
    output = output + ofToString(beatTime, 3);
    
    return output;
}
bool ofxCameraSequenceRecorder::createNewTimeStampDirectory(){

	ofSetDataPathRoot("./data/"); // relative to data

    folder_name =
    "capture-"+ofToString(ofGetYear())
    +ofToString(ofGetMonth())
    +ofToString(ofGetDay())+"-"
    +ofToString(ofGetHours())
    +ofToString(ofGetMinutes())
    +ofToString(ofGetSeconds());

   string dir = ofToDataPath(folder_name);
   cout << "\n\nCreating new directory for capture: " << dir << endl;

   File file_handle(dir);
   bool success = false;
   try{
      success = file_handle.createDirectory();
   }catch( Poco::Exception &except ){
      ofLog(OF_LOG_ERROR, "Could not make directory");
      return false;
   }

   if(success==false)ofLog(OF_LOG_WARNING, "Could not make directory because it already exists");
   return success;

}
Esempio n. 9
0
void ParticleTrace :: saveFBO ( ofxFBOTexture& fbo )
{
    int y = ofGetYear();
    int m = ofGetMonth();
    int d = ofGetDay();
    int r = ofGetHours();
    int n = ofGetMinutes();
    int s = ofGetSeconds();
    
    char str[255];
    sprintf( str, "screengrab_lrg/image_%02d%02d%02d_%02d%02d%02d.png", y % 1000, m, d, r, n, s );
    
    int w = fbo.getWidth();
    int h = fbo.getHeight();
    
	ofxCvColorImage imgTemp;
	imgTemp.allocate( w, h );
	imgTemp.setFromPixels( (unsigned char*)fbo.getPixels(), w, h );
	imgTemp.mirror( true, false );

	ofImage imgSave;
    imgSave.allocate( w, h, OF_IMAGE_COLOR );
    imgSave.setFromPixels( imgTemp.getPixels(), w, h, OF_IMAGE_COLOR );
    imgSave.saveImage( str );
    
	imgTemp.clear();
    imgSave.clear();
}
Esempio n. 10
0
//--------------------------------------------------------------
bool testApp::License(int year, int month, int day, int hour, int minute){
    if(ofGetYear()  <= year     &&
       ofGetMonth() <= month    &&
       ofGetDay()   <= day)
        return true;
    else
        return false;
}
Esempio n. 11
0
//--------------------------------------------------------------
string ofApp::getTakeName() {
	return ofToString(ofGetYear(), 4, '0') + "-"
		+ ofToString(ofGetMonth(), 2, '0') + "-"
		+ ofToString(ofGetDay(), 2, '0') + "-"
		+ ofToString(ofGetHours(), 2, '0') + "-"
		+ ofToString(ofGetMinutes(), 2, '0') + "-"
		+ ofToString(ofGetSeconds(), 2, '0');
}
Esempio n. 12
0
void ofApp::touchDoubleTap(int x, int y, int id){
    //string fileName = "screenshot/" + ofGetTimestampString() + ".png";
    string fileName= "/sdcard/DCIM/myFolder/ob"
    				+ ofToString(ofGetYear()) + ofToString(ofGetMonth())
    				+ ofToString(ofGetDay()) + ofToString(ofGetHours())
    				+ ofToString(ofGetMinutes()) + ofToString(ofGetSeconds())
    				+ ".png";
    ofSaveScreen(fileName);
}
Esempio n. 13
0
void ofApp::draw_wave(){

    if(audioIn_data.size()!=0){

        ob::DrawerSettings & s = ob::dset;
        s.app = this;
        s.indicator = indicator;
        s.data = &audioIn_data;
        s.track_len = track_len;
        s.buffer_size = bufferSize;
        s.xrate = track_len/s.buffer_size;
        s.global_amp = canvas.height/2 * 0.8;

        int start = 0;
        const int end = s.buffer_size;
        bool loop = true;

        while( loop ){

            float n1 = ofNoise( ofGetDay(), ofGetElapsedTimef(), start );
            int type_max = 7;
            int type = round(n1 * type_max);

            float n2 = ofNoise( ofGetHours() , ofGetFrameNum()*2.0, start );
            n2 = pow(n2, 8) * ofRandom(1.0f,10.0f);

            int num_min = s.buffer_size * 0.01;
            int num_max = s.buffer_size * 0.05;
            int num = num_min + n2*num_max;

            if(type == 3) num*=0.25;

            if((start+num)>=end){
                num =  end-start-1;
                loop = false;
                if(num<=2) break;
            }

            glPointSize( 1 );

            switch (type) {
                case 0: ob::draw_line_wave(start, num); break;
                case 1: ob::draw_dot_wave(start, num); break;
                case 2: ob::draw_prep_line(start, num); break;
                case 3: ob::draw_circle(start, num); break;
                case 4: ob::draw_rect(start, num); break;
                case 5: ob::draw_log_wave(start, num); break;
                case 6: ob::draw_arc(start, num, 0.5); break;
                case 7: ob::draw_prep_line_inv(start, num, 0.33f); break;

                default: break;
            }

            start += num;
        }
    }
}
Esempio n. 14
0
void inputManager::startRecord(){
	
	folderName = "recordedImages/" + ofToString(ofGetMonth(),0) + ofToString(ofGetDay(), 0)
				+ ofToString(ofGetHours(), 0) + ofToString(ofGetMinutes(), 0)
				+ ofToString(ofGetSeconds(), 0);

	fileHelper.makeDirectory(folderName);
	bRecord = true;
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){

	// Time stamp
	file = ofToString(ofGetYear()) + ofToString(ofGetMonth()) +  ofToString(ofGetDay()) +  " " + ofToString(ofGetHours()) +  ofToString(ofGetMinutes()) + ofToString(ofGetSeconds()) + ".png";
	
	if(key == 's') {
		ofSaveScreen(file);
	}

}
void testApp::createFileName(void)
{
	ostringstream oss;
	oss << ofGetYear() << "-";
	oss << setw(2) << setfill('0') << ofGetMonth() << "-";
	oss << setw(2) << setfill('0') << ofGetDay() << "-";
	oss << setw(2) << setfill('0') << ofGetHours() << "-";
	oss << setw(2) << setfill('0') << ofGetMinutes() << "-";
	oss << setw(2) << setfill('0') << ofGetSeconds() << ".mov";
	mFileName = oss.str();	
}
Esempio n. 17
0
//--------------------------------------------------------------
void testApp::setup(){
	ofSetFrameRate(120);
	
	// testing getFileName before loading or setFileName
	cout << "bikers:" << bikers.getFileName() << ":" << endl;
	
	/** IMAGE LOADING TEST **/
	
	// testing setFileName and loadImage with empty parameter
	bikers.setFileName("images/bikers.jpg");
	bikers.loadImage();
	
	// testing normal image loading
	gears.loadImage("images/gears.gif");
	tdf.loadImage("images/tdf_1972_poster.jpg");
	tdfSmall.loadImage("images/tdf_1972_poster.jpg");
	tdfSmall.resize(tdf.width / 4, tdf.height / 4);
	tdfSmall.setImageType(OF_IMAGE_GRAYSCALE);
	transparency.loadImage("images/transparency.png");
	transparencyMirror.clone(transparency);
	transparencyMirror.mirror(false, true);
	bikeIcon.loadImage("images/bike_icon.png");
	bikeIcon.setImageType(OF_IMAGE_GRAYSCALE);
	
	// testing getFileName() after loading
	cout << "loaded:" << bikers.getFileName() << endl;
	cout << "loaded:" << gears.getFileName() << endl;
	cout << "loaded:" << tdf.getFileName() << endl;
	cout << "loaded:" << tdfSmall.getFileName() << endl;
	cout << "loaded:" << transparency.getFileName() << endl;
	cout << "loaded:" << bikeIcon.getFileName() << endl;
	cout << endl;
	
	/** IMAGE SAVING TEST **/
	
	// testing normal saveImage
	stringstream nameBuilder;
	char timeDateStr[255];
	sprintf(timeDateStr, "%d-%.2d-%.2d_%.2d%.2d%.2d", ofGetYear(), ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
	
	nameBuilder << "images/" << timeDateStr << "_bikers.jpg";
	bikers.saveImage(nameBuilder.str());
	nameBuilder.str("");
	
	// testing setFileName and saveImage with empty parameter
	nameBuilder << "images/" << timeDateStr << "_gears.png";
	gears.setFileName(nameBuilder.str());
	gears.saveImage();
	nameBuilder.str("");
	
	// testing getFileName() after saving
	cout << "saved:" << bikers.getFileName() << endl;
	cout << "saved:" << gears.getFileName() << endl;
}
Esempio n. 18
0
//-----------------------------------------------keyPressed p or x to save---------------
void ofApp::keyPressed(int key)
{
    // key 'p' or key 'x' is used to save the images and create a movie.

    //TODO: move this to be done by the mouse.  Maybe the mouse wheel or the move from the optical sensor.

    if (key == 'p' || key == 'x')
    {
        //makes a folder and video name using time date tags when saving and exporting.


        int day = ofGetDay();
        int hour = ofGetHours();
        int minute = ofGetMinutes();
        char timeStamp[24];
        sprintf(timeStamp,"%02d%02d%02d",day,hour,minute);
        char exportFile[100];
        ofImage img2Export;


        ofPixels pix2Export;
        for(int i = 0; i < videoArray.size(); i ++)
        {
            videoArray[i].readToPixels(pix2Export);
            img2Export.setFromPixels(pix2Export);





            sprintf(exportFile,"image-%03d.png",i);//saves the images.//dms
            img2Export.saveImage(exportFile);

        }

        char videoExportCmd[256];
        sprintf(videoExportCmd, "/usr/local/bin/ffmpeg -r %d -y -i ./data/image-%%03d.png -c:v mpeg4 -r %d -pix_fmt yuv420p ~/Desktop/data/v%s.mp4",frameRate,frameRate,timeStamp);



        system(videoExportCmd);//saves the images as a video. dms
        char deleteOldImages[24];
        sprintf(deleteOldImages, "rm data/*.png");//dms delete old images
        system(deleteOldImages);


                char exportAWS[100];
                char nameAWS[100];
                sprintf(nameAWS,"v%s.mp4",timeStamp);
                sprintf(exportAWS,"aws s3 cp ~/Desktop/data/%s s3://stopmotion/%s",nameAWS,nameAWS);
               system(exportAWS);

    }
}
Esempio n. 19
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
	
	if(timeline.isModal()){
		return;
	}
	
    if(key == ' '){
		timeline.togglePlay();
	}
	
	if(key == 'T'){
		camTrack.addKeyframe();
	}
	
	if(key == 'L'){
		camTrack.lockCameraToTrack = !camTrack.lockCameraToTrack;
		if(!camTrack.lockCameraToTrack){
			cam.setAnglesFromOrientation();
		}
	}
	
	if(key == 'R'){
		rendering = !rendering;
		
		if(rendering){
			currentFrameNumber = 0;
			char fileName[1024];
			sprintf(fileName, "frame_%02d_%02d_%02d/", ofGetDay(), ofGetHours(), ofGetMinutes() );
			renderFolder = string(fileName);
			ofDirectory(renderFolder).create(true);
		}

		timeline.stop();
		player.getVideoPlayer()->stop();
		timeline.setPercentComplete(timeline.getInOutRange().min);
		timeline.play();
	}
	
	if(key == 'f'){
		ofToggleFullscreen();
	}
	
	if(key == 'S'){
		loadShader();
	}
	
	if(key == '1'){
		particleRenderer.sampleTextureColors(player.getVideoPlayer()->getPixelsRef());
	}
	
	if(key == 'P'){
		generateAmbientParticles();
	}
}
Esempio n. 20
0
void ofApp::saveData()
{
    string userTime = "User" + std::to_string(userIndex) + ":time";
    string userColor = "User" + std::to_string(userIndex) + ":color";
    string userDay = "User" + std::to_string(userIndex) + ":day";
    string userHour = "User" + std::to_string(userIndex) + ":hour";
    
    
    dataLog.setValue(userTime, finalCounter);
    dataLog.setValue(userColor, Light::getInstance().getCurrentColor()); //<<<<<<<-----------------------------!!!!!INTRODUIR COLOR!!!!!
    dataLog.setValue(userDay, std::to_string(ofGetDay()));
    dataLog.setValue(userHour, std::to_string(ofGetHours()) + "." + std::to_string(ofGetMinutes()));
    
    dataLog.saveFile("Log_BlueProject_" + std::to_string(ofGetDay()) + "_"
                     + std::to_string(ofGetHours()) + "h"
                     + std::to_string(ofGetMinutes()) + ".xml");
    
    dataLog.saveFile("Log_BlueProject_" + std::to_string(ofGetDay()) + "_"
                     + std::to_string(ofGetHours()) + "h"
                     + std::to_string(ofGetMinutes()) + "_copy.xml");

}
Esempio n. 21
0
void testApp::toLog(const std::string& to_log){

	static bool initLog = false;

	if(!initLog){
		sprintf(logFilename, "log_%02d_%02d_%02d_%02d_%02d.txt", ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
		log.append("Clouds Visual Systems Test Log \n ================================================ \n ");
		initLog = true;
	}

	log.append(to_log);
	logEnd();
}
//--------------------------------------------------------------
string motionDetector::generateFileName() {

    string _root = "kinectRecord";
    string _timestamp = ofToString(ofGetDay()) +
                        ofToString(ofGetMonth()) +
                        ofToString(ofGetYear()) +
                        ofToString(ofGetHours()) +
                        ofToString(ofGetMinutes()) +
                        ofToString(ofGetSeconds());

    string _filename = (_root + _timestamp + ".oni");

    return _filename;
}
Esempio n. 23
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackground(0);
	//	grabber.draw(0, 0);
	cam.begin();
	//	ofDrawAxis(100);
//	ofDrawGrid(100,10,false,true,true,true);
	ofPushMatrix();
	ofEnableAlphaBlending();
	ofSetColor(255, 255, 255);
	

	vbo.bind();
	vbo.updateVertexData(pos, total);
	vbo.updateColorData(color, total);
	vbo.updateTexCoordData(tex_coord, total);
	if(bUseGrabber)grabber.getTextureReference().bind();
	for (int i=0; i<GRID_WIDTH; i++) {
		for (int j=0; j<GRID_HEIGHT; j++) {
			int index = (j*GRID_WIDTH+i) * LENGTH;
//			for(int k = 0; k < LENGTH ; k++)
			{
//				vbo.draw(GL_LINES, index,LENGTH);
				vbo.draw(GL_TRIANGLE_FAN, index,LENGTH);
			}
		}
	}
	if(bUseGrabber)grabber.getTextureReference().unbind();
	vbo.unbind();
	
	ofPopMatrix();
	cam.end();
	if (bSnap) {
		string hr;
		ofImage img;
		img.grabScreen(0,0,ofGetWidth(), ofGetHeight());
		if(ofGetHours() < 12)
		{
			hr = " AM";
		}
		else
		{
			hr = " PM";
		}
		img.saveImage(ofToString(ofGetYear())+"-"+ofToString(ofGetMonth())+"-"+ofToString(ofGetDay())+" at "+ofToString(ofGetHours(),2)+"."+ofToString(ofGetMinutes(),2)+"."+ofToString(ofGetSeconds(),2) +hr +".png");
		bSnap = false;
	}
	ofDrawBitmapString(ofToString(ofGetFrameRate()), 20,20);
}
Esempio n. 24
0
int ambientColor::convertTime(int h, int m, int s) {

	int hours=ofMap(h, 0, 24, 0, 100000);
	int rangeHours = 100000 / 24;//ofMap(1, 0, 24, 0, 100000);
	int minutes = ofMap(m, 0, 60, 0, rangeHours);
	int rangeSeconds = (100000 / 24) / 60;//ofMap(1, 0, 60, 0, rangeHours);
	int seconds = ofMap(s, 0, 60, 0, rangeSeconds);

	if (ofGetDay() != startDay)hours += 100000;//WARNING THIS WORK ONLY FOR ONE DAY ON

	//cout << " h:" << h << " m:" << m << " s:" << s << endl;
	//cout <<"converted time"<< hours + minutes + seconds<< endl;

	return hours + minutes + seconds;

}
Esempio n. 25
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
	if(key == ' '){
		recording = !recording;
        if(recording){
            ofImage posterFrame;
            posterFrame.setFromPixels(kinect.getPixels(), kinect.getWidth(), kinect.getHeight(), OF_IMAGE_GRAYSCALE);
            recorder.incrementFolder(posterFrame);
        }
	}
    
    if(key == 'c'){
        string filename = "__CalibFile_" + ofToString(ofGetDay()) + "_" + ofToString(ofGetHours()) + "_" + ofToString(ofGetMinutes()) + "_" + ofToString(ofGetSeconds()) +".png";
        ofImage kinectImage;
        kinectImage.setFromPixels(kinect.getPixels(), 640, 480, OF_IMAGE_GRAYSCALE);
        ofSaveImage( kinectImage, filename);
    }
}
Esempio n. 26
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){

	if(key == ' '){
		timeline.togglePlay();
	}
	
	if(key == 'g'){
		generate();
	}
	
	if(key == 't'){
		traverse();
	}
	
	if(key == 'T'){
		camTrack.addKeyframe();
	}
	
	if(key == 'L'){
		camTrack.lockCameraToTrack = !camTrack.lockCameraToTrack;
		if(!camTrack.lockCameraToTrack){
			cam.setAnglesFromOrientation();
		}
	}
	
	if(key == 'f'){
		ofToggleFullscreen();
	}
	
	if(key == 'R'){
		rendering = !rendering;
		if(rendering){
			char folder[1024];
			sprintf(folder, "frames_%02d_%02d_%02d/",ofGetDay(), ofGetHours(), ofGetMinutes());
			renderFolder = folder;
			frameNum = 0;
			ofDirectory(renderFolder).create(true);
			timeline.setCurrentFrame(timeline.getInFrame());
			timeline.play();
		}
	}
	
	if(key == 'S'){
		loadShader();
	}
}
Esempio n. 27
0
void ofxDepthImageRecorder::incrementTake(){
	char takeString[1024] ;
	sprintf(takeString, "TAKE_%02d_%02d_%02d_%02d_%02d", ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
    currentFolderPrefix = string(takeString);
    ofDirectory dir(targetDirectory + "/" + currentFolderPrefix);
    
    dir.create(true);
	ofDirectory depthDir = ofDirectory(dir.getOriginalDirectory() + "/depth/");
    depthDir.create(true);
	
    //create a color folder for good measure
	ofDirectory colorDir = ofDirectory(dir.getOriginalDirectory() + "/color/");
    colorDir.create(true);
    
    currentFrame = 0;	
    recordingStartTime = msaTimer.getAppTimeMillis();
}
Esempio n. 28
0
// make sure to call setPoints before calling this function //
bool Secretary::saveAttributes() {
	cout << "saving attributes" << endl;
	string file_name = _dir_name+"/attributes.txt";
	
	string date_string = ofToString(ofGetMonth()) + "/" + ofToString(ofGetDay()) + "/"+ofToString(ofGetYear());
	
	int total_pts = particles.size();
	
	ofstream myfile (file_name.c_str());
	if (myfile.is_open()) {
		myfile << "Date Rendered : "+date_string+".\n";
		myfile << "Total Points : "+ofToString(total_pts)+".\n";
		
		myfile.close();
	} else { cout << "Unable to open file"; return false;}
	
	return true;
}
// start new recording
void urgRecorder::newRecording(string file_title) {
    
    // create a timestamped title and a new file
    stringstream ss;
    ss << ofGetYear() << "-";
    ss <<  setw(2) << setfill('0') << ofGetMonth() << "-";
    ss <<  setw(2) << setfill('0') << ofGetDay() << " ";
    ss <<  setw(2) << setfill('0') << ofGetHours() << "-";
    ss <<  setw(2) << setfill('0') << ofGetMinutes() << "-";
    ss <<  setw(2) << setfill('0') << ofGetSeconds() << " ";
    string timestamp = ss.str();
    fileName = timestamp + file_title + ".csv";
    recFile.open(ofToDataPath(fileName), ofFile::WriteOnly);
    
    // set recordingState to true
    recordingState = true;
    
    setTimeZero = true;
}
Esempio n. 30
0
void ofxGLEditor::saveToFile() {

	string curPath = ofToDataPath("", false);
	#ifdef TARGET_OSX
	ofSetDataPathRoot("../../../data/scripts/");
    #endif
	string zero = "0";
	string y = ofToString(ofGetYear());
	string m = ofToString(ofGetMonth());
	if (m.size() == 1) m = zero+m;
	string d = ofToString(ofGetDay());
	if (d.size() == 1) d = zero+d;
	string hour = ofToString(ofGetHours());
	if (hour.size() == 1) hour = zero+hour;
	string min = ofToString(ofGetMinutes());
	if (min.size() == 1) min = zero+min;
	string sec = ofToString(ofGetSeconds());
	if (sec.size() == 1) sec = zero+sec;
	string ymdhms = "gamuzaScript_"+y+m+d+hour+min+sec;
	string en = ".lua";
	#ifndef __APPLE__
    string fin = "scripts/"+ymdhms+en;
    #else
    string fin = ymdhms+en;
    #endif


	string scriptPath = fin;
	string file = ofToDataPath(scriptPath);
	ofstream myfile;
	myfile.open(file.c_str(), _S_out);
	string script;
	for (unsigned int i = 0; i < glEditor.size(); i++) {
		script += wstring_to_string(glEditor[i]->GetAllText());
		script += "\n";
	}
	myfile << script;
	myfile.close();
	#ifdef TARGET_OSX
	ofSetDataPathRoot(curPath);
	#endif
	cout << "script saved" << endl;
}