| Folder | Contents |
include | The C++ header files which give you access to Houdini's comprehensive set of libraries. |
makefiles | A collection of Makefiles intended to be used as building blocks for your HDK project's Makefiles. For more details, see Compiling with Makefiles. |
samples | A extensive set of HDK code examples. Several HDK samples are referenced throughout the documentation. For example, the standalone/geoisosurface.C link refers to the code sample located at $HFS/toolkit/samples/standalone/geoisosurface.C. |
The program, in brief, is:
0001: #include <GU/GU_Detail.h> 0002: 0003: static float 0004: densityFunction(const UT_Vector3 &P) 0005: { 0006: return 1 - P.length(); // Return signed distance to unit sphere 0007: } 0008: 0009: int 0010: main(int argc, char *argv[]) 0011: { 0012: GU_Detail gdp; 0013: UT_BoundingBox bounds; 0014: 0015: bounds.setBounds(-1, -1, -1, 1, 1, 1); 0016: gdp.polyIsoSurface(HDK_Sample::densityFunction, bounds, 20, 20, 20); 0017: gdp.save("sphere.bgeo", true, NULL); 0018: 0019: return 0; 0020: }
When executed, this simple program generates an ISO surface and saves it to a Houdini geometry file named sphere.bgeo.
To build the program, use hcustom, a tool designed to conveniently build the HDK samples and small custom projects. In a command-line shell, type:
This creates an application, geoisosurface, in the current directory. Run geoisosurface to generate sphere.bgeo which you can view in Houdini's gplay application. For example:
./geoisosurface
gplay sphere.bgeo
And that's it! You have just built and ran your first HDK application!
geoisosurface.C connects to Houdini's geometry utility library by including the GU_Detail.h HDK header. The header file can be found in $HFS/toolkit/includes/GU.
The GU_Detail::polyIsoSurface() method evaluates the callback function densityFunction() inside the bounding box specified by bounds. A mesh of polygons is created and saved to sphere.bgeo.
Try experimenting by changing the implementation of densityFunction() and see what kind of surfaces you can create. For more information on creating geometry using the HDK, see the Houdini Geometry section.
1.5.9