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


C++ path::clear方法代码示例

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


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

示例1: draw

void ShaderToyApp::draw()
{
    // Bind textures.
    if( mChannel0 ) mChannel0->bind( 0 );
    if( mChannel1 ) mChannel1->bind( 1 );
    if( mChannel2 ) mChannel2->bind( 2 );
    if( mChannel3 ) mChannel3->bind( 3 );

    // Render the current shader to a frame buffer.
    if( mShaderCurrent && mBufferCurrent ) {
        gl::ScopedFramebuffer fbo( mBufferCurrent );

        // Bind shader.
        gl::ScopedGlslProg shader( mShaderCurrent );
        setUniforms();

        // Clear buffer and draw full screen quad (flipped).
        gl::clear();
        gl::drawSolidRect( Rectf( 0, (float)getWindowHeight(), (float)getWindowWidth(), 0 ) );
    }

    // Render the next shader to a frame buffer.
    if( mShaderNext && mBufferNext ) {
        gl::ScopedFramebuffer fbo( mBufferNext );

        // Bind shader.
        gl::ScopedGlslProg shader( mShaderNext );
        setUniforms();

        // Clear buffer and draw full screen quad (flipped).
        gl::clear();
        gl::drawSolidRect( Rectf( 0, (float)getWindowHeight(), (float)getWindowWidth(), 0 ) );
    }

    // Perform a cross-fade between the two shaders.
    double time = getElapsedSeconds() - mTransitionTime;
    double fade = math<double>::clamp( time / mTransitionDuration, 0.0, 1.0 );

    if( fade <= 0.0 ) {
        // Transition has not yet started. Keep drawing current buffer.
        gl::draw( mBufferCurrent->getColorTexture(), getWindowBounds() );
    }
    else if( fade < 1.0 ) {
        // Transition is in progress.
        // Use a transition shader to avoid having to draw one buffer on top of another.
        gl::ScopedTextureBind tex0( mBufferCurrent->getColorTexture(), 0 );
        gl::ScopedTextureBind tex1( mBufferNext->getColorTexture(), 1 );

        gl::ScopedGlslProg shader( mShaderTransition );
        mShaderTransition->uniform( "iSrc", 0 );
        mShaderTransition->uniform( "iDst", 1 );
        mShaderTransition->uniform( "iFade", (float)fade );

        gl::drawSolidRect( getWindowBounds() );
    }
    else if( mShaderNext ) {
        // Transition is done. Swap shaders.
        gl::draw( mBufferNext->getColorTexture(), getWindowBounds() );

        mShaderCurrent = mShaderNext;
        mShaderNext.reset();

        mPathCurrent = mPathNext;
        mPathNext.clear();

        getWindow()->setTitle( std::string( "ShaderToyApp - Showing " ) + mPathCurrent.filename().string() );
    }
    else {
        // No transition in progress.
        gl::draw( mBufferCurrent->getColorTexture(), getWindowBounds() );
    }
}
开发者ID:zulis,项目名称:Cinder-Samples,代码行数:72,代码来源:ShaderToyApp.cpp


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