Class WaterNode
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.extension.effect.water.WaterNode
The WaterNode handles rendering of a water effect on all of it's children. What is reflected in the water is
controlled through setReflectedScene/addReflectedScene. The skybox (if any) needs to be explicitly set through
setSkybox since it needs to be relocated when rendering the reflection. The water is treated as a plane no matter
what the geometry is, which is controlled through the water node plane equation settings.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected BlendState
protected Vector3
protected Vector3
protected Camera
protected double
protected CullState
protected String
protected String
protected String
protected TextureState
protected String
protected double
protected double
protected FogState
protected String
protected double
protected String
protected String
protected double
protected double
protected double
protected double
protected double
protected int
protected String
protected String
protected Node
protected double
protected double
protected boolean
protected Vector3
protected Texture2D
protected Texture2D
protected Texture2D
protected Texture2D
protected TextureState
protected double
protected TextureRenderer
protected boolean
protected boolean
protected boolean
protected boolean
protected ColorRGBA
protected ColorRGBA
protected double
protected Plane
protected GLSLShaderObjectsState
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addReflectedScene
(Spatial renderNode) Adds a spatial to the list of spatials used as reflection in the watervoid
cleanup()
Release pbuffers in TextureRenderer's.void
void
draw
calls the onDraw method for each child maintained by this node.float
getCam()
double
double
double
double
double
int
double
double
double
double
boolean
boolean
boolean
boolean
boolean
boolean
void
void
removeReflectedScene
(Spatial renderNode) void
Resets water parameters to default valuesvoid
setBinormal
(Vector3 binormal) void
setBlurSampleDistance
(float blurSampleDistance) void
void
setClipBias
(double clipBias) void
setDoBlurReflection
(boolean doBlurReflection) void
setDudvMapTextureString
(String dudvMapTextureString) void
setDudvTexture
(Texture dudvTexture) void
setFallbackMapTextureString
(String fallbackMapTextureString) void
setFallbackTexture
(Texture fallbackTexture) void
setFoamMapTextureString
(String foamMapTextureString) void
setFoamTexture
(Texture foamTexture) void
setHeightFalloffSpeed
(double heightFalloffSpeed) Set the fadeout length of the waveheights, when over falloff start(for projected water only)void
setHeightFalloffStart
(double heightFalloffStart) Set at what distance the wave heights should start to fade out(for projected water only)void
Set the normal of the water plane(Used for reflecting the camera for rendering reflection)void
setNormalmapTexture
(Texture normalmapTexture) void
setNormalMapTextureString
(String normalMapTextureString) void
setReflectionThrottle
(double reflectionThrottle) void
setRefractionThrottle
(double refractionThrottle) void
setRenderScale
(int renderScale) void
Sets up a node to be transformed and clipped for sky box usagevoid
setSpeedReflection
(double speedReflection) Set the movement speed of the reflection texturevoid
setSpeedRefraction
(double speedRefraction) Set the movement speed of the refraction texturevoid
setTangent
(Vector3 tangent) void
setTextureState
(TextureState textureState) protected void
Load water textures.void
setUseProjectedShader
(boolean useProjectedShader) void
setUseReflection
(boolean useReflection) Turn reflection on and offvoid
setUseRefraction
(boolean useRefraction) Turn refraction on and offvoid
setWaterColorEnd
(ColorRGBA waterColorEnd) Color to use when the incident angle to the surface is highvoid
setWaterColorStart
(ColorRGBA waterColorStart) Color to use when the incident angle to the surface is lowvoid
setWaterEffectOnSpatial
(Spatial spatial) Sets a spatial up for being rendered with the water effectvoid
setWaterHeight
(double waterHeight) Set base height of the water plane(Used for reflecting the camera for rendering reflection)void
setWaterMaxAmplitude
(double waterMaxAmplitude) Maximum amplitude of the water, used for clipping correctly(projected water only)void
setWaterPlane
(Plane waterPlane) void
update
(double tpf) void
protected void
void
useFadeToFogColor
(boolean value) If true, fade to fog color.Methods inherited from class com.ardor3d.scenegraph.Node
acceptVisitor, attachChild, attachChildAt, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getClassTag, getNumberOfChildren, hasChild, makeCopy, makeInstanced, propagateDirtyDown, read, sortLights, swapChildren, updateChildren, updateWorldBound, updateWorldRenderStates, updateWorldTransform, write
Methods inherited from class com.ardor3d.scenegraph.Spatial
addController, addTranslation, addTranslation, applyWorldRenderStates, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, worldToLocal
-
Field Details
-
cam
-
tpf
protected double tpf -
reflectionThrottle
protected double reflectionThrottle -
refractionThrottle
protected double refractionThrottle -
reflectionTime
protected double reflectionTime -
refractionTime
protected double refractionTime -
useFadeToFogColor
protected boolean useFadeToFogColor -
tRenderer
-
textureReflect
-
textureReflectBlur
-
textureRefract
-
textureDepth
-
renderList
-
texArray
-
skyBox
-
waterShader
-
cullBackFace
-
textureState
-
fallbackTextureState
-
as1
-
noFog
-
waterPlane
-
tangent
-
binormal
-
calcVect
-
clipBias
protected double clipBias -
waterColorStart
-
waterColorEnd
-
heightFalloffStart
protected double heightFalloffStart -
heightFalloffSpeed
protected double heightFalloffSpeed -
waterMaxAmplitude
protected double waterMaxAmplitude -
speedReflection
protected double speedReflection -
speedRefraction
protected double speedRefraction -
aboveWater
protected boolean aboveWater -
normalTranslation
protected double normalTranslation -
refractionTranslation
protected double refractionTranslation -
supported
protected boolean supported -
useProjectedShader
protected boolean useProjectedShader -
useRefraction
protected boolean useRefraction -
useReflection
protected boolean useReflection -
renderScale
protected int renderScale -
simpleShaderStr
-
simpleShaderRefractionStr
-
projectedShaderStr
-
projectedShaderRefractionStr
-
currentShaderStr
-
normalMapTextureString
-
dudvMapTextureString
-
foamMapTextureString
-
fallbackMapTextureString
-
-
Constructor Details
-
WaterNode
Creates a new WaterRenderPass- Parameters:
cam
- main rendercam to use for reflection settings etcrenderScale
- how many times smaller the reflection/refraction textures should be compared to the main displayuseProjectedShader
- true - use the projected setup for variable height water meshes, false - use the flast shader setupuseRefraction
- enable/disable rendering of refraction textures
-
-
Method Details
-
resetParameters
public void resetParameters()Resets water parameters to default values -
cleanup
public void cleanup()Release pbuffers in TextureRenderer's. Preferably called from user cleanup method. -
isSupported
public boolean isSupported() -
setupTextures
protected void setupTextures()Load water textures. -
update
public void update(double tpf) -
draw
Description copied from class:Node
draw
calls the onDraw method for each child maintained by this node. -
updateTranslations
protected void updateTranslations() -
reloadShader
public void reloadShader() -
setWaterEffectOnSpatial
Sets a spatial up for being rendered with the water effect- Parameters:
spatial
- Spatial to use as base for the water effect
-
removeReflectedScene
-
clearReflectedScene
public void clearReflectedScene() -
addReflectedScene
Adds a spatial to the list of spatials used as reflection in the water- Parameters:
renderNode
- Spatial to add to the list of objects used as reflection in the water
-
setSkybox
Sets up a node to be transformed and clipped for sky box usage- Parameters:
skyBox
- Handle to a node to use as sky box
-
getCam
-
setCam
-
getWaterColorStart
-
setWaterColorStart
Color to use when the incident angle to the surface is low- Parameters:
waterColorStart
- the color to use when the incident angle to the surface is low
-
getWaterColorEnd
-
setWaterColorEnd
Color to use when the incident angle to the surface is high- Parameters:
waterColorEnd
- the color to use when the incident angle to the surface is high
-
getHeightFalloffStart
public double getHeightFalloffStart() -
setHeightFalloffStart
public void setHeightFalloffStart(double heightFalloffStart) Set at what distance the wave heights should start to fade out(for projected water only)- Parameters:
heightFalloffStart
- the distance the wave heights should start to fade out
-
getHeightFalloffSpeed
public double getHeightFalloffSpeed() -
setHeightFalloffSpeed
public void setHeightFalloffSpeed(double heightFalloffSpeed) Set the fadeout length of the waveheights, when over falloff start(for projected water only)- Parameters:
heightFalloffSpeed
- the the fadeout length of the waveheights
-
getWaterHeight
public double getWaterHeight() -
setWaterHeight
public void setWaterHeight(double waterHeight) Set base height of the water plane(Used for reflecting the camera for rendering reflection)- Parameters:
waterHeight
- the water plane height
-
getNormal
-
setNormal
Set the normal of the water plane(Used for reflecting the camera for rendering reflection)- Parameters:
normal
- the water plane normal
-
getSpeedReflection
public double getSpeedReflection() -
setSpeedReflection
public void setSpeedReflection(double speedReflection) Set the movement speed of the reflection texture- Parameters:
speedReflection
- the speed of reflection texture
-
getSpeedRefraction
public double getSpeedRefraction() -
setSpeedRefraction
public void setSpeedRefraction(double speedRefraction) Set the movement speed of the refraction texture- Parameters:
speedRefraction
- the speed of refraction texture
-
getWaterMaxAmplitude
public double getWaterMaxAmplitude() -
setWaterMaxAmplitude
public void setWaterMaxAmplitude(double waterMaxAmplitude) Maximum amplitude of the water, used for clipping correctly(projected water only)- Parameters:
waterMaxAmplitude
- the maximum amplitude
-
getClipBias
public double getClipBias() -
setClipBias
public void setClipBias(double clipBias) -
getWaterPlane
-
setWaterPlane
-
getTangent
-
setTangent
-
getBinormal
-
setBinormal
-
getTextureReflect
-
getTextureRefract
-
getTextureDepth
-
useFadeToFogColor
public void useFadeToFogColor(boolean value) If true, fade to fog color. If false, fade to 100% reflective surface- Parameters:
value
-true
if fade to fog color
-
isUseFadeToFogColor
public boolean isUseFadeToFogColor() -
isUseReflection
public boolean isUseReflection() -
setUseReflection
public void setUseReflection(boolean useReflection) Turn reflection on and off- Parameters:
useReflection
-true
if the reflection is turned on
-
isUseRefraction
public boolean isUseRefraction() -
setUseRefraction
public void setUseRefraction(boolean useRefraction) Turn refraction on and off- Parameters:
useRefraction
-true
if the refraction is turned on
-
getRenderScale
public int getRenderScale() -
setRenderScale
public void setRenderScale(int renderScale) -
isUseProjectedShader
public boolean isUseProjectedShader() -
setUseProjectedShader
public void setUseProjectedShader(boolean useProjectedShader) -
getReflectionThrottle
public double getReflectionThrottle() -
setReflectionThrottle
public void setReflectionThrottle(double reflectionThrottle) -
getRefractionThrottle
public double getRefractionThrottle() -
setRefractionThrottle
public void setRefractionThrottle(double refractionThrottle) -
getTextureState
-
setTextureState
-
updateCamera
public void updateCamera() -
setFallbackTexture
-
getFallbackTexture
-
setNormalmapTexture
-
getNormalmapTexture
-
setDudvTexture
-
getDudvTexture
-
setFoamTexture
-
getFoamTexture
-
getNormalMapTextureString
- Returns:
- the normalMapTextureString
-
setNormalMapTextureString
- Parameters:
normalMapTextureString
- the normalMapTextureString to set
-
getDudvMapTextureString
- Returns:
- the dudvMapTextureString
-
setDudvMapTextureString
- Parameters:
dudvMapTextureString
- the dudvMapTextureString to set
-
getFoamMapTextureString
- Returns:
- the foamMapTextureString
-
setFoamMapTextureString
- Parameters:
foamMapTextureString
- the foamMapTextureString to set
-
getFallbackMapTextureString
- Returns:
- the fallbackMapTextureString
-
setFallbackMapTextureString
- Parameters:
fallbackMapTextureString
- the fallbackMapTextureString to set
-
isDoBlurReflection
public boolean isDoBlurReflection() -
setDoBlurReflection
public void setDoBlurReflection(boolean doBlurReflection) -
getBlurSampleDistance
public float getBlurSampleDistance() -
setBlurSampleDistance
public void setBlurSampleDistance(float blurSampleDistance)
-