~ubuntu-branches/debian/stretch/gource/stretch

« back to all changes in this revision

Viewing changes to src/dirnode.cpp

  • Committer: Package Import Robot
  • Author(s): Andrew Caudwell
  • Date: 2013-05-13 09:58:33 UTC
  • mfrom: (1.2.14)
  • Revision ID: package-import@ubuntu.com-20130513095833-1r8t89oflvhqxwny
Tags: 0.40-1
* New upstream release.
* Added dpkg-buildflags.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    setParent(parent);
40
40
 
41
41
    accel = spos = prev_accel = vel = vec2(0.0f);
42
 
    
 
42
 
43
43
    //NOTE: parent is always being set to 0 so this never gets called ...
44
 
    
 
44
 
45
45
    //figure out starting position
46
46
    if(parent !=0) {
47
47
        vec2 parentPos = parent->getPos();
48
48
        vec2 offset;
49
49
 
50
 
        RDirNode* parentP = parent->getParent();
51
 
 
52
50
        pos = parentPos;
53
51
    } else {
54
52
        pos = vec2(0.0f, 0.0f);
111
109
 
112
110
    calcRadius();
113
111
    updateFilePositions();
114
 
 
 
112
    if(visible && noDirs() && noFiles()) visible = false;
115
113
    if(parent !=0) parent->nodeUpdated(true);
116
114
}
117
115
 
152
150
 
153
151
 
154
152
bool RDirNode::isDir(const std::string& path) const {
155
 
      
 
153
 
156
154
    if(prefixedBy(path)) return true;
157
155
 
158
156
    if(path.find(abspath) != 0) return false;
159
 
    
 
157
 
160
158
    for(std::list<RDirNode*>::const_iterator it = children.begin(); it != children.end(); it++) {
161
159
        if((*it)->isDir(path)) return true;
162
160
    }
171
169
        dirs.push_back(this);
172
170
        return;
173
171
    }
174
 
 
 
172
 
175
173
    for(std::list<RDirNode*>::const_iterator it = children.begin(); it != children.end(); it++) {
176
174
        (*it)->findDirs(path, dirs);
177
175
    }
422
420
 
423
421
    for(std::list<RFile*>::const_iterator it = files.begin(); it != files.end(); it++) {
424
422
        RFile* file = (*it);
425
 
       
 
423
 
426
424
        if(f->path.find(file->fullpath) == 0) {
427
425
            //fprintf(stderr, "removing %s as is actually the directory of %s\n", file->fullpath.c_str(), f->fullpath.c_str());
428
426
            file->remove(true);
584
582
 
585
583
    float posd     = glm::length(parent->getPos() - pos);
586
584
    float distance = posd - (dir_radius + parent->getParentRadius());
587
 
    
 
585
 
588
586
    return distance;
589
587
}
590
588
 
596
594
    float posd2       = glm::length2(dir);
597
595
    float myradius    = getRadius();
598
596
    float your_radius = node->getRadius();
599
 
    
 
597
 
600
598
    float sumradius = (myradius + your_radius);
601
599
 
602
600
    float distance2 = posd2 - sumradius*sumradius;
655
653
    //  * dirs should attract to sit on the radius of the parent dir ie:
656
654
    //    should attract to distance_to_parent * normal_to_parent
657
655
 
658
 
    
659
 
    
 
656
 
 
657
 
660
658
    accel += gGourceForceGravity * parent_dist * normalise(parent->getPos() - pos);
661
 
    
 
659
 
662
660
    //  * dirs should be pushed along the parent_parent to parent normal by a force smaller than the parent radius force
663
661
    RDirNode* pparent = parent->getParent();
664
662
 
773
771
    if(parentP != 0) {
774
772
        //pos += ((parent->getPos() - parentP->getPos()).normal() * 2.0 + vec2Hash(abspath)).normal();
775
773
        pos += normalise(normalise(parent->getPos() - parentP->getPos()) * 2.0f + vec2Hash(abspath));
776
 
       
 
774
 
777
775
    }  else {
778
776
        pos += vec2Hash(abspath);
779
777
    }
780
 
    
 
778
 
781
779
    //the spline point
782
780
    spos = pos - (parent->getPos() - pos) * 0.5f;
783
781
    position_initialized=true;
1064
1062
void RDirNode::drawFiles(float dt) const{
1065
1063
 
1066
1064
    if(in_frustum) {
1067
 
 
1068
 
        vec4 col = getColour();
1069
 
 
1070
1065
        glPushMatrix();
1071
1066
            glTranslatef(pos.x, pos.y, 0.0);
1072
1067