Project

General

Profile

« Previous | Next » 

Revision 78db8663

Added by Leszek Koltunski about 7 years ago

Beginning of work on Mipmap levels.

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 = 0;
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;
......
67 70

  
68 71
//private String sNew="", sOld="";
69 72

  
73
  float mMipmap;
74

  
70 75
///////////////////////////////////////////////////////////////////////////////////////////////////
71 76

  
72 77
  DistortedOutputSurface(int width, int height, int createColor, int createDepth, int fbo, int type)
......
94 99

  
95 100
    mClearDepth = 1.0f;
96 101

  
102
    mBuffer1 = new DistortedFramebuffer[NUM_MIPMAP];
103
    mBuffer2 = new DistortedFramebuffer[NUM_MIPMAP];
104
    mMipmap = 1.0f;
105

  
97 106
    createProjection();
98 107
    }
99 108

  
......
168 177
        }
169 178
      else
170 179
        {
171
        if( mBuffer1==null )
180
        if( mBuffer1[0]==null )
172 181
          {
173
          mBuffer1 = new DistortedFramebuffer(mDepthCreated!=DONT_CREATE, DistortedSurface.TYPE_SYST, mWidth, mHeight);
174
          mBuffer2 = new DistortedFramebuffer(false                     , DistortedSurface.TYPE_SYST, mWidth, mHeight);
182
          float mipmap=1.0f;
183

  
184
          for(int j=0; j<NUM_MIPMAP; j++)
185
            {
186
            mBuffer1[j] = new DistortedFramebuffer( mDepthCreated!=DONT_CREATE, DistortedSurface.TYPE_SYST,
187
                                                    (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
188
            mBuffer2[j] = new DistortedFramebuffer(false                     , DistortedSurface.TYPE_SYST,
189
                                                    (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
190
            mBuffer1[j].mMipmap = mipmap;
191
            mipmap *= 0.5f;
192
            }
175 193
          DistortedSurface.toDo();  // create immediately
176 194
          }
177 195

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

Also available in: Unified diff