//-------------------------------------------------------------- void testApp::update() { float t = fmodf(ofGetElapsedTimef(), abc.getMaxTime()); // update alemblic reader with time in sec abc.setTime(t); }
//-------------------------------------------------------------- void testApp::draw() { shader.begin(); shader.setUniform1f("elapsedTime", ofGetElapsedTimef()); shader.setUniform2f("mouse", mouseX, mouseY); shader.setUniform2f("resolution", ofGetWindowWidth(), ofGetWindowHeight()); shader.end(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); ofEnableAlphaBlending(); cam.begin(); shader.begin(); for (int i = 0; i < abc.size(); i++) { ofMesh mesh; if (abc.get(i, mesh)) { ofSetColor(255); mesh.draw(); // mesh.drawWireframe(); } } shader.end(); cam.end(); glDisable(GL_DEPTH_TEST); }
void update() { float abc_range = (abc.getMaxTime() - abc.getMinTime()); float t = fmodf(ofGetElapsedTimef(), abc_range) + abc.getMinTime(); abc.setTime(t); abc.get("ClonerShape", mesh); updateMesh(mesh); light0.orbit(ofGetElapsedTimef() * 10, 0, 2000); light1.orbit(ofGetElapsedTimef() * -20, 60, 2000); }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); string path = "sample.abc"; // load allembic file abc.open(path); // show all drawable names abc.dumpNames(); }
void setup() { ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground(0); abc.open("sample.abc"); abc.dumpNames(); light0.setup(); light0.setDiffuseColor(ofFloatColor(0.4, 0.4, 0.8)); light1.setup(); light1.setDiffuseColor(ofFloatColor(0.4, 0.8, 0.4)); }
//-------------------------------------------------------------- void testApp::draw() { cam.begin(); glPointSize(4); // get meshes and draw { ofMesh mesh; abc.get("/Cloner/ClonerShape", mesh); ofSetColor(255, 0, 0); mesh.draw(); } { std::vector<glm::vec3> points; abc.get("/Emitter/EmitterCloud", points); ofSetColor(0, 255, 0); glBegin(GL_POINTS); for (int i = 0; i < points.size(); i++) glVertex3fv(&points[i].x); glEnd(); } { vector<ofPolyline> curves; abc.get("/Tracer/TracerSpline", curves); ofSetColor(0, 0, 255); for (int i = 0; i < curves.size(); i++) curves[i].draw(); } // or simply, abc.draw(); cam.end(); ofSetColor(255); ofDrawBitmapString(ofToString(abc.getTime()) + "/" + ofToString(abc.getMaxTime()), 10, 20); }
//-------------------------------------------------------------- void testApp::draw() { cam.begin(); glPointSize(4); { ofMesh mesh; abc.get("/polymesh")->get(mesh); ofSetColor(255, 0, 0); mesh.draw(); } { vector<ofVec3f> points; abc.get("/points")->get(points); ofSetColor(0, 255, 0); glBegin(GL_POINTS); for (int i = 0; i < points.size(); i++) glVertex3fv(points[i].getPtr()); glEnd(); } { vector<ofPolyline> curves; abc.get("/curves")->get(curves); ofSetColor(0, 0, 255); for (int i = 0; i < curves.size(); i++) curves[i].draw(); } // or simply, abc.draw(); cam.end(); ofSetColor(255); ofDrawBitmapString(ofToString(abc.getTime()) + "/" + ofToString(abc.getMaxTime()), 10, 20); }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); glEnable(GL_DEPTH_TEST); string path = "perfume_global_site_003_sequence.abc"; // load allembic file abc.open(path); // show all drawable names abc.dumpNames(); // specular color, the highlight/shininess color // pointLight.setSpecularColor( ofColor(255.f, 255.f, 255.f)); pointLight.setPosition(0, -100, 100); material.setShininess( 64 ); }
//-------------------------------------------------------------- void testApp::draw() { ofEnableLighting(); // the position of the light must be updated every frame, // call enable() so that it can update itself // pointLight.enable(); material.begin(); cam.begin(); // get meshes and draw { ofMesh mesh; abc.get("/Aa-CHAN", mesh); ofSetColor(0, 0, 255); mesh.draw(); } { ofMesh mesh; abc.get("/KASHIYUKA", mesh); ofSetColor(255, 0, 0); mesh.draw(); } { ofMesh mesh; abc.get("/NOCCHi", mesh); ofSetColor(255, 255, 255); mesh.draw(); } // or simply, abc.draw(); cam.end(); material.end(); // turn off lighting // ofDisableLighting(); ofSetColor(255); ofDrawBitmapString(ofToString(abc.getTime()) + "/" + ofToString(abc.getMaxTime()), 10, 20); }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); string path = "perfume_global_site_003_sequence.abc"; abc.open(path); shader.watch("shader.vert", "shader.frag"); }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); numTextured = 0; string path = "3DCursor_Alembic.abc"; ofDisableArbTex(); texture.loadImage("textSphere_cursor.png"); // load allembic file abc.open(path); // show all drawable names abc.dumpNames(); meshNames = abc.getNames(); }
void ofApp::setup() { drawFaceBox = false; gui.setup("panel"); // most of the time you don't need a name but don't forget to call setup gui.add(adjustments.set("adjustments", ofPoint(0, 0, 0), -ofPoint(200,200,200), ofPoint(200,200,200))); gui.add(showWireframe.set("showWireframe", false)); gui.add(showFilled.set("showFilled", false)); gui.add(scaleFac.set("scaleFac", 1, 0.1, 2.0)); gui.add(playback.set("playback", false)); gui.add(playbackAudio.set("playbackAudio", false)); gui.add(drawFaceBox.set("draw face box", false)); gui.loadFromFile("adjustments.xml"); //sndPlayer.loadSound("/Users/zachlieberman/Dropbox/+PopTech_Toyota_Footage/SH002_Craig_test/SH002_1-2.aif"); //sndPlayer.setLoop(true); //sndPlayer.setVolume(0); //sndPlayer.play(); bSaving = false; #ifdef JAMES shotManager.footageBasePath = "/Volumes/CHOPPER/_ToyotaXpopTech_/GOLD_Footage/"; #else shotManager.footageBasePath = "/Users/zachlieberman/Desktop/GOLD_Footage/"; #endif shotManager.setup(); // shotManager.loadShot("SH001", FDM); //jackie portrait // shotManager.loadShot("SH002", FDM); //craig portrait shotManager.loadShot("SH011", FDM); //matt portrait //NOT ALIGNED AFTER CUT -- NO EYES AFTER CUT // shotManager.loadShot("SH004", FDM); //craig scifi // shotManager.loadShot("SH005", FDM); //Jackie SMOG // shotManager.loadShot("SH006", FDM); //jackie "made fuel cells important to me" // shotManager.loadShot("SH007", FDM); //MATT "Innovative technology" // shotManager.loadShot("SH008", FDM); //JACKiE change the way communities // shotManager.loadShot("SH009", FDM); //JACKIE 'states, nations, the world' // shotManager.loadShot("SH010", FDM); //CRAIG mental models; //shotManager.loadShot("SH011", FDM); //CRAIG "we did it" // shotManager.loadShot("SH011", FDM); //CRAIG "we did it" FDM.loadFrame(0, frame); // load frame 0 FDM.loadFrame(0, firstFrame); cout << FDM.numFrames << endl; ofSetVerticalSync(true); light.enable(); light.setPosition(+500, +500, +500); string testSequenceFolder = dataPath + "aCam/"; CCM.loadCalibration( testSequenceFolder + "matrices/rgbCalib.yml", testSequenceFolder + "matrices/depthCalib.yml", testSequenceFolder + "matrices/rotationDepthToRGB.yml", testSequenceFolder + "matrices/translationDepthToRGB.yml"); int ppWidth = ofNextPow2(CCM.rgbCalibration.getDistortedIntrinsics().getImageSize().width); int ppHeight = ofNextPow2(CCM.rgbCalibration.getDistortedIntrinsics().getImageSize().height); targetFbo.allocate(CCM.rgbCalibration.getDistortedIntrinsics().getImageSize().width, CCM.rgbCalibration.getDistortedIntrinsics().getImageSize().height,GL_RGBA32F); CM.CCM = CCM; CM.setup(); // // save head and tranform // // //CCM.extrinsics // //// ofxAlembic::Writer writer; //// string path = "cam.abc"; //// writer.open(path, 24); //// //// writer.addXform("/box", CCM.extrinsics); //// //if (j == 0){ //// ofBoxPrimitive box; //// box.set(40); //// writer.addPolyMesh("/box/boxShape", box.getMesh()); //// //} //// //// // draw the box of orientation using new alexmbic style //// //// //// //} // // // // writer.close(); abc.open("SH04_Spline_01c.abc"); abc.dumpNames(); backgroundPlate.loadImage("../../../sharedData/Background Plates/A-Cam_BackgroundPlate_360p.png"); // ofxAlembic::Writer writer; // // // string path = ofGetTimestampString() + ".abc"; // writer.open(path, 24); // for (int j = 0; j < FDM.numFrames; j+=10){ // // FDM.loadFrame(j, frame); // load frame 0 // ofMatrix4x4 mm; // mm.glScale(scaleFac,scaleFac,scaleFac); // mm.glTranslate(ofVec3f(-adjustments->x,adjustments->y,adjustments->z)); // // ofMesh temp = frame.head; // ofxAlembic::transform(temp, mm); // writer.addPolyMesh("/head", temp); // // ofNode n; // FDM.getOrientation(frame, n); // // mm.preMult(n.getGlobalTransformMatrix()); // // writer.addXform("/box", mm); // if (j == 0){ // ofBoxPrimitive a; // a.set(100); // writer.addPolyMesh("/box/boxShape", a.getMesh()); // } // // // draw the box of orientation using new alexmbic style // // // } // // writer.close(); //// }
//-------------------------------------------------------------- void testApp::update() { float t = fmodf(ofGetElapsedTimef(), abc.getMaxTime()); abc.setTime(t); }
void testApp::exit() { abc.close(); }
void ofApp::draw(){ #ifndef NO_ALEMBIC float t = currentFrame / 24.0; if (t > abc.getMaxTime()){ t = abc.getMaxTime(); } abc.setTime(t); #endif targetFbo.begin(); ofViewport(ofRectangle(0,0,1920, 1080)); ofClear(0,0,0,0); glClear(GL_DEPTH); CM.cameraStart(); CM.drawCameraInternals(frame.img, frame.mask, backgroundPlate); ofPushMatrix(); ofScale(-scaleFac,scaleFac,scaleFac); ofTranslate(ofVec3f(-adjustments->x,adjustments->y,adjustments->z)); drawMesh(frame.head, ofColor::darkGoldenRod); drawMesh(frame.rightEye, ofColor::red); drawMesh(frame.leftEye, ofColor::blue); ofPushStyle(); //ofScale(10,10,10); ofNoFill(); ofNode n; FDM.getOrientation(frame, n); n.draw(); ofSetColor(255); ofMatrix4x4 mat = n.getGlobalTransformMatrix(); ofMultMatrix(mat); if(drawFaceBox){ ofBoxPrimitive(100, 100, 100).draw(); } ofPopStyle(); ofPopMatrix(); ofPolyline curve; #ifndef NO_ALEMBIC vector<ofPolyline> curvesMe; abc.get("SplineSpline", curvesMe); #endif ofSetColor(ofColor::white); //////////////// ofDisableDepthTest(); CM.cameraEnd(); ofEnableAlphaBlending(); targetFbo.end(); targetFbo.getTextureReference().drawSubsection(0, 0, 1920/2, 1080/2, 0, targetFbo.getHeight() - 1080, 1920, 1080); gui.draw(); //FDM.maskStandIn.draw(mouseX, mouseY); }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0); string path = "sample.abc"; { ofxAlembic::Writer writer; if (writer.open(path, 30)) // export at 30fps { for (int f = 0; f < 60; f++) { // points { vector<ofVec3f> points; for (int i = 0; i < 10; i++) { ofVec3f p; p.x = ofRandom(-300, 300); p.y = ofRandom(-300, 300); p.z = ofRandom(-300, 300); points.push_back(p); } writer.addPoints("/points", points); } // curves { vector<ofPolyline> curves; for (int i = 0; i < 10; i++) { ofPolyline poly; for (int n = 0; n < 100; n++) { ofVec3f v; v.x = ofSignedNoise(1, 0, 0, n * 0.01 + f * 10 + i) * 300; v.y = ofSignedNoise(0, 1, 0, n * 0.01 + f * 10 + i) * 300; v.z = ofSignedNoise(0, 0, 1, n * 0.01 + f * 10 + i) * 300; poly.addVertex(v); } curves.push_back(poly); } writer.addCurves("/curves", curves); } // mesh { ofMesh mesh; int num = ofRandom(1, 10) * 3; for (int i = 0; i < num; i++) { ofVec3f p; p.x = ofRandom(-300, 300); p.y = ofRandom(-300, 300); p.z = ofRandom(-300, 300); mesh.addVertex(p); } writer.addPolyMesh("/polymesh", mesh); } } } } abc.open(path); abc.dumpNames(); }
//-------------------------------------------------------------- void testApp::draw() { ofFill(); cam.begin(); /* glPointSize(4); // get meshes and draw { ofMesh mesh; abc.get("/Cloner/ClonerShape", mesh); ofSetColor(255, 0, 0); mesh.draw(); } { vector<ofVec3f> points; abc.get("/Emitter/EmitterCloud", points); ofSetColor(0, 255, 0); glBegin(GL_POINTS); for (int i = 0; i < points.size(); i++) glVertex3fv(points[i].getPtr()); glEnd(); } { vector<ofPolyline> curves; abc.get("/Tracer/TracerSpline", curves); ofSetColor(0, 0, 255); for (int i = 0; i < curves.size(); i++) curves[i].draw(); } */ // or simply, abc.draw(); //ofMesh mesh; //abc.get("/Null/Sphere/SphereShape", mesh); //cout << mesh.getNumNormals() << endl; //ofLight l; //l.setPosition(mesh.getCentroid() + ofVec3f(0,0,0)); //l.enable(); //ofSetColor(ofColor::white); //ofSetColor(255, 0, 0); /* ofEnableDepthTest(); texture.getTextureReference().bind(); // mesh.draw(); abc.draw(); texture.getTextureReference().unbind(); ofDisableDepthTest(); */ //glCullFace( GL_FRONT ); //abc.draw(); ofEnableDepthTest(); glEnable( GL_CULL_FACE ); glCullFace( GL_BACK ); //* ofSetColor( 255, 255, 255, 255.0 * 0.5 ); for( int i=0; i<meshNames.size(); i++ ){ ofxAlembic::IGeom *geo = abc.get( meshNames[i] ); if( i == numTextured ){ geo->drawTextured( &texture ); }else{ geo->draw(); } } //*/ glCullFace( GL_FRONT ); ofSetColor( 255, 255, 255, 255.0 * 0.5 ); //* for( int i=0; i<meshNames.size(); i++ ){ ofxAlembic::IGeom *geo = abc.get( meshNames[i] ); if( i == numTextured ){ geo->drawTextured( &texture ); }else{ geo->draw(); } } //*/ glDisable( GL_CULL_FACE ); cam.end(); ofSetColor(255); ofDrawBitmapString(ofToString(abc.getTime()) + "/" + ofToString(abc.getMaxTime()), 10, 20); }