Project

General

Profile

« Previous | Next » 

Revision c5b1451b

Added by Leszek Koltunski almost 8 years ago

Remove the 'invert' option from DistortedProjection - this was making the DistortedNode-based apps not show the Objects, because the winding of triangles was wrong.
Now however the DistortedNode based stuff is inverted top-down :)

View differences:

src/main/java/org/distorted/library/DistortedProjection.java
29 29
  {
30 30
  int width,height,depth,distance;
31 31
  float[] projectionMatrix;
32
  
33
  private boolean invert;  // invert top with bottom? We don't do that for the projection to the screen,
34
                           // but we need that for the projection to FBOs. (that's because each time we
35
                           // render to FBO we invert the texture upside down because its vertex coords
36
                           // are purposefully set upside down in DistortedBackground; so each time we
37
                           // render through FBO we need to invert it once more to counter this effect)
38 32

  
39 33
///////////////////////////////////////////////////////////////////////////////////////////////////
40 34
   
41
  public DistortedProjection(boolean inv) 
35
  public DistortedProjection()
42 36
   {
43
   invert = inv;  
44 37
   projectionMatrix = new float[16];   
45 38
   }
46 39

  
......
64 57
      distance = (int)(height*near/(top-bottom));
65 58
      far = 2*distance-near;
66 59
     
67
      if( invert ) Matrix.frustumM(projectionMatrix, 0, left, right, top, bottom, near, far);
68
      else         Matrix.frustumM(projectionMatrix, 0, left, right, bottom, top, near, far);        
60
      Matrix.frustumM(projectionMatrix, 0, left, right, bottom, top, near, far);
69 61
      }
70 62
    else                      // parallel projection
71 63
      {
......
73 65
      distance = (int)(height*near/(top-bottom));
74 66
      far = 2*distance-near;
75 67
    
76
      if( invert ) Matrix.orthoM(projectionMatrix, 0, -surfaceWidth/2, surfaceWidth/2, surfaceHeight/2,-surfaceHeight/2, near, far);
77
      else         Matrix.orthoM(projectionMatrix, 0, -surfaceWidth/2, surfaceWidth/2,-surfaceHeight/2, surfaceHeight/2, near, far);
68
      Matrix.orthoM(projectionMatrix, 0, -surfaceWidth/2, surfaceWidth/2,-surfaceHeight/2, surfaceHeight/2, near, far);
78 69
      }
79 70
   
80 71
    depth = (int)((far-near)/2);

Also available in: Unified diff