Example #1
0
  /**
   * Initializes the internal references to Materials assets.
   *
   * <p>Must be called at least once before the PostProcessor instance is in use. Failure to do so
   * will result in NullPointerExceptions. Calling it additional times shouldn't hurt but shouldn't
   * be necessary either: the asset system refreshes the assets behind the scenes if necessary.
   */
  public void initializeMaterials() {
    // initial renderings
    materials.lightBufferPass = getMaterial("engine:prog.lightBufferPass");

    // pre-post composite
    materials.outline = getMaterial("engine:prog.sobel");
    materials.ssao = getMaterial("engine:prog.ssao");
    materials.ssaoBlurred = getMaterial("engine:prog.ssaoBlur");
    materials.prePostComposite = getMaterial("engine:prog.combine");

    // initial post-processing
    materials.lightShafts =
        getMaterial("engine:prog.lightshaft"); // TODO: rename shader to lightShafts
    materials.initialPost =
        getMaterial("engine:prog.prePost"); // TODO: rename shader to initialPost
    materials.downSampler = getMaterial("engine:prog.down"); // TODO: rename shader to downSampler
    materials.highPass = getMaterial("engine:prog.highp"); // TODO: rename shader to highPass
    materials.blur = getMaterial("engine:prog.blur");
    materials.toneMapping = getMaterial("engine:prog.hdr"); // TODO: rename shader to toneMapping

    // final post-processing
    materials.ocDistortion = getMaterial("engine:prog.ocDistortion");
    materials.finalPost = getMaterial("engine:prog.post"); // TODO: rename shader to finalPost
    materials.debug = getMaterial("engine:prog.debug");
  }