|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectcom.jme3.water.SimpleWaterProcessor
public class SimpleWaterProcessor
Simple Water renders a simple plane that use reflection and refraction to look like water.
It's pretty basic, but much faster than the WaterFilter
It's useful if you aim low specs hardware and still want a good looking water.
Usage is :
SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager);
//setting the scene to use for reflection
waterProcessor.setReflectionScene(mainScene);
//setting the light position
waterProcessor.setLightPosition(lightPos);
//setting the water plane
Vector3f waterLocation=new Vector3f(0,-20,0);
waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));
//setting the water color
waterProcessor.setWaterColor(ColorRGBA.Brown);
//creating a quad to render water to
Quad quad = new Quad(400,400);
//the texture coordinates define the general size of the waves
quad.scaleTextureCoordinates(new Vector2f(6f,6f));
//creating a geom to attach the water material
Geometry water=new Geometry("water", quad);
water.setLocalTranslation(-200, -20, 250);
water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
//finally setting the material
water.setMaterial(waterProcessor.getMaterial());
//attaching the water to the root node
rootNode.attachChild(water);
入れ子のクラスの概要 | |
---|---|
class |
SimpleWaterProcessor.RefractionProcessor
Refraction Processor |
コンストラクタの概要 | |
---|---|
SimpleWaterProcessor(AssetManager manager)
Creates a SimpleWaterProcessor |
メソッドの概要 | |
---|---|
void |
cleanup()
Called when the SP is removed from the RM. |
Geometry |
createWaterGeometry(float width,
float height)
Creates a quad with the water material applied to it. |
Material |
getMaterial()
Get the water material from this processor, apply this to your water quad. |
Plane |
getPlane()
returns the water plane |
float |
getReflectionClippingOffset()
returns the reflection clipping plane offset |
float |
getRefractionClippingOffset()
returns the refraction clipping plane offset |
int |
getRenderHeight()
returns the height of the reflection and refraction textures |
int |
getRenderWidth()
returns the width of the reflection and refraction textures |
float |
getWaterDepth()
return the water depth |
float |
getWaterTransparency()
returns water transparency |
void |
initialize(RenderManager rm,
ViewPort vp)
Called in the render thread to initialize the scene processor. |
boolean |
isDebug()
retruns true if the waterprocessor is in debug mode |
boolean |
isInitialized()
|
void |
postFrame(FrameBuffer out)
Called after a frame has been rendered and the queue flushed. |
void |
postQueue(RenderQueue rq)
Called after the scene graph has been queued, but before it is flushed. |
void |
preFrame(float tpf)
Called before a frame |
void |
reshape(ViewPort vp,
int w,
int h)
Called when the resolution of the viewport has been changed. |
void |
setDebug(boolean debug)
set to true to display reflection and refraction textures in the GUI for debug purpose |
void |
setDistortionMix(float value)
Sets how the normal and dudv map are mixed to create the wave effect, default = 0.5 |
void |
setDistortionScale(float value)
Sets the scale of distortion by the normal map, default = 0.2 |
void |
setLightPosition(Vector3f position)
Set the light Position for the processor |
void |
setPlane(Plane plane)
Set the water plane for this processor. |
void |
setPlane(Vector3f origin,
Vector3f normal)
Set the water plane using an origin (location) and a normal (reflection direction). |
void |
setReflectionClippingOffset(float reflectionClippingOffset)
sets the reflection clipping plane offset set a nagetive value to lower the clipping plane for relection texture rendering. |
void |
setReflectionScene(Spatial spat)
Sets the reflected scene, should not include the water quad! |
void |
setRefractionClippingOffset(float refractionClippingOffset)
Sets the refraction clipping plane offset set a positive value to raise the clipping plane for refraction texture rendering |
void |
setRenderSize(int width,
int height)
Set the reflection Texture render size, set before adding the processor! |
void |
setTexScale(float value)
Sets the scale of the normal/dudv texture, default = 1. |
void |
setWaterColor(ColorRGBA color)
Set the color that will be added to the refraction texture. |
void |
setWaterDepth(float depth)
Higher values make the refraction texture shine through earlier. |
void |
setWaterTransparency(float waterTransparency)
sets the water transparency default os 0.1f |
void |
setWaveSpeed(float speed)
Sets the speed of the wave animation, default = 0.05f. |
クラス java.lang.Object から継承されたメソッド |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
---|
public SimpleWaterProcessor(AssetManager manager)
manager
- the asset managerメソッドの詳細 |
---|
public void initialize(RenderManager rm, ViewPort vp)
SceneProcessor
の記述:
SceneProcessor
内の initialize
rm
- The render manager to which the SP was added tovp
- The viewport to which the SP is assignedpublic void reshape(ViewPort vp, int w, int h)
SceneProcessor
の記述:
SceneProcessor
内の reshape
public boolean isInitialized()
SceneProcessor
内の isInitialized
public void preFrame(float tpf)
SceneProcessor
の記述:
SceneProcessor
内の preFrame
tpf
- Time per framepublic void postQueue(RenderQueue rq)
SceneProcessor
の記述:
SceneProcessor
内の postQueue
rq
- The render queuepublic void postFrame(FrameBuffer out)
SceneProcessor
の記述:
SceneProcessor
内の postFrame
out
- The FB to which the scene was rendered.public void cleanup()
SceneProcessor
の記述:
SceneProcessor
内の cleanup
public Material getMaterial()
public void setReflectionScene(Spatial spat)
spat
- public int getRenderWidth()
public int getRenderHeight()
public void setRenderSize(int width, int height)
with
- height
- public Plane getPlane()
public void setPlane(Plane plane)
plane
- public void setPlane(Vector3f origin, Vector3f normal)
origin
- Set to 0,-6,0 if your water quad is at that location for correct reflectionnormal
- Set to 0,1,0 (Vector3f.UNIT_Y) for normal planar waterpublic void setLightPosition(Vector3f position)
position
- public void setWaterColor(ColorRGBA color)
color
- public void setWaterDepth(float depth)
depth
- public float getWaterDepth()
public float getWaterTransparency()
public void setWaterTransparency(float waterTransparency)
waterTransparency
- public void setWaveSpeed(float speed)
speed
- public void setDistortionScale(float value)
public void setDistortionMix(float value)
public void setTexScale(float value)
public boolean isDebug()
public void setDebug(boolean debug)
debug
- public Geometry createWaterGeometry(float width, float height)
width
- height
-
public float getReflectionClippingOffset()
public void setReflectionClippingOffset(float reflectionClippingOffset)
reflectionClippingOffset
- public float getRefractionClippingOffset()
public void setRefractionClippingOffset(float refractionClippingOffset)
refractionClippingOffset
-
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |