Quantcast
Viewing all articles
Browse latest Browse all 40524

Using ofNode to build an L-System

ah, ok then you shouldn't use auto, using auto there is like declaring a new variable only visible in that block. just use branch=... like:

        if (c == 'F') {
            branching = true;
        }else if (c == '+') {
            auto jointBranch = Branch();
            jointBranch.setParent(branch);
            jointBranch.roll(45);
            branch = Branch();
            branch.setParent(jointBranch);
        }

you also need to store jointBranch somewhere since it's also going away as soon as the block ends, perhaps put them in a vector or something like that


Viewing all articles
Browse latest Browse all 40524

Trending Articles