...
Code Block |
---|
language | perl |
---|
theme | Midnight |
---|
title | NSI 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 |
---|
language | cpp |
---|
theme | Midnight |
---|
title | C++ |
---|
collapse | true |
---|
|
/** Turn our mesh into a subdivision surface */
nsi.SetAttribute( k_poly_handle,
NSI::CStringPArg("subdivision.scheme", "catmull-clark") ); |
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
title | NSI 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.
...