A Builderfile is a sequence of instructions in RoCo that when executed gives a desired output. However, the use of builderfiles can be expanded to support operations, such as copying subcomponents and redoing certain operations in the UI.
Data Structure:
Since RoCo components are hierarchical by nature, it is appropriate to use a tree data structure to store the instructions of RoCo components.
Basic Classes:
- class BuilderFileController: The BuilderFileController facilitates the generation of the BuilderFileTree, supporting basic operations, such as adding BFC_nodes and BFC_edges (see below) that build up and updates the BuilderFileTree.
- class BFC_node: A node that contains information of a RoCo component, such as geometric shapes. BFC_node also store past parameter values so that it is easy to see the past states of the component, for purposes, such as redoing in the UI. BFC_nodes can be virtual or real (see below for more info)
- class BFC_edge: A edge that shows the relations between nodes, such as connections or constraints. Since an edge depends on the existence of BFC_nodes, in our builderFile, we have to make sure that the instructions of BFC_edge are after the ones of BFC_nodes.
Algorithm:
1. We start with a root node that represents a component, a root node is a virtual node.
2. As we add subcomponents to this component, we instantiate new BFC_nodes and store these references in the parent BFC_node (in this case, since we just started, the root node)
3. We decide that we have added a reasonable number of subcomponents, so we proceed to build the component.
4. After the build, the BFC_nodes that are marked as built so that only if a child node has been changed in any way (such as parameter update) does the parent has to be rebuilt.
*Just a thought, maybe we could build add dependencies of nodes, so that three.js only has to generate those that have been affected by a change, thereby only doing a partial rendering of the 3D image rather than rebuilding the whole geometry.
5. A new root node is also generated adding 1 to the depth of the BuilderFileTree.
6. Continuously build the tree (repeat 2 - 5)
In the next post, I'll talk more about the evaluation/search of BFC_nodes and BFC_edges in the BuilderFileTree.