Project

General

Profile

« Previous | Next » 

Revision 4bb94a7d

Added by Leszek Koltunski about 4 years ago

Hide the InternalSurface class inside its package.

View differences:

src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java
33 33
import org.distorted.library.main.DistortedNode;
34 34
import org.distorted.library.main.InternalOutputSurface;
35 35
import org.distorted.library.main.InternalRenderState;
36
import org.distorted.library.main.InternalSurface;
37 36
import org.distorted.library.mesh.MeshBase;
38 37
import org.distorted.library.message.EffectMessageSender;
39 38
import org.distorted.library.program.DistortedProgram;
......
159 158

  
160 159
  public int preprocess(InternalOutputSurface buffer, DistortedNode node, float distance, float mipmap, float[] projection)
161 160
    {
162
    buffer.setAsOutput();
163
    InternalSurface input = node.getSurface();
161
    MeshBase mesh = node.getMesh();
162
    DistortedEffects effects = node.getEffects();
164 163

  
165
    if( input.setAsInput() )
166
      {
167
      MeshBase mesh = node.getMesh();
168
      DistortedEffects effects = node.getEffects();
169

  
170
      float halfW = mesh.getStretchX() / 2.0f;
171
      float halfH = mesh.getStretchY() / 2.0f;
172
      float halfZ = mesh.getStretchZ() / 2.0f;
164
    float halfW = mesh.getStretchX() / 2.0f;
165
    float halfH = mesh.getStretchY() / 2.0f;
166
    float halfZ = mesh.getStretchZ() / 2.0f;
173 167

  
174
      int width   = buffer.getWidth();
175
      int height  = buffer.getHeight();
168
    int width   = buffer.getWidth();
169
    int height  = buffer.getHeight();
176 170

  
177
      InternalRenderState.setUpStencilMark(mA!=0.0f);
178
      InternalRenderState.disableBlending();
171
    InternalRenderState.setUpStencilMark(mA!=0.0f);
172
    InternalRenderState.disableBlending();
179 173

  
180
      GLES31.glViewport(0, 0, width, height );
174
    GLES31.glViewport(0, 0, width, height );
181 175

  
182
      mPreProgram.useProgram();
176
    mPreProgram.useProgram();
183 177

  
184
      mesh.bindVertexAttribs(mPreProgram);
178
    mesh.bindVertexAttribs(mPreProgram);
185 179

  
186
      EffectQueue[] queues = effects.getQueues();
187
      EffectQueueMatrix matrix = (EffectQueueMatrix)queues[0];
188
      EffectQueueVertex vertex = (EffectQueueVertex)queues[1];
180
    EffectQueue[] queues = effects.getQueues();
181
    EffectQueueMatrix matrix = (EffectQueueMatrix)queues[0];
182
    EffectQueueVertex vertex = (EffectQueueVertex)queues[1];
189 183

  
190
      float inflate=0.0f;
184
    float inflate=0.0f;
191 185

  
192
      matrix.send(distance, mipmap, projection, halfW, halfH, halfZ, 2);
186
    matrix.send(distance, mipmap, projection, halfW, halfH, halfZ, 2);
193 187

  
194
      if( mHalo!=0.0f )
195
        {
196
        inflate = matrix.magnify(projection, width, height, mipmap, halfW, halfH, halfZ, mHalo);
197
        }
188
    if( mHalo!=0.0f )
189
      {
190
      inflate = matrix.magnify(projection, width, height, mipmap, halfW, halfH, halfZ, mHalo);
191
      }
198 192

  
199
      vertex.send(inflate,2);
193
    vertex.send(inflate,2);
200 194

  
201
      if( mA!=0.0f )
202
        {
203
        GLES31.glUniform4f(mPreColorH, mR, mG, mB, mA);
204
        GLES31.glUniform1i(mPreTextureH, 0);
205
        }
195
    if( mA!=0.0f )
196
      {
197
      GLES31.glUniform4f(mPreColorH, mR, mG, mB, mA);
198
      GLES31.glUniform1i(mPreTextureH, 0);
199
      }
206 200

  
207
      GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
201
    GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
208 202

  
209
      InternalRenderState.restoreBlending();
210
      InternalRenderState.unsetUpStencilMark();
203
    InternalRenderState.restoreBlending();
204
    InternalRenderState.unsetUpStencilMark();
211 205

  
212
      return 1;
213
      }
214
    return 0;
206
    return 1;
215 207
    }
216 208

  
217 209
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff