Project

General

Profile

« Previous | Next » 

Revision b9798977

Added by Leszek Koltunski about 7 years ago

Advances in Multiblur - breaks BLUR for now.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
39 39
  int[] mDepthH = new int[1];
40 40
  int[] mFBOH   = new int[1];
41 41

  
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

  
44
  abstract DistortedFramebuffer getBuffer();
45

  
42 46
///////////////////////////////////////////////////////////////////////////////////////////////////
43 47

  
44 48
  DistortedOutputSurface(int width, int height, int createColor, int createDepth, int fbo, int type)
......
105 109
  int renderChildren(long time, int num, ArrayList<DistortedNode> children)
106 110
    {
107 111
    int numRenders = 0;
112
    DistortedNode child;
113
    DistortedFramebuffer fbo;
114
    DistortedOutputSurface buffer;
115

  
116
    // 1. Render all children that have postprocessing effects to their own buffer FBOs
108 117

  
109 118
    for(int i=0; i<num; i++)
110 119
      {
111
      numRenders += children.get(i).draw(time,this);
120
      child = children.get(i);
121
      fbo   = child.getPostprocessingBuffer();
122

  
123
      if( fbo!=null )
124
        {
125
        fbo.resizeFast(mWidth,mHeight);
126
        numRenders += child.draw(time,fbo);
127
        }
128
      }
129

  
130
    // 2. If we have rendered anything so far, and we are a Screen, then render to an
131
    //    intermediate FBO instead.
132

  
133
    buffer = numRenders>0 ? getBuffer() : this;
134

  
135
    // 3. Render all children without postprocessing effects to buffer
136

  
137
    for(int i=0; i<num; i++)
138
      {
139
      child = children.get(i);
140
      fbo   = child.getPostprocessingBuffer();
141

  
142
      if( fbo==null )
143
        {
144
        numRenders += child.draw(time,buffer);
145
        }
146
      }
147

  
148
    // 4. For all postprocessing fbo,
149
    //       postprocess fbo
150
    //       merge to buffer
151

  
152
    // TODO
153

  
154
    // 5. finally blit to this if we have to
155

  
156
    if( buffer!=this && ((DistortedFramebuffer)buffer).setAsInput() )
157
      {
158
      numRenders++;
159
      DistortedEffects.blitPriv(this);
112 160
      }
113 161

  
114 162
    return numRenders;

Also available in: Unified diff