Versions Compared

Key

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

...

Code Block
languagecpp
themeMidnight
/**
	Polygonal meshes can be created minimally by specifying P.
    C++ API provides an easy interface to pass parameters to all NSI
	API calls through the Args class.
*/
NSI::Context nsi;
nsi.Create( "simply polygon", "mesh" );

NSI::ArgumentList mesh_args;
float points[3*4] = { ... /* insert your favorite 4 points here */}; 
mesh_args.Add(
	NSI::Argument::New( "P" )
        ->SetType( NSITypePoint )
        ->SetCount( 4 )
        ->SetValuePointer( const_cast<float*>(points) );
nsi.SetAttribute( "simple polgyon", mesh_args );


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

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