Project

General

Profile

« Previous | Next » 

Revision f89f791a

Added by Leszek Koltunski about 7 years ago

Preliminary support for MIPMAP levels of the postprocessing buffers. (doesn't work yet)

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
27 27

  
28 28
abstract class DistortedOutputSurface extends DistortedSurface implements DistortedSlave
29 29
{
30
  private static final int NUM_MIPMAP = 4;
31
          static final int CUR_MIPMAP = 1;
32

  
30 33
  private static final int ATTACH = 0;
31 34
  private static final int DETACH = 1;
32 35
  private static final int DETALL = 2;
......
51 54

  
52 55
  private ArrayList<Job> mJobs = new ArrayList<>();
53 56

  
54
  DistortedFramebuffer mBuffer1, mBuffer2;
57
  DistortedFramebuffer[] mBuffer1, mBuffer2;
55 58

  
56 59
  private long mTime;
57 60
  private float mFOV;
......
95 98

  
96 99
    mClearDepth = 1.0f;
97 100

  
101
    mBuffer1 = new DistortedFramebuffer[NUM_MIPMAP];
102
    mBuffer2 = new DistortedFramebuffer[NUM_MIPMAP];
103

  
98 104
    createProjection();
99 105
    }
100 106

  
......
171 177
        }
172 178
      else
173 179
        {
174
        if( mBuffer1==null )
180
        if( mBuffer1[0]==null )
175 181
          {
176
          mBuffer1 = new DistortedFramebuffer(mDepthCreated!=DONT_CREATE, DistortedSurface.TYPE_SYST, mWidth, mHeight);
177
          mBuffer2 = new DistortedFramebuffer(false                     , DistortedSurface.TYPE_SYST, mWidth, mHeight);
182
          int sizeX = mWidth;
183
          int sizeY = mHeight;
184

  
185
          for(int j=0; j<NUM_MIPMAP; j++)
186
            {
187
            mBuffer1[j] = new DistortedFramebuffer(mDepthCreated!=DONT_CREATE, DistortedSurface.TYPE_SYST, sizeX, sizeY);
188
            mBuffer2[j] = new DistortedFramebuffer(false                     , DistortedSurface.TYPE_SYST, sizeX, sizeY);
189

  
190
            sizeX *= 0.9f;
191
            sizeY *= 0.9f;
192
            }
178 193
          }
179 194

  
180
        numRenders += child.draw(time,mBuffer1);
195
        numRenders += child.draw(time,mBuffer1[CUR_MIPMAP]);
181 196
        if( i==num-1 )
182 197
          {
183 198
          numRenders += currP.postprocess(time,this);

Also available in: Unified diff