Compiling and Custom YG Nodes

Once you've written a new node, you need to compile it to use it. You may also find nodes that other people have written, which need to be compiled to use. These instructions will work for both. If you don't have your modules directory set up with the Makefile and Makedefs, go back to the Getting Started page.

Downloading Nodes to Compile

A Node has at least two files - the .cxx Source File and the .h Header File. Some also have a .dep file if they are based on other nodes. Complex nodes may have additional .cxx and .h files. Save all these in your modules directory.

Compiling

The command to compile is make nodename.so. So, for example, to compile a node called DummyNode, you would say: make DummyNode.so. Or, let's say you've written or downloaded a node called "boid", which implements a flocking algorithm. It would have two parts, "boid.cxx" and "boid.h". The command to compile it would be "make boid.so". The whole sequence of commands would look like this:
badzmaru@redsnapper:~/yg/modules> make boid.so g++ -I. -I/usr/local/yg/modules -I/usr/local/yg/src -I/usr/local/CAVE/include -DOPENGL -I/usr/local/yg/bergen/include -I/usr/local/CAVERN/cavernG2_1.3/include/CAVERN -DCAVERN_USE_PTHREADS -DCAVERN_DO_NOT_USE_GLOBUS -DCAVERN_THREAD_SAFE -g -fno-operator-names -fPIC -c boid.cxx g++ -shared -ldl -lm --export-dynamic -o boid.so boid.o rm boid.o cp boid.so ../dso.linux
This says that the node has compiled OK, and it's been copied into the dso.linux directory. Now, you can use your new node in a scene:
#include "User0.scene" light (position(0 0 10 1)) environment(skyColor(.2 .4 .8),fog(lin .2 .4 .8 0 20)) boid (speed(8),position(0 5 6)) { object(file("x29.sv"),size(.1),position(0 1 0)) }

(c) Ben Chang