3Dickulus / FragM

Derived from https://github.com/Syntopia/Fragmentarium/
GNU General Public License v3.0
349 stars 30 forks source link

broken dynamic-precision Camera2D in Trudy #101

Closed claudeha closed 4 years ago

claudeha commented 4 years ago

Describe the bug 88824f6c5a3da50896ec63eb68617f4a32430e49 broke dynamic-precision Camera2D in Trudy (depending on #version).

To Reproduce Steps to reproduce the behavior:

  1. git clone https://code.mathr.co.uk/trudy.git
  2. Add /path/to/trudy/include to the FragM include paths in the prefs
  3. While there, set travelling mode for 2D Camera
  4. Open /path/to/trudy/examples/MuET.frag
  5. Observe the bug that mouse-wheel zooming doesn't travel, though sliders are updated.

Expected behavior Center changes update the image appearance

Desktop (please complete the following information):

Additional context It worked fine with the previous commit. Trudy does do this for the Center uniform:

#if __VERSION__ >= 400
uniform dvec2 Center; slider[(-100,-100),(0,0),(100,100)] NotLockable
#else
uniform vec2 Center; slider[(-100,-100),(0,0),(100,100)] NotLockable
#endif

which I suspect may be too clever. It worked before though, so hopefully there is a way to keep it working? What bug was the commit intending to fix?

3Dickulus commented 4 years ago

the glsl code you present for Center looks fine ??? I would expect that to work.

chasing a bug, just making sure it's not the test should not interfere with valid code operation

88824f6 should look like this, using continue instead of if/else

void DisplayWidget::setShaderUniforms(QOpenGLShaderProgram *shaderProg)
{
         ...        
        checkForSpecialCase(name, uniformValue);
        if(uniformValue.contains("variable")) continue;

            // find a value to go with the name, index in the program, may not be the same as index in our list
            for( int n=0; n < vw.count(); n++) {
               ...
            }

        if(uniformValue.isEmpty()) {
            uniformValue = "Unused variable";
            continue;
        }

        QString tp = "";
        ...
}

will test trudy asap ;)

3Dickulus commented 4 years ago

the glsl code you present for Center looks fine ??? I would expect that to work.

chasing a bug, just making sure it's not the test

should not interfere with valid code operation

88824f6 should look like this, using continue instead of if/else

void DisplayWidget::setShaderUniforms(QOpenGLShaderProgram *shaderProg)
{
         ...        
        checkForSpecialCase(name, uniformValue);
        if(uniformValue.contains("variable")) continue;

            // find a value to go with the name, index in the program, may not be the same as index in our list
            for( int n=0; n < vw.count(); n++) {
               ...
            }

        if(uniformValue.isEmpty()) {
            uniformValue = "Unused variable";
            continue;
        }

        QString tp = "";
        ...
}

will test trudy asap ;) oops didn't click Comment!... so...

testing with the above continue code it seems to work fine Screenshot_20191127_162438