当前位置: 首页>>代码示例>>C++>>正文


C++ TransformNode::buildTransform方法代码示例

本文整理汇总了C++中TransformNode::buildTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformNode::buildTransform方法的具体用法?C++ TransformNode::buildTransform怎么用?C++ TransformNode::buildTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransformNode的用法示例。


在下文中一共展示了TransformNode::buildTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: render

void Picture::render(int w, int h)
{
   //picture will not look exactly like in class programs
   //normals used are those from the text file

   GLuint* tex_num = new GLuint[2];
   //obtain two unique integers that have not been used as texture id before
   glGenTextures(2, tex_num);

   const char* fileName = "sphere_texture.txt";
   BasicObject* sphere = new BasicObject(fileName);

   //sphere 1 with moon color texture
   InstanceObject* sphere1 = new InstanceObject(sphere);
   Color* d1 = new Color(0.3, 0.3, 0.9);
   sphere1->setDiffuseMaterial(d1);
   const char* texture = "MoonColor.raw";
   Texture* moon_color = new Texture(texture, 512, 256);
   sphere1->setColorTexture(moon_color, tex_num[0]);

   //sphere 2 with moon normal map texture
   InstanceObject* sphere2 = new InstanceObject(sphere);
   Color* d2 = new Color(1.0, 0.0, 0.0);
   sphere2->setDiffuseMaterial(d2);
   const char* normal = "MoonNormal.raw";
   Texture* moon_normal = new Texture(normal, 512, 256);
   sphere2->setColorTexture(moon_normal, tex_num[1]);

   Scene* scene = new Scene();

   TransformNode* tn = new TransformNode();
   tn->buildTransform(AffineTransforms::scale(.9, .3, .3));
   tn->buildTransform(AffineTransforms::rotateX(90));
   tn->buildTransform(AffineTransforms::rotateY(290));
   tn->buildTransform(AffineTransforms::translate(0, 0, 0));
   tn->addChild(sphere1);

   scene->addTransformNode(tn);

   tn = new TransformNode();
   tn->buildTransform(AffineTransforms::scale(.7, 1.3, .7));
   tn->buildTransform(AffineTransforms::rotateX(90));
   tn->buildTransform(AffineTransforms::rotateZ(290));
   tn->buildTransform(AffineTransforms::translate(-.75, .75, 0));
   tn->addChild(sphere2);

   scene->addTransformNode(tn);

   scene->render(w, h);
   delete scene;
}
开发者ID:pwestrich,项目名称:csc_4750,代码行数:51,代码来源:Picture.cpp


注:本文中的TransformNode::buildTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。