Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageperl
themeMidnight
titleNSI Stream
## Polygonal meshes can be created minimally by specifying "P".
## NSI's C++ API provides an easy interface to pass parameters to all NSI
## API calls through the Args class.

Create "simple polygon" "mesh"
SetAttribute "simple polygon"
	"P" "point" 1 [ -1  1  0   1  1  0   1 -1 0   -1 -1 0 ];





Specifying normals and other texture coordinates follows the same logic. Constant attributes can be declared in a concise form too:

Code Block
languagecpp
themeMidnight
titleC++
collapsetrue
/** Turn our mesh into a subdivision surface */
nsi.SetAttribute( k_poly_handle,
	NSI::CStringPArg("subdivision.scheme", "catmull-clark") );


Code Block
languagebash
themeMidnight
titleNSI Stream
SetAttribute "simple polygon"
	"subdivision.scheme" "string" 1 ["catmull-clark"]

Transforming Geometry

In NSI, a geometry is rendered only if connected to scene's root (which has the special handle ".root"). It is possible to directly connect a geometry node (such as the simple polygon above) to scene's root but it wouldn't be very useful. To place/instance geometry anywhere in the 3D world a transform node is used as in the code snippet below.

...