示例#1
0
vec3f RDirNode::averageFileColour() {

    vec3f av;
    int count = 0;

    for(std::list<RFile*>::iterator it = files.begin(); it != files.end(); it++) {
        RFile* file = (*it);

        if(file->isHidden()) continue;

        av += file->getColour();

        count++;
    }

    if(count>0) av *= (1.0f/(float)count);

    count = 0;

    for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end();it++) {
            RDirNode* child =  (*it);

            av += child->averageFileColour();
            count++;
    }

    if(count>0) av *= (1.0f/(float)count);

    return av;
}
示例#2
0
void RDirNode::updateFilesVBO(quadbuf& buffer, float dt) const{

    if(in_frustum) {

        for(std::list<RFile*>::const_iterator it = files.begin(); it!=files.end(); it++) {
            RFile* f = *it;

            if(f->isHidden()) continue;

            vec3 col   = f->getColour();
            float alpha = f->getAlpha();

            buffer.add(f->graphic->textureid, f->getAbsolutePos() - f->dims*0.5f, f->dims, vec4(col.x, col.y, col.z, alpha));
        }
    }

    for(std::list<RDirNode*>::const_iterator it = children.begin(); it != children.end(); it++) {
        RDirNode* node = (*it);
        node->updateFilesVBO(buffer,dt);
    }
}
示例#3
0
void RDirNode::calcColour() {

    // make branch brighter if recently accessed
    float brightness = std::max(0.6f, 1.0f - std::min(1.0f, since_last_node_change / 3.0f));

    col = vec4f(brightness, brightness, brightness, 1.0);

    int fcount = 0;

    for(std::list<RFile*>::iterator it = files.begin(); it != files.end(); it++) {
        RFile* file = (*it);

        if(file->isHidden()) continue;;

        vec3f filecol = file->getColour() * brightness;
        float a       = file->getAlpha();

        col += vec4f(filecol.x, filecol.y, filecol.z, a);

        fcount++;
    }

    this->col /= (float) fcount + 1.0f;
}