@edapx wrote:
Hello, I'm developing an openFrameworks addon that will create a generative mesh. I want to let to the end user to decide which geometry will be used while creating this mesh, if a tube, a box or whatever. My initial idea was to use template classes but I'm not sure anymore if this is the right solution.
I write here some pseudocode to try to explain my problem. I've agrow
method that it is called during theupdate
method of the ofApp.grow(){ for (branch in:newBranches) { auto box = new Box(); addNewBranchToMesh(box); } }
what I want to do is to give to the user the ability to pass a class to the grow method. Not an instance of an object, but a class
grow(myGeometry ){ for (branch in:newBranches) { auto box = new myGeometry(); addNewBranchToMesh(box); } }
In a way that the user could define a
myBox
class, amyCylinder
class or whatever. I'm not referring toof3dPrimitives
, but to custom defined classes that come with some basic method, likegetMesh
,startFrom
,endTo
.Does this make sense? is it the proper way to solve this problem in c++?
Posts: 3
Participants: 2