Class PrefilteredEnvMapFaceGenerator

java.lang.Object
com.jme3.environment.generation.RunnableWithProgress
com.jme3.environment.generation.PrefilteredEnvMapFaceGenerator
All Implemented Interfaces:
Runnable

public class PrefilteredEnvMapFaceGenerator extends RunnableWithProgress
Generates one face of the prefiltered environment map for PBR. This job can be launched from a separate thread.

TODO there is a lot of duplicate code here with the EnvMapUtils.

  • Constructor Details

    • PrefilteredEnvMapFaceGenerator

      public PrefilteredEnvMapFaceGenerator(Application app, int face, JobProgressListener<Integer> listener)
      Creates a pem generator for the given face. The app is needed to enqueue the call to the EnvironmentCamera when the generation is done, so that this process is thread safe.
      Parameters:
      app - the Application
      face - the face to generate
      listener - to monitor progress (alias created)
  • Method Details

    • setGenerationParam

      public void setGenerationParam(TextureCubeMap sourceMap, int targetMapSize, EnvMapUtils.FixSeamsMethod fixSeamsMethod, EnvMapUtils.GenerationType genType, TextureCubeMap store)
      Fills all the generation parameters
      Parameters:
      sourceMap - the source cube map
      targetMapSize - the size of the generated map (width or height in pixel)
      fixSeamsMethod - the method used to fix seams as described in EnvMapUtils.FixSeamsMethod
      genType - select Fast or HighQuality
      store - The cube map to store the result in.
    • run

      public void run()
    • importanceSampleGGX

      public Vector3f importanceSampleGGX(Vector4f xi, float a2, Vector3f store)
      Computes GGX half vector in local space
      Parameters:
      xi - (not null)
      a2 - fourth power of roughness
      store - caller-provided storage
      Returns:
      either store or a new vector (not null)