Package com.jme3.post.filters
Class ContrastAdjustmentFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.post.filters.ContrastAdjustmentFilter
- All Implemented Interfaces:
- Savable
A filter to adjust the colors of a rendered scene by normalizing each color channel to a specified range,
 applying a power law, and scaling the output. The alpha channel is unaffected.
- 
Nested Class SummaryNested classes/interfaces inherited from class com.jme3.post.FilterFilter.Pass
- 
Field SummaryFields inherited from class com.jme3.post.FilterdefaultPass, enabled, material, postRenderPasses, processor
- 
Constructor SummaryConstructorsConstructorDescriptionInstantiates a contrast-adjustment filter with the default parameters:ContrastAdjustmentFilter(float exponent) Instantiates a contrast-adjustment filter with the default input range and output scaling.
- 
Method SummaryModifier and TypeMethodDescriptionfloatRetrieves the blue-channel exponent.floatRetrieves the output scale factor for the blue channel.floatRetrieves the green-channel exponent.floatRetrieves the output scale factor for the green channel.floatReturns the lower limit of the input range.protected MaterialReturns the Material used in this Filter.floatRetrieves the red-channel exponent.floatRetrieves the output scale factor for the red channel.floatReturns the upper limit of the input range.protected voidinitFilter(AssetManager assetManager, RenderManager renderManager, ViewPort viewPort, int width, int height) Initializes the Filter when it is added to a FilterPostProcessor.voidread(JmeImporter im) De-serializes this filter, for example when loading from a J3O file.setBlueExponent(float exponent) Sets the power-law exponent for the blue channel.setBlueScale(float factor) Sets the output scale factor for the blue channel.setExponents(float redExponent, float greenExponent, float blueExponent) Sets the power-law exponent for each color channel.setGreenExponent(float exponent) Sets the power-law exponent for the green channel.setGreenScale(float factor) Sets the output scale factor for the green channel.setInputRange(float lowerLimit, float upperLimit) Sets the input range for each color channel.setLowerLimit(float level) Sets the lower limit of the input range.setRedExponent(float exponent) Sets the power-law exponent for the red channel.setRedScale(float factor) Sets the output scale factor for the red channel.setScales(float redScale, float greenScale, float blueScale) Adjusts the output scaling for each color channel.setUpperLimit(float level) Sets the upper limit of the input range.toString()Represent this Filter as a String.voidwrite(JmeExporter ex) Serializes this filter, for example when saving to a J3O file.Methods inherited from class com.jme3.post.Filtercleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresDepthTexture, isRequiresSceneTexture, postFilter, postFrame, postQueue, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
- 
Constructor Details- 
ContrastAdjustmentFilterpublic ContrastAdjustmentFilter()Instantiates a contrast-adjustment filter with the default parameters:input range from 0 to 1 power-law exponent=1 for all color channels output scale factor=1 for all color channels Such a filter has no effect. 
- 
ContrastAdjustmentFilterpublic ContrastAdjustmentFilter(float exponent) Instantiates a contrast-adjustment filter with the default input range and output scaling.- Parameters:
- exponent- the desired power-law exponent for all color channels
 
 
- 
- 
Method Details- 
setExponentspublic ContrastAdjustmentFilter setExponents(float redExponent, float greenExponent, float blueExponent) Sets the power-law exponent for each color channel. The default value for each exponent is 1, which produces a linear filter.- Parameters:
- redExponent- the desired red-channel exponent
- greenExponent- the desired green-channel exponent
- blueExponent- the desired blue-channel exponent
- Returns:
- this filter instance, for chaining
 
- 
setRedExponentSets the power-law exponent for the red channel.- Parameters:
- exponent- the desired exponent (default=1 for linear)
- Returns:
- this filter instance, for chaining
 
- 
setGreenExponentSets the power-law exponent for the green channel.- Parameters:
- exponent- the desired exponent (default=1 for linear)
- Returns:
- this filter instance, for chaining
 
- 
setBlueExponentSets the power-law exponent for the blue channel.- Parameters:
- exponent- the desired exponent (default=1 for linear)
- Returns:
- this filter instance, for chaining
 
- 
getRedExponentpublic float getRedExponent()Retrieves the red-channel exponent.- Returns:
- the power-law exponent (default=1 for linear)
 
- 
getGreenExponentpublic float getGreenExponent()Retrieves the green-channel exponent.- Returns:
- the power-law exponent (default=1 for linear)
 
- 
getBlueExponentpublic float getBlueExponent()Retrieves the blue-channel exponent.- Returns:
- the power-law exponent (default=1 for linear)
 
- 
setInputRangeSets the input range for each color channel.Before applying the power law, the input levels get normalized: lowerLimit and below normalize to 0 and upperLimit normalizes to 1. - Parameters:
- lowerLimit- the desired lower limit (default=0)
- upperLimit- the desired upper limit (default=1)
- Returns:
- this filter instance, for chaining
 
- 
setUpperLimitSets the upper limit of the input range.- Parameters:
- level- the input level that should be normalized to 1 (default=1)
- Returns:
- this filter instance, for chaining
 
- 
setLowerLimitSets the lower limit of the input range.- Parameters:
- level- the highest input level that should be normalized to 0 (default=0)
- Returns:
- this filter instance, for chaining
 
- 
getLowerLimitpublic float getLowerLimit()Returns the lower limit of the input range.- Returns:
- the input level (default=0)
 
- 
getUpperLimitpublic float getUpperLimit()Returns the upper limit of the input range.- Returns:
- the input level (default=1)
 
- 
setScalesAdjusts the output scaling for each color channel. The default for each scale factor is 1, which has no effect.- Parameters:
- redScale- the red-channel scale factor
- greenScale- the green-channel scale factor
- blueScale- the blue-channel scale factor
- Returns:
- this filter instance, for chaining
 
- 
setRedScaleSets the output scale factor for the red channel.- Parameters:
- factor- the desired scale factor (default=1)
- Returns:
- this filter instance, for chaining
 
- 
setGreenScaleSets the output scale factor for the green channel.- Parameters:
- factor- the desired scale factor (default=1)
- Returns:
- this filter instance, for chaining
 
- 
setBlueScaleSets the output scale factor for the blue channel.- Parameters:
- factor- the desired scale factor (default=1)
- Returns:
- this filter instance, for chaining
 
- 
getRedScalepublic float getRedScale()Retrieves the output scale factor for the red channel.- Returns:
- the scale factor (default=1 for no effect)
 
- 
getGreenScalepublic float getGreenScale()Retrieves the output scale factor for the green channel.- Returns:
- the scale factor (default=1 for no effect)
 
- 
getBlueScalepublic float getBlueScale()Retrieves the output scale factor for the blue channel.- Returns:
- the scale factor (default=1 for no effect)
 
- 
initFilterprotected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort viewPort, int width, int height) Initializes the Filter when it is added to a FilterPostProcessor.- Specified by:
- initFilterin class- Filter
- Parameters:
- assetManager- for loading assets (not null)
- renderManager- unused
- viewPort- unused
- width- unused
- height- unused
 
- 
getMaterialReturns the Material used in this Filter. This method is invoked on every frame.- Specified by:
- getMaterialin class- Filter
- Returns:
- the pre-existing instance, or null if the Filter hasn't been initialized
 
- 
readDe-serializes this filter, for example when loading from a J3O file.- Specified by:
- readin interface- Savable
- Overrides:
- readin class- Filter
- Parameters:
- im- the importer to use (not null)
- Throws:
- IOException- from the importer
 
- 
writeSerializes this filter, for example when saving to a J3O file.- Specified by:
- writein interface- Savable
- Overrides:
- writein class- Filter
- Parameters:
- ex- the exporter to use (not null)
- Throws:
- IOException- from the exporter
 
- 
toStringRepresent this Filter as a String.
 
-