Project

General

Profile

« Previous | Next » 

Revision 644c21f2

Added by Leszek Koltunski over 4 years ago

Moving the Vertex and Fragment centers of effect to the center of the Mesh.

View differences:

src/main/java/org/distorted/library/effectqueue/EffectQueue.java
108 108

  
109 109
///////////////////////////////////////////////////////////////////////////////////////////////////
110 110

  
111
  public static void compute(EffectQueue[] queues, long currTime, float halfW, float halfH, float halfZ )
111
  public static void compute(EffectQueue[] queues, long currTime)
112 112
    {
113 113
    ((EffectQueueMatrix     )queues[0]).compute(currTime);
114
    ((EffectQueueVertex     )queues[1]).compute(currTime,halfW,halfH,halfZ);
115
    ((EffectQueueFragment   )queues[2]).compute(currTime,halfW,halfH,halfZ);
114
    ((EffectQueueVertex     )queues[1]).compute(currTime);
115
    ((EffectQueueFragment   )queues[2]).compute(currTime);
116 116
    ((EffectQueuePostprocess)queues[3]).compute(currTime);
117 117
    }
118 118

  
src/main/java/org/distorted/library/effectqueue/EffectQueueFragment.java
54 54

  
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
56 56
  
57
  void compute(long currTime,float halfX, float halfY, float halfZ)
57
  void compute(long currTime)
58 58
    { 
59 59
    if( currTime==mTime ) return;
60 60
    if( mTime==0 ) mTime = currTime;
......
68 68
        {
69 69
        EffectMessageSender.newMessage(mEffects[i]);
70 70
        }
71

  
72
      mUniforms[NUM_UNIFORMS*i+5] -= halfX;
73
      mUniforms[NUM_UNIFORMS*i+6] -= halfY;
74
      mUniforms[NUM_UNIFORMS*i+7] -= halfZ;
75 71
      }
76 72

  
77 73
    mTime = currTime;  
src/main/java/org/distorted/library/effectqueue/EffectQueueVertex.java
56 56

  
57 57
///////////////////////////////////////////////////////////////////////////////////////////////////
58 58
  
59
  void compute(long currTime,float halfX, float halfY, float halfZ)
59
  void compute(long currTime)
60 60
    {
61 61
    if( currTime==mTime ) return;
62 62
    if( mTime==0 ) mTime = currTime;
......
70 70
        {
71 71
        EffectMessageSender.newMessage(mEffects[i]);
72 72
        }
73

  
74
      mUniforms[NUM_UNIFORMS*i+5] -= halfX;
75
      mUniforms[NUM_UNIFORMS*i+6] -= halfY;
76
      mUniforms[NUM_UNIFORMS*i+7] -= halfZ;
77 73
      }
78 74

  
79 75
    mTime = currTime;
src/main/java/org/distorted/library/main/DistortedLibrary.java
430 430

  
431 431
  static void drawPrivOIT(DistortedEffects effects, MeshBase mesh, InternalOutputSurface surface, long currTime)
432 432
    {
433
    float halfX = mesh.getStretchX() / 2.0f;
434
    float halfY = mesh.getStretchY() / 2.0f;
435
    float halfZ = mesh.getStretchZ() / 2.0f;
436

  
437 433
    EffectQueue[] queues = effects.getQueues();
438 434

  
439
    EffectQueue.compute(queues, currTime, halfX, halfY, halfZ );
435
    EffectQueue.compute(queues, currTime);
440 436
    GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight );
441 437

  
442 438
    DistortedLibrary.mMainOITProgram.useProgram();
......
445 441
    GLES31.glUniform1ui(DistortedLibrary.mMainOITNumRecordsH, (int)(DistortedLibrary.mBufferSize*surface.mWidth*surface.mHeight) );
446 442
    mesh.bindVertexAttribs(DistortedLibrary.mMainOITProgram);
447 443

  
444
    float halfX       = mesh.getStretchX() / 2.0f;
445
    float halfY       = mesh.getStretchY() / 2.0f;
446
    float halfZ       = mesh.getStretchZ() / 2.0f;
448 447
    float inflate     = mesh.getInflate();
449 448
    int width         = surface.mWidth;
450 449
    int height        = surface.mHeight;
......
467 466

  
468 467
  static void drawPriv(DistortedEffects effects, MeshBase mesh, InternalOutputSurface surface, long currTime)
469 468
    {
470
    float halfX = mesh.getStretchX() / 2.0f;
471
    float halfY = mesh.getStretchY() / 2.0f;
472
    float halfZ = mesh.getStretchZ() / 2.0f;
473

  
474 469
    EffectQueue[] queues = effects.getQueues();
475 470

  
476
    EffectQueue.compute(queues, currTime, halfX, halfY, halfZ );
471
    EffectQueue.compute(queues, currTime);
477 472
    GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight );
478 473

  
479 474
    DistortedLibrary.mMainProgram.useProgram();
480 475
    GLES31.glUniform1i(DistortedLibrary.mMainTextureH, 0);
481 476
    mesh.bindVertexAttribs(DistortedLibrary.mMainProgram);
482 477

  
478
    float halfX       = mesh.getStretchX() / 2.0f;
479
    float halfY       = mesh.getStretchY() / 2.0f;
480
    float halfZ       = mesh.getStretchZ() / 2.0f;
483 481
    float inflate     = mesh.getInflate();
484 482
    int width         = surface.mWidth;
485 483
    int height        = surface.mHeight;

Also available in: Unified diff