void SceneTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItemV4 opt = option; initStyleOption(&opt, index); customDraw(painter, &opt, index); QStyledItemDelegate::paint(painter, opt, index); }
void Creature::draw(const ofCamera& cam) { ofPushMatrix(); if (cam.getPosition().z - getPosition().z > Creature::fogEnd) { ofTranslate(0, 0, Creature::fogEnd * floor((cam.getPosition().z - getPosition().z) / Creature::fogEnd)); } else if (getPosition().z > cam.getPosition().z) { ofTranslate(0, 0, -Creature::fogEnd * ceil((getPosition().z - cam.getPosition().z) / Creature::fogEnd)); } ofMultMatrix(getGlobalTransformMatrix()); customDraw(); ofPopMatrix(); }
void WarpedWorld::draw() { quad.beginDraw(); customDraw(); quad.endDraw(); if(showDebug) { quad.drawOutputConfig(); drawPoint(1, p1); drawPoint(2, p2); drawPoint(3, p3); drawPoint(4, p4); // framerate string fpsStr = "fps "+ofToString(ofGetFrameRate(), 2); ofDrawBitmapString(fpsStr, 5,10); } ofSetHexColor(0xffffff); }
void TestScene::draw() { mainCamera.update(); button.draw(); customDraw(); }
//---------------------------------------- void ofNode::draw() { transformGL(); customDraw(); restoreTransformGL(); }
// DRAW //------------------------------------------------- void Object3D::Draw () { // daca nu este vizibil, nu-l desenam if(!Visible) return; glPushMatrix(); // translatie glTranslatef( translation.x , translation.y , translation.z ); // rotatie glRotatef( rotation.x , 1.0 , 0.0 , 0.0 ); glRotatef( rotation.y , 0.0 , 1.0 , 0.0 ); glRotatef( rotation.z , 0.0 , 0.0 , 1.0 ); // scalare glScalef( scale.x , scale.y , scale.z); // setari de material : // daca nu este selectat if( !selected ) { // culoare normala glColor3f(color.x,color.y,color.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(color.x,color.y,color.z,1)).Array()); } else { // culoarea atunci cand obiectul este selectat glColor3f(SelectedColor.x, SelectedColor.y, SelectedColor.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(SelectedColor.x,SelectedColor.y,SelectedColor.z,1)).Array()); } // culoare speculara, default glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,(Vector4D(0.1,0.1,0.1,1)).Array()); // daca este wireframe if( Wireframe ) switch( Type ) { // cub wireframe case GlutCube : glutWireCube(1.0); break; // sfera wireframe case GlutSphere : glutWireSphere(1.0, levelOfDetail, levelOfDetail); break; // orice alt obiect, specificat de programator case Custom : customDraw(); } // daca nu este wireframe else switch( Type ) { // cub solid case GlutCube : glutSolidCube(1.0); break; // sfera solida case GlutSphere : glutSolidSphere(1.0, levelOfDetail, levelOfDetail); break; // orice alt obiect, specificat de programator case Custom : customDraw(); } glPopMatrix(); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(255, 255, 255); ofBackground( 0 , 0 , 0 ) ; string status = "# of agents : " + ofToString( agents.size() ) + " bSkeletonActive : " + ofToString( bSkeletonActive ) ; ofDrawBitmapStringHighlight( status , 15 , ofGetHeight() - 50 ) ; if ( bCalibrateSpace == true ) { string calibrateString = "CALIBRATING WORLD SPACE!!!" ; ofDrawBitmapStringHighlight( calibrateString , 15 , 700 ) ; ofSetColor( 255 , 255 , 255 ) ; ofPushMatrix(); if ( bDrawOpenNI == true ) openNIDevice.drawDebug() ; ofPopMatrix(); // if ( bUseRoi ) //{ // } } ofPushMatrix(); // use a blend mode so we can see 'through' the mask(s) ofEnableBlendMode(OF_BLENDMODE_ALPHA); int numUsers = openNIDevice.getNumTrackedUsers(); if ( numUsers > 0 ) bSkeletonActive = true ; else bSkeletonActive = false; ofDisableBlendMode(); ofPopMatrix(); if ( bSkeletonActive == true ) customDraw() ; ofDisableBlendMode(); ofEnableAlphaBlending() ; ofSetColor( 255 , 255 , 255 ) ; ofSetColor( 255 , 255 , 0 ) ; ofNoFill() ; ofSetLineWidth(5 ) ; ofRect( roiArea ) ; ofSetLineWidth( 1 ) ; ofFill() ; fbo.begin() ; ofSetColor( 0 , 0 , 0, fadeFboAmount ) ; ofRect( 0 , 0, ofGetWidth() , ofGetHeight() ) ; if ( bSkeletonActive == true ) { //ofTranslate( -roiArea.x , -roiArea.y ) ; ofMesh mesh ; for ( int i = 0 ; i < agents.size() ; i++ ) { mesh.addVertex( agents[i].position ) ; mesh.addColor ( agents[i].color ) ; } glPointSize( pointSize ) ; mesh.setMode( OF_PRIMITIVE_POINTS ) ; ofSetColor( 255 , 255 , 255 ) ; mesh.draw( ) ; } fbo.end() ; ofSetColor( 255 , 255 , 255 ) ; float ratio = 9.0f /16.0f ; float xRatio = (float)ofGetWidth() / (float)roiArea.width; float h = ofGetWidth() * ratio ; ofPushMatrix() ; ofTranslate( -roiArea.x , -roiArea.y ) ; fbo.draw( 0 , 0 , fbo.getWidth() * xRatio , fbo.getHeight() ) ; ofPopMatrix() ; return ; if ( bFullscreen ) { ofSetColor( 255 , 255 , 255 ) ; roiFbo.begin() ; ofPushMatrix(); // draw debug (ie., image, depth, skeleton) ofTranslate( -roiArea.x , -roiArea.y ) ; openNIDevice.drawMatchedDebug( 0 , 0 , -1 , -1 ); ofPopMatrix(); roiFbo.end() ; ofSetColor( 255 , 255 , 255 ) ; float ratio = 9.0f /16.0f ; float h = ofGetWidth() * ratio ; roiFbo.draw( 0 , 0 , ofGetWidth() , h ) ; } ofPopMatrix() ; ofEnableAlphaBlending() ; }
// Overridden Draw void CustomObject3D::Draw() { // Object is not visible if (!Visible) return; glPushMatrix(); // Translation glTranslatef( translation.x , translation.y , translation.z ); // Rotation glRotatef( rotation.x , 1.0 , 0.0 , 0.0 ); glRotatef( rotation.y , 0.0 , 1.0 , 0.0 ); glRotatef( rotation.z , 0.0 , 0.0 , 1.0 ); // Scale glScalef( scale.x , scale.y , scale.z); // Material settings : // If not selected if( !selected ) { // Normal color glColor3f(color.x,color.y,color.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(diffuse.x,diffuse.y,diffuse.z,diffuse.a)).Array()); } else { // culoarea atunci cand obiectul este selectat glColor3f(SelectedColor.x, SelectedColor.y, SelectedColor.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(SelectedColor.x,SelectedColor.y,SelectedColor.z,1)).Array()); } // culoare speculara, default glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,(Vector4D(0.1f,0.1f,0.1f,1.f)).Array()); // daca este wireframe if( Wireframe ) { glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); } // daca nu este wireframe else { glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); } if (callListId > -1) { if (createdCallList == false) { glNewList(callListId, GL_COMPILE_AND_EXECUTE); customDraw(); glEndList(); createdCallList = true; } else { glCallList(callListId); } } else customDraw(); glPopMatrix(); }
void ofxBone::draw(){ ofPushMatrix(); ofMultMatrix(getGlobalTransformMatrix()); customDraw(); ofPopMatrix(); };
// DRAW //------------------------------------------------- void Object3D::Draw () { // daca nu este vizibil, nu-l desenam if(!Visible) return; glPushMatrix(); // translatie glTranslatef( translation.x , translation.y , translation.z ); // rotatie glRotatef( rotation.x , 1.0 , 0.0 , 0.0 ); glRotatef( rotation.y , 0.0 , 1.0 , 0.0 ); glRotatef( rotation.z , 0.0 , 0.0 , 1.0 ); // scalare glScalef( scale.x , scale.y , scale.z); // setari de material : // daca nu este selectat if( !selected ) { // culoare normala glColor3f(color.x,color.y,color.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(color.x,color.y,color.z,1)).Array()); } else { // culoarea atunci cand obiectul este selectat glColor3f(SelectedColor.x, SelectedColor.y, SelectedColor.z); glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,(Vector4D(SelectedColor.x,SelectedColor.y,SelectedColor.z,1)).Array()); } // culoare speculara, default glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,(Vector4D(0.1,0.1,0.1,1)).Array()); //culoae emisiva if(emission==true) glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Vector4D(Vector4D(color.x,color.y,color.z,1)).Array()); else glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Vector4D(0, 0, 0, 0).Array()); // daca este wireframe if( Wireframe ) switch( Type ) { // cub wireframe case Cube : glutWireCube(1.0); break; // sfera wireframe case Sphere : glutWireSphere(1.0, levelOfDetail, levelOfDetail); break; // ceainic wireframe case MyTeapot: glutWireTeapot(1); break; // lampa wireframe case MyLamp: glutWireCone(1.0,2.0,(int)levelOfDetail,(int)levelOfDetail); break; // inamic wireframe case MyEnemy: glutWireDodecahedron(); break; // extra inamic wireframe case ExtraEnemy: glutWireTetrahedron(); break; // orice alt obiect, specificat de programator case Custom : customDraw(); } // daca nu este wireframe else switch( Type ) { // cub solid case Cube : glutSolidCube(1.0); break; // sfera solida case Sphere : glutSolidSphere(1.0, levelOfDetail, levelOfDetail); break; // ceainic solid case MyTeapot: glutSolidTeapot(1); break; // lampa solida case MyLamp: glutSolidCone(1.0,2.0,(int)levelOfDetail,(int)levelOfDetail); break; // inamic solid case MyEnemy: glutSolidDodecahedron(); // extra inamic solid case ExtraEnemy: glutSolidTetrahedron(); break; // orice alt obiect, specificat de programator case Custom : customDraw(); } glPopMatrix(); }