public class Fogger extends Object
Various methods are provided to fog colours at a given Z coordinate.
For reasonable rendering, z
should be greater than
or equal to zero, and of order of this renderer's scale distance.
Instances of this class are not thread safe.
The fogging algorithm comes from Eric Dumont's fog FAQ.
Constructor and Description |
---|
Fogger(double scale)
Constructs a new depth tweaker for rendering distances of the order
of a given scale.
|
Modifier and Type | Method and Description |
---|---|
DataColorTweaker |
createTweaker(int ifog,
DataColorTweaker base)
Constructs a DataColorTweaker based on an existing one which appends
the affect of this fogger.
|
DataColorTweaker |
createTweaker(int ifog,
int ncoord)
Constructs a DataColorTweaker corresponding to this fogger which
just takes care of fogging.
|
Color |
fogAt(double z,
Color color)
Returns a fogged version of a given colour at a given depth.
|
void |
fogAt(double z,
float[] rgba)
Returns a fogged version of a given colour at a given depth
using normalised components.
|
int |
fogAt(double z,
int argb)
Returns a fogged version of a given colour at a given depth.
|
void |
fogAt(double z,
int[] rgba)
Returns a fogged version of a given colour at a given depth.
|
double |
getFogginess()
Returns the thickness of the fog.
|
double |
getScale()
Returns the depth scale distance.
|
void |
setFogginess(double fogginess)
Sets the thickness of the fog.
|
public Fogger(double scale)
scale
- depth scale distancepublic double getScale()
public void setFogginess(double fogginess)
fogginess
- intensity of fog per scale distancepublic double getFogginess()
public Color fogAt(double z, Color color)
z
- distance at which the colour is being viewedcolor
- original colourpublic void fogAt(double z, int[] rgba)
z
- distance at which the colour is being viewedrgba
- rgba colour components; these will be modified on
exit to represent the fogged valuepublic void fogAt(double z, float[] rgba)
z
- distance at which the colour is being viewedrgba
- normalised rgba colour components; these will
be modified on exit to represent the fogged valuepublic int fogAt(double z, int argb)
z
- distance at which the colour is being viewedpublic DataColorTweaker createTweaker(int ifog, int ncoord)
ifog
- index in coordinate array of Z coordinatencoord
- size of coordinate arraypublic DataColorTweaker createTweaker(int ifog, DataColorTweaker base)
ifog
- index in coordinate array of Z coordinatebase
- color tweaker to be additionally foggedCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.