i want to make waterfall.i can use Quad .everybody can give me source code. please!
import javax.swing.ImageIcon;
import jmetest.curve.TestBezierCurve;
import jmetest.effects.RenParticleEditor;
import jmetest.terrain.TestTerrain;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.curve.BezierCurve;
import com.jme.curve.CurveController;
import com.jme.image.Image;
import com.jme.image.Texture;
import com.jme.light.PointLight;
import com.jme.math.Plane;
import com.jme.math.Ring;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.pass.BasicPassManager;
import com.jme.scene.Controller;
import com.jme.scene.Skybox;
import com.jme.scene.TriMesh;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.CullState;
import com.jme.scene.state.FogState;
import com.jme.scene.state.RenderState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jme.util.geom.Debugger;
import com.jmex.effects.particles.ParticleFactory;
import com.jmex.effects.particles.ParticleGeometry;
import com.jmex.effects.particles.ParticleMesh;
import com.jmex.effects.particles.SimpleParticleInfluenceFactory;
import com.jmex.effects.water.ProjectedGrid;
import com.jmex.effects.water.WaterHeightGenerator;
import com.jmex.effects.water.WaterRenderPass;
import com.jmex.terrain.TerrainBlock;
import com.jmex.terrain.util.MidPointHeightMap;
import com.jmex.terrain.util.ProceduralTextureGenerator;
import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
public class hieuungparticle extends SimpleGame
{
private TerrainBlock tb;
private Skybox sky;
public static ParticleGeometry particleGeom;
private WaterRenderPass waterEffectRenderPass;
private ProjectedGrid projectedGrid;
private BasicPassManager pManager;
public static void main(String[] args)
{
hieuungparticle app=new hieuungparticle();
app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
/protected void simpleUpdate() {
//super.simpleUpdate();
// sky.setLocalTranslation(cam.getLocation());
}/
@Override
protected void simpleInitGame()
{
Vector3f temp=new Vector3f();
temp.x=cam.getLocation().x;
temp.y=cam.getLocation().y;
temp.z=cam.getLocation().z+100;
cam.setLocation(temp);
buildWaterfall();
}
private Vector3f up = new Vector3f(0, 1, 0);
private void buildWaterfall()
{
Vector3f[] points = new Vector3f[4];
points[0] = new Vector3f( 0, 5, 0);
points[1] = new Vector3f( -2, 3, 2);
points[2] = new Vector3f(2, -3, -2);
points[3] = new Vector3f(0, -5, 0);
BezierCurve curve = new BezierCurve("Curve", points);
/* ColorRGBA[] colors = new ColorRGBA[4];
colors[0] = new ColorRGBA(0, 1, 0, 1);
colors[1] = new ColorRGBA(1, 0, 0, 1);
colors[2] = new ColorRGBA(1, 1, 0, 1);
colors[3] = new ColorRGBA(0, 0, 1, 1);
curve.setColorBuffer(0, BufferUtils.createFloatBuffer(colors));
/
Vector3f min = new Vector3f( -0.1f, -0.1f, -0.1f);
Vector3f max = new Vector3f(0.1f, 0.1f, 0.1f);
ZBufferState buf = display.getRenderer().createZBufferState();
buf.setEnabled(true);
buf.setFunction(ZBufferState.CF_LEQUAL);
TriMesh t = new Box("Control 1", min, max);
t.setModelBound(new BoundingSphere());
t.updateModelBound();
t.setLocalTranslation(new Vector3f(points[0]));
/ TriMesh t2 = new Box("Control 2", min, max);
t2.setModelBound(new BoundingSphere());
t2.updateModelBound();
t2.setLocalTranslation(new Vector3f(points[1]));
TriMesh t3 = new Box("Control 3", min, max);
t3.setModelBound(new BoundingSphere());
t3.updateModelBound();
t3.setLocalTranslation(new Vector3f(points[2]));*/
TriMesh t4 = new Box("Control 4", min, max);
t4.setModelBound(new BoundingSphere());
t4.updateModelBound();
t4.setLocalTranslation(new Vector3f(points[3]));
TriMesh quad = new Quad("Controlled Quad", 5, 5);
quad.setModelBound(new BoundingSphere());
quad.updateModelBound();
quad.setLocalTranslation(new Vector3f(points[0]));
// dung de dieu kien vat di chuyen qua lai giua hai diem
CurveController cc = new CurveController(curve, quad);
cc.setRepeatType(Controller.RT_CYCLE);
// cc.setActive(false);
cc.setUpVector(up);
cc.setSpeed(0.5f);
quad.addController(cc);
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
ts.setTexture(
TextureManager.loadTexture(
TestBezierCurve.class.getClassLoader().getResource(
"jmetest/data/images/Monkey.jpg"),
Texture.MM_LINEAR,
Texture.FM_LINEAR));
quad.setRenderState(ts);
rootNode.setRenderState(buf);
rootNode.attachChild(t);
//rootNode.attachChild(t2);
// rootNode.attachChild(t3);
rootNode.attachChild(t4);
rootNode.attachChild(quad);
rootNode.attachChild(curve);
}