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


C++ ViewerNodePtr::isClipToFormatEnabled方法代码示例

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


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

示例1: rectClippedToRoI

// 0___1___2___3
// |  /|  /|  /|
// | / | / | / |
// |/  |/  |/  |
// 4---5---6----7
// |  /|  /|  /|
// | / | / | / |
// |/  |/  |/  |
// 8---9--10--11
// |  /|  /|  /|
// | / | / | / |
// |/  |/  |/  |
// 12--13--14--15
void
ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel,
                                           int textureIndex,
                                           ViewerGL::DrawPolygonModeEnum polygonMode,
                                           bool background)
{
    // always running in the main thread
    assert( qApp && qApp->thread() == QThread::currentThread() );
    assert( QGLContext::currentContext() == _this->context() );


    ///the texture rectangle in image coordinates. The values in it are multiples of tile size.
    ///
    const RectI &textureBounds = this->displayTextures[textureIndex].texture->getBounds();
    //const RectD& originalCanonicalRoI = this->displayTextures[textureIndex].originalCanonicalRoi;

    ///This is the coordinates in the image being rendered where datas are valid, this is in pixel coordinates
    ///at the time we initialize it but we will convert it later to canonical coordinates. See 1)
    const double par = this->displayTextures[textureIndex].pixelAspectRatio;

    RectD canonicalRoIRoundedToTileSize;
    textureBounds.toCanonical_noClipping(mipMapLevel, par /*, rod*/, &canonicalRoIRoundedToTileSize);

    ///the RoD of the image in canonical coords.
    RectD rod = _this->getRoD(textureIndex);

    ViewerNodePtr internalNode = _this->getViewerTab()->getInternalNode();
    bool clipToDisplayWindow = internalNode->isClipToFormatEnabled();

    RectD rectClippedToRoI(canonicalRoIRoundedToTileSize);
    rectClippedToRoI.intersect(rod, &rectClippedToRoI);


    if (clipToDisplayWindow) {
        rod.intersect(this->displayTextures[textureIndex].format, &rod);
        rectClippedToRoI.intersect(this->displayTextures[textureIndex].format, &rectClippedToRoI);
    }

    


    //if user RoI is enabled, clip the rod to that roi
    bool userRoiEnabled = internalNode->isUserRoIEnabled();



    ////The texture real size (r.w,r.h) might be slightly bigger than the actual
    ////pixel coordinates bounds r.x1,r.x2 r.y1 r.y2 because we clipped these bounds against the bounds
    ////in the ViewerInstance::renderViewer function. That means we need to draw actually only the part of
    ////the texture that contains the bounds.
    ////Notice that r.w and r.h are scaled to the closest Po2 of the current scaling factor, so we need to scale it up
    ////So it is in the same coordinates as the bounds.
    ///Edit: we no longer divide by the closestPo2 since the viewer now computes images at lower resolution by itself, the drawing
    ///doesn't need to be scaled.

    if (userRoiEnabled) {
        RectD userRoI = internalNode->getUserRoI();
        //if the userRoI isn't intersecting the rod, just don't render anything
        if ( !rod.intersect(userRoI, &rod) ) {
            return;
        }

        rectClippedToRoI.intersect(rod, &rectClippedToRoI);
        //clipTexCoords<RectD>(canonicalTexRect,rectClippedToRoI,texBottom,texTop,texLeft,texRight);
    }

    if (polygonMode != eDrawPolygonModeWhole) {
        /// draw only  the plane defined by the wipe handle
        QPolygonF polygonPoints, polygonTexCoords;
        RectD floatRectClippedToRoI;
        floatRectClippedToRoI.x1 = rectClippedToRoI.x1;
        floatRectClippedToRoI.y1 = rectClippedToRoI.y1;
        floatRectClippedToRoI.x2 = rectClippedToRoI.x2;
        floatRectClippedToRoI.y2 = rectClippedToRoI.y2;
        Implementation::WipePolygonEnum polyType = this->getWipePolygon(floatRectClippedToRoI, polygonMode == eDrawPolygonModeWipeRight, &polygonPoints);

        if (polyType == Implementation::eWipePolygonEmpty) {
            ///don't draw anything
            return;
        } else if (polyType == Implementation::eWipePolygonPartial) {
            this->getPolygonTextureCoordinates(polygonPoints, canonicalRoIRoundedToTileSize, polygonTexCoords);

            assert(displayTextures[textureIndex].texture);
            GL_GPU::ActiveTexture(GL_TEXTURE0);
            GL_GPU::GetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&prevBoundTexture);
            GL_GPU::BindTexture( GL_TEXTURE_2D, displayTextures[textureIndex].texture->getTexID() );

//.........这里部分代码省略.........
开发者ID:kcotugno,项目名称:Natron,代码行数:101,代码来源:ViewerGLPrivate.cpp


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