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


C++ VRenderParams::format方法代码示例

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


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

示例1: VectorialRender


//.........这里部分代码省略.........
        case VRenderParams::TopologicalSort: {
            TopologicalSortMethod *tsm = new TopologicalSortMethod() ;
            tsm->setBreakCycles(vparams.sortMethod() == VRenderParams::AdvancedTopologicalSort) ;
            sort_method = tsm ;
        }
        break ;

        case VRenderParams::BSPSort:
            sort_method = new BSPSortMethod() ;
            break ;

        case VRenderParams::NoSorting:
            sort_method = new DontSortMethod() ;
            break ;
        default:
            throw std::runtime_error("Unknown sorting method.") ;
        }

        sort_method->sortPrimitives(primitive_tab,vparams) ;

        // Lance les optimisations. L'ordre est important.

        if(vparams.isEnabled(VRenderParams::CullHiddenFaces))
        {
            VisibilityOptimizer vopt ;
            vopt.optimize(primitive_tab,vparams) ;
        }

#ifdef A_FAIRE
        if(vparams.isEnabled(VRenderParams::OptimizePrimitiveSplit))
        {
            PrimitiveSplitOptimizer psopt ;
            psopt.optimize(primitive_tab) ;
        }
#endif
        // Ecrit le fichier

        switch(vparams.format())
        {
        case VRenderParams::EPS:
            exporter = new EPSExporter() ;
            break ;
        case VRenderParams::PS:
            exporter = new PSExporter() ;
            break ;
        case VRenderParams::XFIG:
            exporter = new FIGExporter() ;
            break ;
#ifdef A_FAIRE
        case VRenderParams::SVG:
            exporter = new SVGExporter() ;
            break ;
#endif
        default:
            throw std::runtime_error("Sorry, this output format is not handled now. Only EPS and PS are currently supported.") ;
        }

        // sets background and black & white options

        GLfloat viewport[4],clearColor[4],lineWidth,pointSize ;

        glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
        glGetFloatv(GL_LINE_WIDTH, &lineWidth);
        glGetFloatv(GL_POINT_SIZE, &pointSize);
        glGetFloatv(GL_VIEWPORT, viewport);

        lineWidth /= (float)max(viewport[2] - viewport[0],viewport[3]-viewport[1]) ;

        // Sets which bounding box to use.

        if(vparams.isEnabled(VRenderParams::TightenBoundingBox))
            exporter->setBoundingBox(parserGL.xmin(),parserGL.ymin(),parserGL.xmax(),parserGL.ymax()) ;
        else
            exporter->setBoundingBox(viewport[0],viewport[1],viewport[0]+viewport[2],viewport[1]+viewport[3]) ;

        exporter->setBlackAndWhite(vparams.isEnabled(VRenderParams::RenderBlackAndWhite)) ;
        exporter->setClearBackground(vparams.isEnabled(VRenderParams::AddBackground)) ;
        exporter->setClearColor(clearColor[0],clearColor[1],clearColor[2]) ;

        exporter->exportToFile(vparams.filename(),primitive_tab,vparams) ;

        // deletes primitives

        for(unsigned int i=0; i<primitive_tab.size(); ++i)
            delete primitive_tab[i] ;

        if(exporter != NULL) delete exporter ;
        if(sort_method != NULL) delete sort_method ;
    }
    catch(exception& e)
    {
        cout << "Render aborted: " << e.what() << endl ;

        if(exporter != NULL) delete exporter ;
        if(sort_method != NULL) delete sort_method ;
        if(feedbackBuffer != NULL) delete[] feedbackBuffer ;

        throw e ;
    }
}
开发者ID:harry75369,项目名称:ZBuffer,代码行数:101,代码来源:VRender.cpp


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