Easy3D is a lightweight, easy-to-use, and efficient C++ library for processing and rendering 3D data.

Tutorial

点云、网格、图、多面体例子 描述
Tutorial_101_PointCloud 生成点云
Tutorial_102_PointCloud_Property 获取点云属性
Tutorial_103_PointCloud_IO 点云读写
Tutorial_104_SurfaceMesh 生成网格
Tutorial_105_SurfaceMesh_Connectivity 遍历网格
Tutorial_106_SurfaceMesh_Property 获取网格属性
Tutorial_107_SurfaceMesh_IO 网格读写
Tutorial_108_Graph 生成三维空间图
Tutorial_109_Graph_Connectivity 遍历图
Tutorial_110_Graph_Property 获取图的属性
Tutorial_111_Graph_IO 图的读写
Tutorial_112_PolyMesh 生成四/多面体
Tutorial_113_PolyMesh_Connectivity 遍历四/多面体
Tutorial_114_PolyMesh_Property 获取多面体属性
Tutorial_115_PolyMesh_IO 多面体读写
GUI/Viewer、相机模型例子 描述
Tutorial_201_Viewer_imgui ImGui
Tutorial_202_Viewer_Qt Qt
Tutorial_203_CompositeView 组合式窗口
Tutorial_204_CameraInterpolation 关键帧插值
Tutorial_205_RealCamera 相机模型
绘制对象与渲染例子 描述
Tutorial_301_Drawables 绘制点线面
Tutorial_302_Imposters 绘制点(球体/面片)线(圆柱/圆锥)
Tutorial_303_ScalarField 标量场渲染
Tutorial_304_VectorField 矢量场渲染
Tutorial_305_Texture 生成纹理
Tutorial_306_Image 显示图像
Tutorial_307_Tessellator 细分曲面
Tutorial_308_TexturedMesh 网格纹理?
Tutorial_309_TextRendering 显示文字
Tutorial_310_TextMesher 字体渲染
Tutorial_311_Animation 动画功能
Tutorial_312_MultiThread 开启多线程
人机交互UI例子 描述
Tutorial_401_ModelPicker 选取模型
Tutorial_402_FacePicker 选取网格表面
Tutorial_403_PointSelection 选取点集
Tutorial_404_VirtualScanner 虚拟扫描仪(传感器)
渲染技术例子 描述
Tutorial_501_AmbientOcclusion 环境遮挡(AO)
Tutorial_502_HardShadow 阴影贴图
Tutorial_503_SoftShadow PCSS
Tutorial_504_Transparency 透明效果
Tutorial_505_EyeDomeLighting Eye Dome Lighting
Tutorial_506_DepthMaps 生成深度图(传感器)
点云相关算法例子 描述
Tutorial_601_Cloud_NormalEstimation 法向量估计
Tutorial_602_Cloud_SurfaceReconstruction 泊松表面重建
Tutorial_603_Cloud_PlaneExtraction RANSAC平面提取

Viewer Main Loop

int Viewer::run(bool see_all) {
    // initialize before showing the window because it can be slow
    init();

    // make sure scene fits the screen when the window appears
    if (see_all)
        fit_screen();

    // show the window
    glfwShowWindow(window_);

    try {   // main loop
        static int frame_counter = 0;
        double last_time = glfwGetTime();   // for frame rate counter

        while (!glfwWindowShouldClose(window_) && !should_exit_) {
            if (!glfwGetWindowAttrib(window_, GLFW_VISIBLE)) { // not visible
                glfwWaitEvents();
                continue;
            }

            if (show_frame_rate_) {
                // Calculate ms/frame
                double current_time = glfwGetTime();
                ++frame_counter;
                if (current_time - last_time >= 1.0f) {
                    sprintf(gpu_time_, "fps: %2.0f (%4.1f ms/frame)",
                            double(frame_counter) / (current_time - last_time), 1000.0 / double(frame_counter));
                    frame_counter = 0;
                    last_time = current_time;
                }
            }

            pre_draw();
            draw();
            post_draw();
            glfwSwapBuffers(window_);

            if (is_animating_ && animation_func_) {
                glfwPollEvents();

                // TODO: make framerate a parameter
                if (!show_frame_rate_) {
                    static const int animation_fps = 30;
                    static const double interval = 1000.0 / (animation_fps + 5); // the extra 5 for adjusting
                    std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(interval)));
                }
                animation_func_(this);
            }
            else if (show_frame_rate_)
                glfwPollEvents();
            else
                glfwWaitEvents();
        }

        /* Process events once more */
        glfwPollEvents();
        cleanup();
        return EXIT_SUCCESS;
    }
    catch (const std::exception &e) {
        LOG(ERROR) << "Caught exception in main loop: " << e.what();
        cleanup();
        return EXIT_FAILURE;
    }
}

Easy3D + GLFW + ImGui + LCM

Model Type

  • PointCloud
  • SurfaceMesh
  • PolyMesh
  • Graph

Ref