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


C++ MeshObject::Smooth方法代码示例

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


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

示例1: project2

void project2() {
    // Create scene
    Scene scn;
    scn.SetSkyColor(Color(0.8f, 0.8f, 1.0f));
    
    // Create ground
    MeshObject ground;
    ground.MakeBox(5.0f,0.1f,5.0f);
    scn.AddObject(ground);
    
    // Create dragon
    MeshObject dragon;
    dragon.LoadPLY("dragon.ply");
    dragon.Smooth();
    
    std::chrono::time_point<std::chrono::system_clock> start, end;
    start = std::chrono::system_clock::now();
    
    std::cout <<  "Constructing the tree ..." << std::endl;
    
    BoxTreeObject tree;
    tree.Construct(dragon);
    scn.AddObject(tree);
    
    end = std::chrono::system_clock::now();
    std::chrono::duration<double> elapsed_seconds = end-start;
    
    std::cout << "Tree construcion done in " << elapsed_seconds.count() * 1000 << " milliseconds" <<  std::endl;

    
    // Create instance
    InstanceObject inst(tree);
    Matrix34 mtx;
    mtx.MakeRotateY(PI);
    mtx.d.Set(-0.05f,0.0f,-0.1f);
    inst.SetMatrix(mtx); scn.AddObject(inst);

    // Create lights
    DirectLight sunlgt;
    sunlgt.SetBaseColor(Color(1.0f, 1.0f, 0.9f));
    sunlgt.SetIntensity(1.0f);
    sunlgt.SetDirection(Vector3(2.0f, -3.0f, -2.0f));
    scn.AddLight(sunlgt);

    PointLight redlgt;
    redlgt.SetBaseColor(Color(1.0f, 0.2f, 0.2f));
    redlgt.SetIntensity(0.02f);
    redlgt.SetPosition(Vector3(-0.2f, 0.2f, 0.2f));
    scn.AddLight(redlgt);

    PointLight bluelgt;
    bluelgt.SetBaseColor(Color(0.2f, 0.2f, 1.0f));
    bluelgt.SetIntensity(0.02f);
    bluelgt.SetPosition(Vector3(0.1f, 0.1f, 0.3f));
    scn.AddLight(bluelgt);

    // Create camera
    Camera cam;
    cam.LookAt(Vector3(-0.1f,0.1f,0.2f),Vector3(-0.05f,0.12f,0.0f));
    cam.SetFOV(40.0f);
    cam.SetAspect(1.33f);
    cam.SetResolution(800,600);

    start = std::chrono::system_clock::now();
    std::cout <<  "Rendering the scene ..." << std::endl;
    
    // Render image
    cam.Render(scn);
    cam.SaveBitmap("project2.bmp");
    
    end = std::chrono::system_clock::now();
    elapsed_seconds = end-start;
    
    std::cout << "Scene rendering done in " << elapsed_seconds.count() * 1000 << " milliseconds" <<  std::endl;

}
开发者ID:petrosferdinand,项目名称:CSE168,代码行数:76,代码来源:Main.cpp


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