//-------------------------------------------------------------- void SceneSurfaceBezier::Draw() { if (!isPlaying) startGui.draw(); else { ofEnableDepthTest(); cam.begin(); surfaceBezier.Draw(); ofPushMatrix(); ofTranslate(surfaceBezier.controlPoints[selectedControlX][selectedControlY]); ofFill(); ofSetColor(ofColor::white); ofDrawBox(10); ofNoFill(); ofSetColor(ofColor::black); ofDrawBox(10); ofPopMatrix(); cam.end(); ofDisableDepthTest(); mainGui.draw(); } }
void ofApp::drawScene(int side){ ofEnableAlphaBlending(); ofPushMatrix(); ofRotateX(90); ofRotateZ(180); ofTranslate(0, -75, 0); if(side == 0){ //left ofDrawBox(0,0,0, 90); } else{ //right ofDrawBox(0,0,0, 90); } ofPopMatrix(); ofDisableAlphaBlending(); //glDisable(GL_CULL_FACE); }
void ofxBoundaryBehavior::draw() { ofNoFill(); ofSetColor(255, 100); ofDrawBox(0,0,0, xMax-xMin, yMax-yMin, zMax-zMin); ofSetColor(255, 0, 0, 100); ofDrawBox(0,0,0, xMax-xMin - getSpace()*2.0, yMax-yMin - getSpace()*2.0, zMax-zMin - getSpace()*2.0); }
void testApp::draw() { ofEnableAlphaBlending(); ofEnableDepthTest(); ofEnableAntiAliasing(); cam.begin(); ofPushMatrix(); double amp = rms() * 450; if (amp > 50) { float spectral_centroid = mfft.spectralCentroid(); int resolution = (int) floor(spectral_centroid / 20000.f * 64); mesh = createGeoSphere(resolution, resolution); ofVec3f center = mesh.getCentroid(); ofDrawBox(center.x, center.y, 0, 1, amp * 8, 1); ofDrawBox(center.x, center.y, 0, amp * 8, 1, 1); ofDrawBox(center.x, center.y, 0, 1, 1, amp * 8); ofNoFill(); ofCircle(center.x, center.y, amp); ofCircle(center.x, center.y, amp * 2); ofCircle(center.x, center.y, amp * 3); ofScale(amp, amp, amp); if (spectral_centroid > 0.4) { position = (int) ofRandom(mesh.getNumVertices()); } for (int i = 0; i < moct.nAverages; i++) { if (moct.averages[i] < 20) { continue; } position += (int) floor(mfft.spectralFlatness() * 20) + 1; position %= mesh.getNumVertices(); int vertex = position; float offsetDistance = moct.averages[i] * 0.02; ofVec3f p0 = mesh.getVertex(vertex); ofVec3f normal = center - p0; normal.normalize(); p0 -= (normal * (offsetDistance * 0.5)); mesh.setVertex(vertex, p0); } mesh.drawWireframe(); } ofPopMatrix(); cam.end(); ofDrawBitmapString(ofToString((int) ofGetFrameRate()) + " fps", 32, 32); }
// ofxLeapMotionSimpleHand //-------------------------------------------------------------- void ofxLeapMotionSimpleHand::debugDraw(){ ofPushStyle(); ofSetColor(190); ofSetLineWidth(2); ofEnableLighting(); ofPushMatrix(); ofTranslate(handPos); //rotate the hand by the downwards normal ofQuaternion q; q.makeRotate(ofPoint(0, -1, 0), handNormal); ofMatrix4x4 m; q.get(m); glMultMatrixf(m.getPtr()); //scale it to make it not a box ofScale(1, 0.35, 1.0); #if (OF_VERSION_MAJOR == 0) && (OF_VERSION_MINOR < 8) ofBox(0, 0, 0, 60); #else ofDrawBox(0, 0, 0, 60); #endif ofPopMatrix(); // sphere - hand openness debug draw ofSetColor(200, 0, 0, 80); ofDrawSphere(sphereCenter, sphereRadius); for(int i = 0; i < fingers.size(); i++){ //ofDrawArrow(handPos, fingers[i].pos, 10); // fingers base debug draw ofSetColor(190); ofLine(handPos, fingers[i].base); ofDrawBox(fingers[i].base, 20); ofLine(fingers[i].base, fingers[i].pos); ofSetColor(0, 200, 0); ofDrawSphere(fingers[i].pos, 20); } ofSetColor(220, 220, 0); for(int i = 0; i < fingers.size(); i++){ ofDrawArrow(fingers[i].pos + fingers[i].vel/20, fingers[i].pos + fingers[i].vel/10, 10); } ofDisableLighting(); ofPopStyle(); }
void BSpline::DrawPoints() { for (int i = 0; i < controlPoints.size(); ++i) { ofPushMatrix(); ofTranslate(controlPoints[i]); ofFill(); ofSetColor(ofColor::white); ofDrawBox(8); ofNoFill(); ofSetColor(ofColor::black); ofDrawBox(8); ofPopMatrix(); } }
void ofApp::draw() { ofEnableDepthTest(); ofEnableAlphaBlending(); cam.begin(); light.enable(); if (drawGrid) ofDrawGrid(200); if (drawLight) light.draw(); if (drawBox) { // ofNoFill(); // ofSetColor(ofColor::white); ofSetColor(255, 255, 255, 20); ofDrawBox(BOX_MAX * 2, BOX_MAX * 2, BOX_MAX * 2); // ofFill(); } ball.draw(); ball2.draw(); light.disable(); cam.end(); ofDisableAlphaBlending(); ofDisableDepthTest(); }
//-------------------------------------------------------------- void ofApp::draw(){ //ofLine(200, 30, 280, 300); ofTranslate(ofGetWidth()/2, ofGetHeight()/2); ofCircle(0,0, radius); // for(int i = 0; i< 2*PI; i++){ // posInit.x = radius * cos(0); // posInit.y = radius * sin(0); // // posFin.x = radius * cos(theta); // posFin.y = radius * sin(theta); //theta = mouseX/100.0; theta = theta + 0.1; //if(theta < PI/2 && theta > 0 ){ ofLine(0,0, radius*cos(theta), radius*sin(theta)); //}else{ // theta = 0; // } // ofLine(0,0,posFin.x, posFin.y); // } //solid drawing cam.begin(); ofNoFill(); ofDrawBox(0, 0, 0, 55, 55, 55); cam.end(); }
void ramDrawActorCube(ramNodeArray& nodeArray) { if (nodeArray.getNumNode() == 0) return; ofVec3f maxPos = nodeArray.getNode(ramActor::JOINT_CHEST).getGlobalPosition(); ofVec3f minPos = nodeArray.getNode(ramActor::JOINT_CHEST).getGlobalPosition(); for (int j = 0; j < nodeArray.getNumNode(); j++) { ofVec3f pos = nodeArray.getNode(j).getGlobalPosition(); if (maxPos.x <= pos.x) maxPos.x = pos.x; if (maxPos.y <= pos.y) maxPos.y = pos.y; if (maxPos.z <= pos.z) maxPos.z = pos.z; if (minPos.x > pos.x) minPos.x = pos.x; if (minPos.y > pos.y) minPos.y = pos.y; if (minPos.z > pos.z) minPos.z = pos.z; } ofVec3f scale, axis; scale = (maxPos - minPos); axis = (maxPos + minPos) / 2; ofPushStyle(); ofPushMatrix(); { ofTranslate(axis.x, axis.y, axis.z); ofScale(scale.x, scale.y, scale.z); ofNoFill(); ofDrawBox(1); } ofPopMatrix(); ofPopStyle(); }
void ofxStreetView::draw(){ if(meshDepth.getNumVertices()){ // ofPushMatrix(); ofRotate(getDirection(), 0, 0, 1); getTextureReference().bind(); meshDepth.drawVertices(); getTextureReference().unbind(); // ofVec3f centerMesh = meshDepth.getCentroid(); ofPushStyle(); ofSetColor(0,0,250); ofNoFill(); ofDrawBox( centerMesh.x,centerMesh.y, (centerMesh.z-45),10,10,10); ofSetColor(255,0,0); ofPushMatrix(); ofTranslate( centerMesh.x,centerMesh.y,(centerMesh.z-45) ); ofRotateY(-120); ofDrawCone(3,8); ofPopMatrix(); ofPopStyle(); //meshDepth.drawWireframe(); ofPopMatrix(); } // }
void TestScene::draw(int _surfaceId) { ofBackground(0); // A scene can draw to multiple surfaces light.enable(); //light.draw(); ofSetColor(255,255,255); ofPushMatrix(); ofRotateX(ofGetElapsedTimef()*10); ofRotateY(ofGetElapsedTimef()*10); ofRotateZ(ofGetElapsedTimef()*10); ofFill(); //ofDrawGridPlane(0.8); ofDrawBox(0,0,0,0.5,0.5,0.5); //ofDrawCone(0, 0, 0, 2, 4); //ofDrawSphere(0, 0, 0.25); //ofDrawIcoSphere(0, 0, 0, 0.5); //ofDrawPlane(0, 0, 0, 0.5, 0.5); ofPopMatrix(); light.disable(); }
//-------------------------------------------------------------- void ofApp::draw() { ofEnableDepthTest(); cam.begin(); light.enable(); if (drawGrid) ofDrawGrid(200); if (drawBox) { ofNoFill(); ofSetColor(ofColor::white); ofDrawBox( BoxSize_X , BoxSize_Y , BoxSize_Z ); } ball_1.draw(); ball_2.draw(); ball_3.draw(); ball_4.draw(); ball_5.draw(); ball_6.draw(); ball_7.draw(); ball_8.draw(); ball_9.draw(); ball_10.draw(); light.disable(); cam.end(); ofDisableDepthTest(); }
//-------------------------------------------------------------- void testApp::draw(){ ofColor cyan = ofColor::fromHex(0x00abec); ofColor magenta = ofColor::fromHex(0xec008c); ofColor yellow = ofColor::fromHex(0xffee00); ofBackgroundGradient(magenta * .6, magenta * .4); ofNoFill(); easyCam.begin(); ofRotateX(15); ofSetColor(0); ofDrawGrid(500, 10, false, false, true, false); // draw the path of the box ofSetLineWidth(2); ofSetColor(cyan); pathLines.draw(); // draw a line connecting the box to the grid ofSetColor(yellow); ofLine(current.x, current.y, current.z, current.x, 0, current.z); // translate and rotate to the current position and orientation ofTranslate(current.x, current.y, current.z); rotateToNormal(current - previous); ofSetColor(255); ofDrawBox(32); ofDrawAxis(32); easyCam.end(); }
//-------------------------------------------------------------- void ofApp::draw() { ofEnableDepthTest(); cam.begin(); light.enable(); if (drawGrid) { ofDrawGrid(200); } if (drawBox) { //ofNoFill(); ofSetColor(255,255,255,100); ofDrawBox(800, 800, 800); ofFill(); } ball.draw(); ball2.draw(); light.disable(); cam.end(); ofDisableDepthTest(); }
void myBox::draw3D(){ ofDrawBox(x,y,z, width, height, depth ); }
void myBox::draw2D(){ ofDrawBox(x,y,z, width, height, 1 ); }
//-------------------------------------------------------------- void ofApp::renderScene() { ofEnableDepthTest(); pbr.begin(&cam, &particlesShader); pbr.getShader()->setUniformTexture("posTex", *tf.getTexture(0), 11); pbr.getShader()->setUniformTexture("velTex", *tf.getTexture(1), 12); pbr.getShader()->setUniformTexture("ageTex", *tf.getTexture(2), 13); pbr.getShader()->setUniformTexture("lifetimeTex", *tf.getTexture(3), 14); pbr.getShader()->setUniform3f("maxSize", boxSize); material1.begin(&pbr); mesh.drawInstanced(OF_MESH_FILL, numParticles); material1.end(); pbr.end(); pbr.begin(&cam); jointMaterial.begin(&pbr); for (int i = 0; i < bvh.getNumJoints(); i++) { ofMatrix4x4 m = bvh.getJoint(i)->getMatrix(); ofPushMatrix(); float angle; ofVec3f axis; m.getRotate().getRotate(angle, axis); ofTranslate(bvh.getJoint(i)->getPosition() * 10); ofRotate(angle, axis.x, axis.y, axis.z); ofDrawSphere(0, 0, 0, 10); ofPopMatrix(); } jointMaterial.end(); floorMaterial.begin(&pbr); ofDrawBox(0, -25, 0, 5000, 1, 5000); floorMaterial.end(); pbr.end(); ofDisableDepthTest(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofColor cyan = ofColor::fromHex(0x00abec); ofColor magenta = ofColor::fromHex(0xec008c); ofColor yellow = ofColor::fromHex(0xffee00); ofBackgroundGradient(magenta * .6, magenta * .4); ofNoFill(); easyCam.begin(); ofRotateXDeg(15); ofSetColor(0); ofDrawGrid(500, 10, false, false, true, false); // draw the path of the box ofSetLineWidth(2); ofSetColor(cyan); pathLines.draw(); // draw a line connecting the box to the grid ofSetColor(yellow); ofDrawLine(current.x, current.y, current.z, current.x, 0, current.z); ofTranslate(current.x, current.y, current.z); if( (current - previous ).length() > 0.0 ){ // translate and rotate every 3D object after this line to the current position and orientation of our line, but only if the line is longer than 0 or has a length rotateToNormal(current - previous); } ofSetColor(255); ofDrawBox(32); ofDrawAxis(32); easyCam.end(); }
void Ball::draw() { ofFill(); ofSetColor(0, 0, 255); ofSetLineWidth (5); ofDrawSphere (pos.x, pos.y, pos.z, 20); ofSetColor(255, 0, 0, 100); ofDrawBox(boxSize/2, boxSize/2, boxSize/2, boxSize, boxSize, boxSize); ofSetColor(255, 0, 0); ofNoFill(); ofSetLineWidth (5); ofDrawBox(boxSize/2, boxSize/2, boxSize/2, boxSize, boxSize, boxSize); }
void drawBoundingBox() { ofFill(); ofSetColor(127); ofDrawAxis(100); ofNoFill(); ofDrawBox(0, 0, 0, boxSize.x, boxSize.y, boxSize.z); }
void Ball::draw() { ofNoFill(); ofSetColor(ofColor(100,100,100, 125)); ofDrawBox(pos.x, pos.y, 0, strechedRadius, strechedRadius, strechedRadius); ofSetColor(ofColor(255, 55, 55, 255)); ofDrawIcoSphere(pos.x, pos.y, radius/4); }
void drawCube::draw(float alpha) { for (int i = 0; i < 200; i += 35) { ofPushMatrix(); ofSetColor(ofColor::whiteSmoke, 180); ofNoFill(); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); ofRotateY(rotate); ofDrawBox(0, 0, -1, i + 100, i + 100, i + 100); ofSetColor(ofColor::teal, alpha); ofFill(); ofDrawBox(0, 0, -1, i + 50, i + 50, i + 50); ofPopMatrix(); } }
//-------------------------------------------------------------- void Player::customDraw() { if(showBody) { model->drawEditor(true); } ofPushStyle(); ofSetColor(0,255,0,100); ofDrawBox(0, 40, 0, 40,80,40); ofPopStyle(); }
void ofApp::drawMocap(){ ofPushMatrix(); ofScale(1000); // show path ofPolyline tp; for (auto &path: recordedPath){ ofSetColor(ofColor::azure); tp.addVertex(path.getMatrix().getTranslation()); } tp.draw(); // show rigid body ofPolyline bodies; float alpha = 255; float step = 255 / (recordedPath.size()+1); for (auto &rb: recordedPath){ ofSetColor(ofColor::navajoWhite, alpha); for (int i = 0; i < rb.markers.size(); i++) bodies.addVertex(rb.markers[i]); alpha -= step; } bodies.draw(); // draw rigidbodies const ofxNatNet::RigidBody &RB = currentRB; if (RB.isActive()) ofSetColor(0, 255, 0); else ofSetColor(255, 0, 0); // cout << "rigidBody: " << RB.id << ", pos: " << RB.matrix.getTranslation().operator*=(10) << ", orientation: "<< RB.getMatrix().getRotate() << endl; ofPushMatrix(); glMultMatrixf(RB.getMatrix().getPtr()); ofDrawAxis(.030); ofPopMatrix(); glBegin(GL_LINE_LOOP); for (int n = 0; n < RB.markers.size(); n++) { glVertex3fv(RB.markers[n].getPtr()); } glEnd(); for (int n = 0; n < RB.markers.size(); n++) { ofDrawBox(RB.markers[n], .005); } ofPopMatrix(); }
//-------------------------------------------------------------- void ofApp::draw(){ cam.begin(); ofBackground(0); float dim = 2; for(int i=0; i< memes.size(); i++){ Meme meme = memes[i]; //map関数でデータを高さに適した値に変換 float boxHeight = ofMap(meme.zone_focus, min_focus, max_focus, 0.1, 50); //map関数でデータをX座標に適した値に変換 float posX = ofMap(meme.zone_calm, min_calm, max_calm, -100, 100); //map関数でデータをZ座標に適した値に変換 float posZ = ofMap(meme.zone_posture, min_posture, max_posture, -100, 100); //map関数でデータを色さに適した値に変換 float boxColorR = ofMap(meme.zone_calm, min_calm, max_calm, 64, 255); float boxColorG = ofMap(meme.zone_posture, min_posture, max_posture, 64, 255); ofSetColor(boxColorR, boxColorG, 255, 128); //ofDrawBoxでbarchartを描く //ofDrawBox(x,y,z,w,h,d) //x,y,zはboxの中心の座標です。 ofDrawBox(posX, boxHeight/2, posZ, dim, boxHeight, dim); } //XZ平面のグリッドを描く ofSetColor(64); int minGrid = -150; int maxGrid = 150; int gridMargin = 10; for(int i=minGrid; i<=maxGrid; i+=gridMargin){ if(i==0) { ofSetLineWidth(1); } else{ ofSetLineWidth(0.25); } ofDrawLine(i,0,minGrid,i,0,maxGrid); ofDrawLine(minGrid,0,i,maxGrid,0,i); } cam.end(); }
void draw() { ofBackground(100); cam.begin(); ofSetColor(ofRandom(255), ofRandom(255),ofRandom(255)); ofDrawBox(0, 0, 0, 200, 200, 200); ofTranslate(-128, -128, -128); mesh.draw(); cam.end(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0, 0, 0); float movementSpeed = .1; float cloudSize = ofGetWidth() / 2; float maxBoxSize = 100; float spacing = 1; int boxCount = 100; cam.begin(); for(int i = 0; i < boxCount; i++) { ofPushMatrix(); float t = (ofGetElapsedTimef() + i * spacing) * movementSpeed; ofVec3f pos( ofSignedNoise(t, 0, 0), ofSignedNoise(0, t, 0), ofSignedNoise(0, 0, t)); float boxSize = maxBoxSize * ofNoise(pos.x, pos.y, pos.z); pos *= cloudSize; ofTranslate(pos); ofRotateX(pos.x); ofRotateY(pos.y); ofRotateZ(pos.z); ofLogo.bind(); ofFill(); ofSetColor(255); ofDrawBox(boxSize); ofLogo.unbind(); ofNoFill(); ofSetColor(ofColor::fromHsb(sinf(t) * 128 + 128, 255, 255)); ofDrawBox(boxSize * 1.1f); ofPopMatrix(); } cam.end(); }
//-------------------------------------------------------------- void PinballChinoManager::draw(){ camera.begin(); glEnable( GL_DEPTH_TEST ); chinoLights.setMainLightPosition(myScenario.lightPos); ofEnableLighting(); chinoLights.enable(); // debug draw if(bDrawDebug){ //myScenario.drawDebug(); world.drawDebug(); // draw the box that is used to detect if the ball is outside the scenario ofNoFill(); ofDrawBox(0, 0, 0, myScenario.ballLimitsBoxSize); ofDrawSphere(myScenario.lightPos, 2); ofFill(); } //Draw Scenario myScenario.draw(ScenarioEditor::getInstance()->bEscenarioEditorMode); //Draw Sceario shadow Map //simple_shadow.begin(); //myScenario.draw(ScenarioEditor::getInstance()->bEscenarioEditorMode); //simple_shadow.end(); chinoLights.disable(); ofDisableLighting(); glDisable(GL_DEPTH_TEST); camera.end(); statusDisplay.draw(); missionDisplay.draw(); ScenarioEditor::getInstance()->draw(); if(bDrawDebug){ (currentMissions)[idcurrentMission]->debugDraw(); } chinoLights.draw(); }
void FlowScene::draw(){ ofClear(0,0); //ofBackground(0); ofSetColor(255); ofPushStyle(); ofDrawBox(1000, 300, 0, 100); //img.draw(0,0, drawWidth, drawHeight); opticalFlow.getOpticalFlow().draw(0,0,drawWidth,drawHeight); ofPopStyle(); syphon->publishScreen(); }
void ofApp::draw(){ ofClear(0); ofCamera cam; cam.setPosition(ofPoint(300)); cam.lookAt(ofPoint(0)); cam.begin(); ofDrawBox(ofPoint(0), 200); cam.end(); }