...
Code Block |
---|
language | cpp |
---|
theme | FadeToGrey |
---|
collapse | true |
---|
|
const char *k_instance1 = "translation";
nsi.Create( k_instance1, "transform" );
nsi.Connect( k_instance1, "", NSI_SCENE_ROOT, "objects" );
nsi.Connect( k_poly_handle, "", k_instance1, "objects" );
/*
Matrices in NSI are in double format to allow for greater
range and precision.
*/
double trs[16] =
{
1., 0., 0., 0.,
0., 1., 0., 0.,
0., 0., 1., 0.,
0., 1., 0., 1. /* transalte 1 unit in Y */
};
nsi.SetAttribute( k_instance1,
NSI::DoubleMatrixArg("transformationmatrix", trs) ); |
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
title | NSI Stream |
---|
|
const char *k_instance1 = "translation";
Create "translation" "transform"
Connect "translation" "" ".root" "objects"
Connect "simple polygon" "" "translation" "objects" );
# Transalte 1 unit in Y
SetAttribute "translation"
"transformationmatrix" "matrix" 1 [
1 0 0 0
0 1 0 0
0 0 1 0
0 1 0 1] |
Instancing is as simple as connecting geometry to different attributes (yes, instances of instances are supported).
...