Versions Compared

Key

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

...

Transforming Geometry

In NSI, a geometry is rendered only considered if connected to the 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. It is common to To place geometry using anywhere in the 3D world a transform and NSI has a special node for it node is used as in the code snippet below.

Code Block
languagecpp
themeFadeToGrey
nsi.Create( "translation", "transform" );
nsi.Connect( "translation", "", NSI_SCENE_ROOT, "objects" );
nsi.Connect( "simple polygon", "", "translation", "objects" );

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( "translation",
	NSI::DoubleMatrixArg("transformationmatrix", trs) );

...