Example #1
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);
    }
}
Example #2
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;
}