fynv / nvidia-texture-tools

Automatically exported from code.google.com/p/nvidia-texture-tools
Other
0 stars 0 forks source link

scaleAlphaToCoverage logic is reversed #159

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The code:
        if (currentCoverage > desiredCoverage) {
            maxAlphaRef = midAlphaRef;
        }
        else if (currentCoverage < desiredCoverage) {
            minAlphaRef = midAlphaRef;
        }

should be:

        if (currentCoverage < desiredCoverage) {
            maxAlphaRef = midAlphaRef;
        }
        else if (currentCoverage > desiredCoverage) {
            minAlphaRef = midAlphaRef;
        }

As if the test coverage is less than the required coverage, you need to 
decrease the reference value on the next iteration. (as alphaTestCoverage is 
based on greater than reference value)

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.

Original issue reported on code.google.com by dtrebi...@gmail.com on 25 Feb 2011 at 4:15

GoogleCodeExporter commented 9 years ago
Well, the code is:

        if (currentCoverage > desiredCoverage) {
            minAlphaRef = midAlphaRef;
        }
        else if (currentCoverage < desiredCoverage) {
            maxAlphaRef = midAlphaRef;
        }

And that's equivalent to what you wrote. See: 

http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/src/nvimage/Fl
oatImage.cpp#1015

Original comment by cast...@gmail.com on 25 Feb 2011 at 5:46

GoogleCodeExporter commented 9 years ago
Oh sorry, I had taken the code originally from a revision before you fixed it 
in r1102.
(and looking at the latest I did not see that the min/max had been swapped)

Original comment by dtrebi...@gmail.com on 25 Feb 2011 at 5:56

GoogleCodeExporter commented 9 years ago
Cool, closing then. :)

Original comment by cast...@gmail.com on 25 Feb 2011 at 6:26