Search in sources :

Example 11 with EdgeFilteringMode

use of com.jme3.shadow.EdgeFilteringMode in project jmonkeyengine by jMonkeyEngine.

the class AbstractShadowRendererVR method setShadowCompareMode.

/**
     * Sets the shadow compare mode. See {@link CompareMode} for more info.
     *
     * @param compareMode the desired compare mode (not null)
     */
public final void setShadowCompareMode(CompareMode compareMode) {
    if (compareMode == null) {
        throw new IllegalArgumentException("Shadow compare mode cannot be null");
    }
    this.shadowCompareMode = compareMode;
    for (Texture2D shadowMap : shadowMaps) {
        if (compareMode == CompareMode.Hardware) {
            shadowMap.setShadowCompareMode(ShadowCompareMode.LessOrEqual);
            if (edgeFilteringMode == EdgeFilteringMode.Bilinear) {
                shadowMap.setMagFilter(MagFilter.Bilinear);
                shadowMap.setMinFilter(MinFilter.BilinearNoMipMaps);
            } else {
                shadowMap.setMagFilter(MagFilter.Nearest);
                shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
            }
        } else {
            shadowMap.setShadowCompareMode(ShadowCompareMode.Off);
            shadowMap.setMagFilter(MagFilter.Nearest);
            shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
        }
    }
    postshadowMat.setBoolean("HardwareShadows", compareMode == CompareMode.Hardware);
}
Also used : Texture2D(com.jme3.texture.Texture2D)

Aggregations

Texture2D (com.jme3.texture.Texture2D)6 InputCapsule (com.jme3.export.InputCapsule)2 OutputCapsule (com.jme3.export.OutputCapsule)2 Material (com.jme3.material.Material)2 Matrix4f (com.jme3.math.Matrix4f)2 EdgeFilteringMode (com.jme3.shadow.EdgeFilteringMode)2 FrameBuffer (com.jme3.texture.FrameBuffer)2 ShadowCompareMode (com.jme3.texture.Texture.ShadowCompareMode)2 Picture (com.jme3.ui.Picture)2 CompareMode (com.jme3.shadow.CompareMode)1