Esempio n. 1
0
VRStrokePtr FNetwork::stroke(Color3f c, float k) {
    vector<PathPtr> paths;
    for (auto n1 : nodes) {
        auto p1 = n1.second->getTransform()->getWorldPose();
        map<int, shared_ptr<FNode>>::iterator itr2;
        for (auto n2 : n1.second->getOutgoing()) {
            auto p2 = n2.second->getTransform()->getWorldPose();
            PathPtr p = Path::create();
            p->addPoint( *p1, c );
            p->addPoint( *p2, c );
            p->compute(20);
            paths.push_back(p);
        }
    }


    VRStrokePtr stroke = VRStroke::create("FNetwork_stroke");
    stroke->setPaths(paths);
    vector<Vec3d> profile;
    profile.push_back(Vec3d(-k,0,0));
    profile.push_back(Vec3d(-k*0.5,k,0));
    profile.push_back(Vec3d(k*0.5,k,0));
    profile.push_back(Vec3d(k,0,0));
    stroke->strokeProfile(profile, true, true);
    return stroke;
}
Esempio n. 2
0
VRStrokePtr FNetwork::stroke(Vec3f c, float k) {
    vector<path*> paths;
    for (itr = nodes.begin(); itr != nodes.end(); itr++) {
        FNode* n1 = itr->second;
        Vec3f t1 = n1->getTangent();
        Vec3f p1 = n1->getTransform()->getWorldPosition();
        map<int, FNode*>::iterator itr2;
        for (itr2 = n1->getOutgoing().begin(); itr2 != n1->getOutgoing().end(); itr2++) {
            FNode* n2 = itr2->second;
            Vec3f t2 = n2->getTangent();
            Vec3f p2 = n2->getTransform()->getWorldPosition();

            path* p = new path();
            p->addPoint(p1, t1, c);
            p->addPoint(p2, t2, c);
            p->compute(20);
            paths.push_back(p);
        }
    }


    VRStrokePtr stroke = VRStroke::create("FNetwork_stroke");
    stroke->setPaths(paths);
    vector<Vec3f> profile;
    profile.push_back(Vec3f(-k,0,0));
    profile.push_back(Vec3f(-k*0.5,k,0));
    profile.push_back(Vec3f(k*0.5,k,0));
    profile.push_back(Vec3f(k,0,0));
    stroke->strokeProfile(profile, true);
    return stroke;
}