Skip to content

diegoarjz/pagoda

Repository files navigation

Buy Me A Coffee

Branch master development
Build Build

You can find Pagoda's documentation here.

What is Pagoda

banner

graph

The goal of Pagoda is to be a procedural modelling framework aimed at supporting researchers and academics in this field. Therefore, it must be flexible enough to allow the implementation of multiple algorithms and methodologies.

Currently, Pagoda implements a graph-based approach since it is considered to be one of the most flexible methods to specify the rules in procedural modelling. The idea is to, eventually, reach a design that allows its users to re-use code from any of the available layers to implement other methodologies.

Building Pagoda

Before building pagoda, you need to install the Boost libraries. Instructions on how to do so can be found on its website.

Pagoda also needs Google Test. However, this dependency is built for you automatically.

Once you have installed Boost execute the following commands in the terminal:

$ git clone https://github.com/diegarjz/pagoda.git pagoda
$ cd pagoda
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make && make test && make install

If all goes well you will have built and installed the pagoda library, headers and the pagoda executable. The pagoda executable is what allows you to execute a procedural graph in the specified in the pagoda format.

Executing your first procedural graph

The pagoda executable takes a procedural graph file and optionally executes it.

A procedural graph is a directed graph that details the execution of the operations and the flow of procedural objects through the operations.

All sorts of concepts in a procedural graph are represented by nodes. Operations nodes, interfaces between procedural operations, parameter nodes, etc. The reasoning for this approach is that it allows a higher level of flexibility and extensibility while defining procedural graphs. Links between nodes usually represent the flow of procedural objects but different nodes might process the objects in different ways. Some may create new geometry with procedural operations. Other might filter the flow of objects through the nodes.

The most simple procedural graph might be one that just creates a rectangle. This is illustrated in the following snippet:

create_rect = Operation(operation: "CreateRectGeometry") { width: 10, height: 10 }
create_rect_out = OutputInterface(interface: "out")
create_rect -> create_rect_out;

export_in = InputInterface(interface: "in")
export = Operation(operation: "ExportGeometry") { path: "rect.geom" }
export_in -> export;

create_rect_out -> export_in;

Creating a node is similar to constructing an object in object oriented programming. You call the constructor of the node's type (e.g., Operation or OutputInterface) with some parameters inside the round brackets (the construction arguments). Because all nodes can contain parameters (influencing the node's execution) you specify these inside the curly brackets (the execution parameters).

Nodes can be assigned to names which are then used to create links between nodes.

So, for example, in the first line, you create an Operation node whose operation is a CreateRectGeometry. When the node is executed the execution parameters will be passed to the operation, which will create a 10x10 square.

On the second line, an OutputInterface node is created. Since the OutputInterface nodes don't require execution parameters the curly brackets were omitted. The third line links both nodes.

Similarly, lines four to six create an Operation node to export the geometry and its input interface. The final line links the output of the create_rect operation and the export geometry.

To execute this node you can run the following on the command line:

pagoda create_rect.pgd --execute

You will then have a rect.obj file with the square.