public class WaterFilter
extends com.jme3.post.Filter
implements com.jme3.util.clone.JmeCloneable, java.lang.Cloneable
| Modifier and Type | Class and Description |
|---|---|
static class |
WaterFilter.AreaShape |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_CAUSTICS |
static java.lang.String |
DEFAULT_FOAM |
static java.lang.String |
DEFAULT_HEIGHT_MAP |
static java.lang.String |
DEFAULT_NORMAL_MAP |
protected com.jme3.scene.Spatial |
reflectionScene |
protected com.jme3.renderer.ViewPort |
reflectionView |
protected com.jme3.scene.Spatial |
rootScene |
| Constructor and Description |
|---|
WaterFilter()
Create a Water Filter
|
WaterFilter(com.jme3.scene.Node reflectionScene,
com.jme3.math.Vector3f lightDirection) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanUpFilter(com.jme3.renderer.Renderer r) |
void |
cloneFields(com.jme3.util.clone.Cloner cloner,
java.lang.Object original) |
float |
getCausticsIntensity()
get the intensity of caustics under water
|
com.jme3.texture.Texture2D |
getCausticsTexture()
Gets the texture which is used to render caustics on the ground underwater.
|
com.jme3.math.Vector3f |
getCenter()
returns the center of this effect
|
com.jme3.math.Vector3f |
getColorExtinction()
Returns the color extinction vector of the water
|
com.jme3.math.ColorRGBA |
getDeepWaterColor()
returns the deep water color
|
com.jme3.math.Vector3f |
getFoamExistence()
returns the foam existence vector
|
float |
getFoamHardness()
returns the foam hardness
|
float |
getFoamIntensity()
returns the foam intensity
|
com.jme3.texture.Texture2D |
getFoamTexture()
Gets the foam texture.
|
com.jme3.texture.Texture2D |
getHeightTexture()
Gets the height texture.
|
com.jme3.math.ColorRGBA |
getLightColor()
returns the light color
|
com.jme3.math.Vector3f |
getLightDirection()
gets the light direction
|
protected com.jme3.material.Material |
getMaterial() |
float |
getMaxAmplitude()
return the maximum wave amplitude
|
float |
getNormalScale()
Returns the normal scales applied to the normal map
|
com.jme3.texture.Texture2D |
getNormalTexture()
Gets the normal texture.
|
float |
getRadius()
returns the radius of this effect
|
float |
getReflectionDisplace()
returns the reflection displace
see
setReflectionDisplace(float) |
int |
getReflectionMapSize()
returns the size of the reflection map
|
com.jme3.scene.Spatial |
getReflectionScene()
Gets the scene which is used to render in the reflection map.
|
float |
getRefractionConstant()
returns the refraction constant
|
float |
getRefractionStrength()
returns the refractionStrength
|
WaterFilter.AreaShape |
getShapeType()
returns the shape of the water area
|
float |
getShininess()
return the shininess factor of the water
|
float |
getShoreHardness()
Return the shore hardness.
|
float |
getSpeed()
returns the speed of the waves
|
float |
getSunScale()
gets the scale of the sun
|
float |
getUnderWaterFogDistance()
returns the distance of the fog when under water
|
com.jme3.math.ColorRGBA |
getWaterColor()
returns the color of the water
|
float |
getWaterHeight()
gets the height of the water plane
|
float |
getWaterTransparency()
returns the waterTransparency value
|
float |
getWaveScale()
returns the scale factor of the waves height map
|
com.jme3.math.Vector2f |
getWindDirection()
returns the wind direction
|
protected void |
initFilter(com.jme3.asset.AssetManager manager,
com.jme3.renderer.RenderManager renderManager,
com.jme3.renderer.ViewPort vp,
int w,
int h) |
boolean |
isNeedSaveReflectionScene() |
protected boolean |
isRequiresDepthTexture() |
boolean |
isUnderWater()
Whether or not the camera is under the water level
|
boolean |
isUseCaustics()
Whether or not caustics are rendered
|
boolean |
isUseFoam()
Whether or not the water uses foam
|
boolean |
isUseHQShoreline()
Whether or not the shader is set to use high-quality shoreline.
|
boolean |
isUseRefraction()
Whether or not the water uses the refraction
|
boolean |
isUseRipples()
Whether or not the water uses ripples
|
boolean |
isUseSpecular()
Whether or not the water is using specular
|
java.lang.Object |
jmeClone() |
protected void |
preFrame(float tpf) |
void |
read(com.jme3.export.JmeImporter im) |
void |
setCausticsIntensity(float causticsIntensity)
sets the intensity of caustics under water.
|
void |
setCausticsTexture(com.jme3.texture.Texture2D causticsTexture)
Sets the texture to use to render caustics on the ground underwater.
|
void |
setCenter(com.jme3.math.Vector3f center)
Set the center of the effect.
|
void |
setColorExtinction(com.jme3.math.Vector3f colorExtinction)
Return at what depth the refraction color extinct
the first value is for red
the second is for green
the third is for blue
Play with those parameters to "trouble" the water
default is (5.0, 20.0, 30.0f);
|
void |
setDeepWaterColor(com.jme3.math.ColorRGBA deepWaterColor)
sets the deep water color
see setWaterColor for general color
default is (0.0039f, 0.00196f, 0.145f,1.0f) (very dark blue)
|
void |
setFoamExistence(com.jme3.math.Vector3f foamExistence)
Describes at what depth foam starts to fade out and
at what it is completely invisible.
|
void |
setFoamHardness(float foamHardness)
Sets the foam hardness : How much the foam will blend with the shore to avoid hard edged water plane.
|
void |
setFoamIntensity(float foamIntensity)
sets the foam intensity default is 0.5f
|
void |
setFoamTexture(com.jme3.texture.Texture2D foamTexture)
Sets the foam texture.
|
void |
setHeightTexture(com.jme3.texture.Texture2D heightTexture)
Sets the height texture
|
void |
setLightColor(com.jme3.math.ColorRGBA lightColor)
Sets the light color to use
default is white
|
void |
setLightDirection(com.jme3.math.Vector3f lightDirection)
Sets the light direction
|
void |
setMaxAmplitude(float maxAmplitude)
Sets the maximum waves amplitude
default is 1.5
|
void |
setNeedSaveReflectionScene(boolean needSaveReflectionScene)
Sets the flag.
|
void |
setNormalScale(float normalScale)
Sets the normal scaling factors to apply to the normal map.
|
void |
setNormalTexture(com.jme3.texture.Texture2D normalTexture)
Sets the normal texture.
|
void |
setRadius(float radius)
Set the radius of the effect.
|
void |
setReflectionDisplace(float reflectionDisplace)
Sets the reflection displace.
|
void |
setReflectionMapSize(int reflectionMapSize)
Sets the size of the reflection map
default is 512, the higher, the better quality, but the slower the effect.
|
void |
setReflectionScene(com.jme3.scene.Spatial reflectionScene)
Sets the scene to render in the reflection map.
|
void |
setRefractionConstant(float refractionConstant)
This is a constant related to the index of refraction (IOR) used to compute the fresnel term.
|
void |
setRefractionStrength(float refractionStrength)
This value modifies current fresnel term.
|
void |
setShapeType(WaterFilter.AreaShape shapeType)
Set the shape of the water area (Circular (default) or Square).
|
void |
setShininess(float shininess)
Sets the shininess factor of the water
default is 0.7f
|
void |
setShoreHardness(float shoreHardness)
The smaller this value is, the softer the transition between
shore and water.
|
void |
setSpeed(float speed)
Set the speed of the waves (0.0 is still) default is 1.0
|
void |
setSunScale(float sunScale)
Sets the scale of the sun for specular effect
|
void |
setUnderWaterFogDistance(float underWaterFogDistance)
sets the distance of the fog when under water.
|
void |
setUseCaustics(boolean useCaustics)
set to true if you want caustics to be rendered on the ground underwater, false otherwise
|
void |
setUseFoam(boolean useFoam)
set to true to use foam with water
default true
|
void |
setUseHQShoreline(boolean useHQShoreline) |
void |
setUseRefraction(boolean useRefraction)
set to true to use refraction (default is true)
|
void |
setUseRipples(boolean useRipples)
Set to true to use ripples
|
void |
setUseSpecular(boolean useSpecular)
Set to true to use specular lightings on the water
|
void |
setWaterColor(com.jme3.math.ColorRGBA waterColor)
Sets the color of the water
see setDeepWaterColor for deep water color
default is (0.0078f, 0.3176f, 0.5f,1.0f) (greenish blue)
|
void |
setWaterHeight(float waterHeight)
Sets the height of the water plane
default is 0.0
|
void |
setWaterTransparency(float waterTransparency)
Sets how fast will colours fade out.
|
void |
setWaveScale(float waveScale)
Sets the scale factor of the waves height map
the smaller the value the bigger the waves
default is 0.005f
|
void |
setWindDirection(com.jme3.math.Vector2f windDirection)
sets the wind direction
the direction where the waves move
default is (0.0f, -1.0f)
|
protected boolean |
useDirectionLightFromScene() |
void |
write(com.jme3.export.JmeExporter ex) |
cleanup, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresSceneTexture, postFilter, postFrame, postQueue, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBufferpublic static final java.lang.String DEFAULT_NORMAL_MAP
public static final java.lang.String DEFAULT_FOAM
public static final java.lang.String DEFAULT_CAUSTICS
public static final java.lang.String DEFAULT_HEIGHT_MAP
protected com.jme3.scene.Spatial reflectionScene
protected com.jme3.scene.Spatial rootScene
protected com.jme3.renderer.ViewPort reflectionView
public WaterFilter()
public WaterFilter(com.jme3.scene.Node reflectionScene,
com.jme3.math.Vector3f lightDirection)
protected boolean isRequiresDepthTexture()
isRequiresDepthTexture in class com.jme3.post.Filterprotected void preFrame(float tpf)
preFrame in class com.jme3.post.Filterprotected com.jme3.material.Material getMaterial()
getMaterial in class com.jme3.post.Filterprotected boolean useDirectionLightFromScene()
protected void initFilter(com.jme3.asset.AssetManager manager,
com.jme3.renderer.RenderManager renderManager,
com.jme3.renderer.ViewPort vp,
int w,
int h)
initFilter in class com.jme3.post.Filterprotected void cleanUpFilter(com.jme3.renderer.Renderer r)
cleanUpFilter in class com.jme3.post.Filterpublic void write(com.jme3.export.JmeExporter ex)
throws java.io.IOException
write in interface com.jme3.export.Savablewrite in class com.jme3.post.Filterjava.io.IOExceptionpublic void read(com.jme3.export.JmeImporter im)
throws java.io.IOException
read in interface com.jme3.export.Savableread in class com.jme3.post.Filterjava.io.IOExceptionpublic float getWaterHeight()
public void setWaterHeight(float waterHeight)
waterHeight - the desired height (default=0)public void setReflectionScene(com.jme3.scene.Spatial reflectionScene)
reflectionScene - the refraction scene.public com.jme3.scene.Spatial getReflectionScene()
public float getWaterTransparency()
public void setWaterTransparency(float waterTransparency)
waterTransparency - the desired muddiness (default=0.1)public float getNormalScale()
public void setNormalScale(float normalScale)
normalScale - the scaling factor (default=3)public float getRefractionConstant()
public void setRefractionConstant(float refractionConstant)
refractionConstant - the desired R0 value (default=0.5)public float getMaxAmplitude()
public void setMaxAmplitude(float maxAmplitude)
maxAmplitude - the desired maximum amplitude (default=1.5)public com.jme3.math.Vector3f getLightDirection()
public void setLightDirection(com.jme3.math.Vector3f lightDirection)
lightDirection - the direction vector to use (alias created,
default=(0,-1,0))public com.jme3.math.ColorRGBA getLightColor()
public void setLightColor(com.jme3.math.ColorRGBA lightColor)
lightColor - the color to use (alias created, default=(1,1,1,1))public float getShoreHardness()
public void setShoreHardness(float shoreHardness)
shoreHardness - the desired hardness (default=0.1)public float getFoamHardness()
public void setFoamHardness(float foamHardness)
foamHardness - the desired hardness (default=1)public float getRefractionStrength()
public void setRefractionStrength(float refractionStrength)
refractionStrength - the desired strength (default=0)public float getWaveScale()
public void setWaveScale(float waveScale)
waveScale - the desired scale factor (default=0.005)public com.jme3.math.Vector3f getFoamExistence()
public void setFoamExistence(com.jme3.math.Vector3f foamExistence)
foamExistence - the desired parameters (alias created)public float getSunScale()
public void setSunScale(float sunScale)
sunScale - the desired scale factor (default=3)public com.jme3.math.Vector3f getColorExtinction()
public void setColorExtinction(com.jme3.math.Vector3f colorExtinction)
colorExtinction - the desired depth for each color component (alias
created, default=(5,20,30))public void setFoamTexture(com.jme3.texture.Texture2D foamTexture)
foamTexture - the foam texture.public com.jme3.texture.Texture2D getFoamTexture()
public void setHeightTexture(com.jme3.texture.Texture2D heightTexture)
heightTexture - the texture to use (alias created)public com.jme3.texture.Texture2D getHeightTexture()
public void setNormalTexture(com.jme3.texture.Texture2D normalTexture)
normalTexture - the normal texture.public com.jme3.texture.Texture2D getNormalTexture()
public float getShininess()
public void setShininess(float shininess)
shininess - the desired factor (default=0.7)public float getSpeed()
public void setSpeed(float speed)
speed - the desired speedup factor (default=1)public com.jme3.math.ColorRGBA getWaterColor()
public void setWaterColor(com.jme3.math.ColorRGBA waterColor)
waterColor - the color to use (alias created,
default=(0.0078,0.3176,0.5,1))public com.jme3.math.ColorRGBA getDeepWaterColor()
public void setDeepWaterColor(com.jme3.math.ColorRGBA deepWaterColor)
deepWaterColor - the color to use (alias created,
default=(0.0039,0.00196,0.145,1))public com.jme3.math.Vector2f getWindDirection()
public void setWindDirection(com.jme3.math.Vector2f windDirection)
windDirection - the direction vector to use (alias created,
default=(0,-1))public int getReflectionMapSize()
public void setReflectionMapSize(int reflectionMapSize)
reflectionMapSize - the desired size (in pixels per side,
default=512)public boolean isUseFoam()
public void setUseFoam(boolean useFoam)
useFoam - true for foam, false for no foam (default=true)public void setCausticsTexture(com.jme3.texture.Texture2D causticsTexture)
causticsTexture - the caustics texture.public com.jme3.texture.Texture2D getCausticsTexture()
public boolean isUseCaustics()
public void setUseCaustics(boolean useCaustics)
useCaustics - true to enable rendering fo caustics, false to disable
it (default=true)public boolean isUseHQShoreline()
public void setUseHQShoreline(boolean useHQShoreline)
public boolean isUseRefraction()
public void setUseRefraction(boolean useRefraction)
useRefraction - true to enable refraction, false to disable it
(default=true)public boolean isUseRipples()
public void setUseRipples(boolean useRipples)
useRipples - true to enable ripples, false to disable them
(default=true)public boolean isUseSpecular()
public void setUseSpecular(boolean useSpecular)
useSpecular - true to enable the specular effect, false to disable
it (default=true)public float getFoamIntensity()
public void setFoamIntensity(float foamIntensity)
foamIntensity - the desired intensity (default=0.5)public float getReflectionDisplace()
setReflectionDisplace(float)public void setReflectionDisplace(float reflectionDisplace)
reflectionDisplace - the desired displacement (default=30)public boolean isUnderWater()
public float getUnderWaterFogDistance()
public void setUnderWaterFogDistance(float underWaterFogDistance)
underWaterFogDistance - the desired distance (in world units,
default=120)public float getCausticsIntensity()
public void setCausticsIntensity(float causticsIntensity)
causticsIntensity - the desired intensity (≥0, ≤1,
default=0.5)public com.jme3.math.Vector3f getCenter()
public void setCenter(com.jme3.math.Vector3f center)
center - the center of the effectpublic float getRadius()
public void setRadius(float radius)
radius - the radius of the effectpublic WaterFilter.AreaShape getShapeType()
public void setShapeType(WaterFilter.AreaShape shapeType)
shapeType - the shape typepublic java.lang.Object jmeClone()
jmeClone in interface com.jme3.util.clone.JmeCloneablepublic void cloneFields(com.jme3.util.clone.Cloner cloner,
java.lang.Object original)
cloneFields in interface com.jme3.util.clone.JmeCloneablepublic void setNeedSaveReflectionScene(boolean needSaveReflectionScene)
needSaveReflectionScene - true if need to save reflection scene.public boolean isNeedSaveReflectionScene()