Project

General

Profile

« Previous | Next » 

Revision ed13a5de

Added by Leszek Koltunski over 7 years ago

Cleanup

View differences:

src/main/java/org/distorted/library/DistortedNode.java
48 48
    {
49 49
    long ID;
50 50
    int numPointingNodes;
51
    DistortedRenderTarget mDRT;
51
    DistortedFramebuffer mDF;
52 52
    boolean mRendered;
53 53

  
54 54
    NodeData(long id)
55 55
      {
56 56
      ID              = id;
57 57
      numPointingNodes= 1;
58
      mDRT            = null;
58
      mDF             = null;
59 59
      mRendered       = false;
60 60
      }
61 61
    }
......
82 82
  
83 83
///////////////////////////////////////////////////////////////////////////////////////////////////
84 84
  
85
  private void drawRecursive(long currTime, DistortedRenderTarget drt)
85
  private void drawRecursive(long currTime, DistortedFramebuffer df)
86 86
    {
87 87
    if( mNumChildren[0]<=0 )
88 88
      {
......
93 93
      if( mData.mRendered==false )
94 94
        {
95 95
        mData.mRendered = true;
96
        mData.mDRT.setOutput();
96
        mData.mDF.setOutput();
97 97

  
98 98
        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
99 99
        GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
......
101 101
        if( mObject.mBitmapSet[0] )
102 102
          {
103 103
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mObject.mTextureDataH[0]);
104
          mObject.drawNoEffectsPriv(mData.mDRT);
104
          mObject.drawNoEffectsPriv(mData.mDF);
105 105
          }
106 106
      
107 107
        synchronized(this)
108 108
          {
109 109
          for(int i=0; i<mNumChildren[0]; i++)
110 110
            {
111
            mChildren.get(i).drawRecursive(currTime, mData.mDRT);
111
            mChildren.get(i).drawRecursive(currTime, mData.mDF);
112 112
            }
113 113
          }
114 114
        }
115 115

  
116
      drt.setOutput();
117
      mData.mDRT.setInput();   // this is safe because we must have called createFBO() above before.
116
      df.setOutput();
117
      mData.mDF.setInput();   // this is safe because we must have called createFBO() above before.
118 118
      }
119 119
    
120
    mObject.drawPriv(currTime, drt);
120
    mObject.drawPriv(currTime, df);
121 121
    }
122 122
  
123 123
///////////////////////////////////////////////////////////////////////////////////////////////////
......
173 173
      if( otherNodesPoint )  mData = new NodeData(++mNextNodeID);
174 174
      else                   mData.ID = ++mNextNodeID;  // numPointingNodes must be 1 already
175 175

  
176
      if( newList.size()>1 && mData.mDRT==null )
177
        mData.mDRT = new DistortedRenderTarget(mObject.getWidth(), mObject.getHeight());
176
      if( newList.size()>1 && mData.mDF==null )
177
        mData.mDF = new DistortedFramebuffer(mObject.getWidth(), mObject.getHeight());
178 178

  
179 179
      mMapNodeID.put(newList, mData);
180 180
      }
......
197 197
      {
198 198
      tmp = mMapNodeID.get(key);
199 199
          
200
      if( tmp.mDRT != null )
200
      if( tmp.mDF != null )
201 201
        {
202
    	  tmp.mDRT.reset();
202
    	  tmp.mDF.reset();
203 203
        tmp.mRendered  = false;
204 204
        }
205 205
      }
......
445 445
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
446 446
    GLES20.glUniform1i(Distorted.mTextureUniformH, 0);  
447 447

  
448
    DistortedRenderTargetList.deleteAllMarked();
449

  
450 448
    markRecursive();
451
    drawRecursive(currTime,Distorted.mRenderTarget);
449
    drawRecursive(currTime,Distorted.mFramebuffer);
452 450
    }
453 451
 
454 452
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff