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


C++ seq::add方法代码示例

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


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

示例1: main

int main( int argc, char **argv )

{
  if (argc < 2) {
    cerr << "Usage: " << argv[0] << " scene.obj ..." << endl;
    exit(1);
  }

  glutInit(&argc, argv);
  glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );

  int shift = (argc < 4 ? 0 : atoi(argv[3]) * 450);

  glutInitWindowSize( windowWidth, windowHeight );
  glutInitWindowPosition( 50 + shift, 50 );
  glutCreateWindow( "toon shading" );

  GLenum status = glewInit();
  if (status != GLEW_OK) {
    std::cerr << "Error: " << glewGetErrorString(status) << std::endl;
    return 1;
  }

  glutDisplayFunc( display );
  glutReshapeFunc( reshape );
  glutIdleFunc( idle );
  glutKeyboardFunc( keyPress );
  glutSpecialFunc( specialKeyPress );

  // Set up world objects

  for (int i=1; i<argc; i++)
    objs.add( new wfModel( argv[i] ) );

  if (objs.size() == 0) {
    cout << "no objects defined" << endl;
    exit(1);
  }

  // Find world centre and radius

  worldCentre = vec3(0,0,0);
  for (int i=0; i<objs.size(); i++)
    worldCentre = worldCentre + objs[i]->centre;
  worldCentre = (1/(float)objs.size()) * worldCentre;

  worldRadius = 0;
  for (int i=0; i<objs.size(); i++) {
    float radius = (objs[i]->centre - worldCentre).length() + objs[i]->radius;
    if (radius > worldRadius)
      worldRadius = radius;
  }

  // Point camera to the model

  const float initEyeDistance = 5.0;

  eyePosition = (initEyeDistance * worldRadius) * vec3(0.7,0.3,1).normalize() + worldCentre;
  fovy = 2 * atan2( 1, initEyeDistance );

  // Set up renderer

  axes = new Axes();

  renderer = new Renderer( windowWidth, windowHeight );

  // Go

  glutMainLoop();

  return 1;
}
开发者ID:Zombiefruit,项目名称:Deferred_Shading,代码行数:72,代码来源:shader.cpp


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