Ejemplo n.º 1
0
void Director::draw(){
    
    ofPushStyle();
    ofPushMatrix();
    ofTranslate(x, y);
    ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL);
    
    ofFill();
    ofSetColor(brigtness*255,OFX_UI_COLOR_BACK_ALPHA*4.0);
    ofRect(0,0,width,height);
    
    ofSetColor(OFX_UI_COLOR_FILL ,OFX_UI_COLOR_FILL_ALPHA);
    if(font == NULL){
        ofDrawBitmapString(name,15,15);
    } else {
        font->drawString(name,15,20);
    }
    
    ofNoFill();
    ofSetColor(brigtness*255,OFX_UI_COLOR_BACK_ALPHA);
    drawBrakets(ofRectangle(-7,-7,14,14), 5, 2 );
    drawBrakets(ofRectangle(width-7,height-7,14,14), 5, 2 );
    ofPopMatrix();
    
    ofSetColor(OFX_UI_COLOR_FILL,OFX_UI_COLOR_FILL_ALPHA);
    ofBeginShape();
    for(int i = 0; i< points.size();i++){
        ofPoint pos = toScreen(points[i]);
        ofVertex(pos);
    }
    ofEndShape(false);
    
    ofSetColor(OFX_UI_COLOR_FILL_HIGHLIGHT,OFX_UI_COLOR_FILL_HIGHLIGHT_ALPHA);
    for(int i = 1; i< points.size()-1;i++){
        ofCircle(toScreen(points[i]),5);
    }
    
    ofPopStyle();
}
void InBoxes::selfDraw(){
    
    if (!bDebug){
        glDisable(GL_DEPTH_TEST);
        ofEnableAlphaBlending();
        
        ofPushMatrix();
        ofPushStyle();
        materials["MATERIAL 1"]->begin();
        
        drawBrakets(ofRectangle(-totalWith*0.5,-totalHeight*0.5,totalWith,totalHeight), 15,10);
        
        //  Draw black book boxes
        //
        for (int i = 0; i < 4; i++) {
            archiveBooks[i].draw(bDebug);
        }
        
        for(int i = 0; i < categories.size(); i++){
            drawBrakets(categories[i], 15, 10);
            categories[i].draw(bDebug);
        }
        
        //  Draw the Books
        //
        glBegin(GL_POINTS);
        ofPushStyle();
        glPointSize(50);
        for (int i = 0; i < publicBooks.size(); i++) {
            glVertex3f(publicBooks[i].x,publicBooks[i].y,publicBooks[i].z);
        }
        ofPopStyle();
        glEnd();
        
        materials["MATERIAL 1"]->end();
        ofPopStyle();
        ofPopMatrix();
    }
}
void Dimentions::selfDraw(){
    
    if (!bDebug){
        ofEnableAlphaBlending();
        
        ofPushMatrix();
        ofPushStyle();
        materials["MATERIAL 1"]->begin();
        
        //  Labels
        //
        if(categoriesTintColor.a > 0.0 ){
            for(int i = 0; i < categories.size(); i++){
                ofSetColor(categoriesTintColor);
                drawBrakets(categories[i], 15, 10);
                
                categories[i].draw(bDebug);
            }
        }
        
        for (int i = 0; i < booksWithTags.size(); i++) {
            drawLabel( *booksWithTags[i], booksWithTags[i]->text );
        }
        
        if(categoriesNodesTintColor.a > 0.0){
            for(int i = 0; i < categories.size(); i++){
                for(int j = 0; j < categories[i].nodes.size(); j++){
                    ofPushMatrix();
                    ofTranslate(categories[i].nodes[j]->x,
                                categories[i].nodes[j]->y,
                                categories[i].nodes[j]->z);
                    ofSetColor(categoriesNodesTintColor);
                    float scale = 0.4;
                    ofScale(scale,scale,scale);
                    //orientBillBoard();
                    ofRectangle box = font.getStringBoundingBox(categories[i].nodesText[j], 0, 0);
                    font.drawStringAsShapes(categories[i].nodesText[j], -box.width*0.5,0);
                    ofPopMatrix();
                }
            }
        }
    
        
        {
            ofSetColor(255);
            ofDisableArbTex();
            glDepthMask(GL_FALSE);
            glEnable(GL_NORMALIZE);
            ofEnablePointSprites();
            
            spriteShader.begin();
            spriteTexture.bind();
            
            spriteShader.setUniformTexture("tex", spriteTexture, 0);
            spriteShader.setUniform1f("nearClip", getCameraRef().getNearClip());
            spriteShader.setUniform1f("farClip", getCameraRef().getFarClip());
            spriteShader.setUniform1f("size",spriteSize);
            spriteShader.setUniform1f("minPointSize", 1.0);//spriteSizeMin);
            spriteShader.setUniform1f("maxPointSize", spriteSizeMax);
            spriteShader.setUniform1f("focusDistance", spriteFocusDistance);
            spriteShader.setUniform1f("focusAperture", spriteFocusAperture*0.01);
            
            spriteVBO.draw(GL_POINTS, 0, TOTAL_OF_BOOKS );
            
            spriteTexture.unbind();
            spriteShader.end();
            
            ofDisablePointSprites();
            glDisable(GL_NORMALIZE);
            glDepthMask(GL_TRUE);
            ofEnableArbTex();
        }

        materials["MATERIAL 1"]->end();
        ofPopStyle();
        ofPopMatrix();
    }
}