本文整理汇总了C++中TransformNode::addNode方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformNode::addNode方法的具体用法?C++ TransformNode::addNode怎么用?C++ TransformNode::addNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformNode
的用法示例。
在下文中一共展示了TransformNode::addNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void Picture::render(Pixel* pix)
{
Matrix* T;
Matrix* R;
Matrix* S;
Matrix* T2;
Matrix* T3;
// Get BasicObjects
BasicObject* cube = readObject( "cube.txt" );
BasicObject* cyli = readObject( "cylinder.txt" );
// BasicObject* sphere = readObject( "sphere.txt" );
//WA
Matrix* wnd_trns = AffineTransforms::windowingTransform(pix->getWidth(),
pix->getHeight());
Matrix* aspct_ratio = AffineTransforms::aspectRatio(pix->getWidth(),
pix->getHeight()); // Matrix for aspect ratio.
// Concatenate wnd_trns and aspct_ratio.
Matrix* wa = wnd_trns->multiply( aspct_ratio );
delete wnd_trns;
delete aspct_ratio;
Scene* scene = new Scene(wa);
// Robot 1 Arm
Matrix* robot1;
S = AffineTransforms::scale( 0.2, 0.2, 0.2 );
T = AffineTransforms::translate(0.0, 0.0, -3.0);
robot1 = T->multiply(S);
delete S;
delete T;
// Robot 2 Arm
Matrix* robot2;
T = AffineTransforms::translate(-3.0,0.5,0.0);
S = AffineTransforms::scale( 0.2, 0.2, 0.2 );
R = AffineTransforms::rotateX(45.0);
robot2 = S->multiply(T->multiply(R->multiply(S)));
delete T;
delete S;
delete R;
// Create Base
InstanceObject* base = buildInstanceObject( "base.txt", cyli );
T = AffineTransforms::translate( 0.0, -2.0, 0.0 );
R = AffineTransforms::rotateY( 30.0 );
TransformNode* baseT = new TransformNode(T->multiply( R ));
delete T;
delete R;
// Create Lower Arm
InstanceObject* lower_arm = buildInstanceObject( "lower_arm.txt", cube );
T = AffineTransforms::translate( 0.0, 3.0, 0.0 );
T2 = AffineTransforms::translate( 0.0, -2.0, 0.0 );
R = AffineTransforms::rotateZ( -20.0 );
T3 = AffineTransforms::translate( 0.0, 2.0, 0.0 );
TransformNode* lowerT = new TransformNode(T->multiply(T2->multiply(
R->multiply(T3))));
delete T;
delete T2;
delete T3;
delete R;
// Create Upper Arm
InstanceObject* upper_arm = buildInstanceObject( "upper_arm.txt", cube );
T = AffineTransforms::translate( 0.0,3.0, 0.0 );
T2 = AffineTransforms::translate( 0, -1.0, 0 );
R = AffineTransforms::rotateZ( 90 );
T3 = AffineTransforms::translate( 0.0, 1.0, 0.0 );
TransformNode* upperT = new TransformNode(T->multiply(T2->multiply(
R->multiply(T3))));
delete T;
delete T2;
delete T3;
delete R;
// Create sphere
/*InstanceObject* ball = buildInstanceObject( "sphere_trs.txt", sphere );
InstanceObject* clamp = buildInstanceObject( "clamp1.txt", cube );
InstanceObject* clamp2 = buildInstanceObject( "clamp2.txt", cube );*/
// Connect the pieces.
baseT->addNode( base );
lowerT->addNode( lower_arm );
lowerT->addNode( upperT );
upperT->addNode( upper_arm );
/* upperT->addNode( clamp );
upperT->addNode( clamp2 );
upperT->addNode( ball );*/
baseT->addNode( lowerT );
//.........这里部分代码省略.........