void RUser::applyForceAction(RAction* action) { RFile* f = action->target; vec2f f_pos = f->getAbsolutePos(); vec2f dir = f_pos - pos; float dist = dir.length(); float desired_dist = gGourceActionDist; //resolve overlap if(dist < 0.001) { accel += vec2f( (rand() % 100) - 50, (rand() % 100) - 50).normal(); return; } //repelling force if(dist < desired_dist) { accel -= (desired_dist - dist) * dir.normal(); return; } if(dist > gGourceBeamDist) { accel += (dist-gGourceBeamDist) * dir.normal(); } }
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); } }