Project

General

Profile

« Previous | Next » 

Revision c90aca24

Added by Leszek Koltunski about 4 years ago

Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)

View differences:

src/main/java/org/distorted/library/main/DistortedLibrary.java
428 428

  
429 429
///////////////////////////////////////////////////////////////////////////////////////////////////
430 430

  
431
  static void drawPrivOIT(EffectQueue[] queues, float halfW, float halfH, MeshBase mesh, InternalOutputSurface surface, long currTime)
431
  static void drawPrivOIT(DistortedEffects effects, MeshBase mesh, InternalOutputSurface surface, long currTime)
432 432
    {
433
    float halfZ = halfW*mesh.getZFactor();
433
    float halfX = effects.getStartchX() / 2.0f;
434
    float halfY = effects.getStartchY() / 2.0f;
435
    float halfZ = effects.getStartchZ() / 2.0f;
434 436

  
435
    EffectQueue.compute(queues, currTime, halfW, halfH, halfZ );
437
    EffectQueue[] queues = effects.getQueues();
438

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

  
438 442
    DistortedLibrary.mMainOITProgram.useProgram();
......
448 452
    float mipmap      = surface.mMipmap;
449 453
    float[] projection= surface.mProjectionMatrix;
450 454

  
451
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfW, halfH, halfZ, 1 );
455
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 1 );
452 456
    GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
453 457

  
454 458
    if( mesh.getShowNormals() )
455 459
      {
456 460
      DistortedLibrary.mMainProgram.useProgram();
457
      EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfW, halfH, halfZ, 0 );
461
      EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
458 462
      displayNormals(queues,mesh);
459 463
      }
460 464
    }
461 465

  
462 466
///////////////////////////////////////////////////////////////////////////////////////////////////
463 467

  
464
  static void drawPriv(EffectQueue[] queues, float halfW, float halfH, MeshBase mesh, InternalOutputSurface surface, long currTime)
468
  static void drawPriv(DistortedEffects effects, MeshBase mesh, InternalOutputSurface surface, long currTime)
465 469
    {
466
    float halfZ = halfW*mesh.getZFactor();
470
    float halfX = effects.getStartchX() / 2.0f;
471
    float halfY = effects.getStartchY() / 2.0f;
472
    float halfZ = effects.getStartchZ() / 2.0f;
473

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

  
468
    EffectQueue.compute(queues, currTime, halfW, halfH, halfZ );
476
    EffectQueue.compute(queues, currTime, halfX, halfY, halfZ );
469 477
    GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight );
470 478

  
471 479
    DistortedLibrary.mMainProgram.useProgram();
......
479 487
    float mipmap      = surface.mMipmap;
480 488
    float[] projection= surface.mProjectionMatrix;
481 489

  
482
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfW, halfH, halfZ, 0 );
490
    EffectQueue.send(queues, width, height, distance, mipmap, projection, inflate, halfX, halfY, halfZ, 0 );
483 491
    GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
484 492

  
485 493
    if( mesh.getShowNormals() ) displayNormals(queues,mesh);

Also available in: Unified diff