如何纠正反面图片显示在harism页面卷曲?

时间:2016-01-21 20:49:48

标签: curl reverse

我使用harism页面卷曲,问题是左页中的所有图片都是反向的。它是这样的:

Example picture

我找到了这个解决方案,但它无法正常工作:

在curlMesh.java中插入这段代码,使用curl(PointF curlPos,PointF curlDir,double radius)方法(很容易找到它的位置):

        // We use local textureFront for flipping backside texture
        // locally. Plus additionally if mesh is in flip texture mode,
        // we'll make the procedure "backwards". Also, until this point,
        // texture coordinates are within [0, 1] range so we'll adjust
        // them to final texture coordinates too.
        if (textureFront == true) {
            v.mTexX *= mTextureRectFront.right;
            v.mTexY *= mTextureRectFront.bottom;
            v.mColor = mTexturePage.getColor(CurlPage.SIDE_FRONT);
        } else {
            v.mTexX *= mTextureRectBack.right;
            v.mTexY *= mTextureRectBack.bottom;

            // Because front face and back face textures use the same coordinates,
            // back faced texture will be displayed flipped 180 degrees around Y axis.
            // To solve this design flaw, we have to flip the coordinates of the back side texture.
            // Eg: if textureWidth=1 then from texCoordX=0.2 we want texCoordX=0.8
            // so the formula for flipping coordinates is: mTexX = textureWidht - mtexX
            v.mTexX = mTextureRectBack.width() - v.mTexX;
            v.mColor = mTexturePage.getColor(CurlPage.SIDE_BACK);
        }

此外,您不再需要mFlipTexture。删除它并设置它并添加setTexCoords(0f,0f,1f,1f);在CurlMesh的构造函数结束时。

问题是什么?

0 个答案:

没有答案