public void initialize(RenderManager rm, ViewPort vp) { this.rm = rm; this.vp = vp; loadTextures(manager); createTextures(); applyTextures(material); createPreViews(); material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar())); if (debug) { dispRefraction = new Picture("dispRefraction"); dispRefraction.setTexture(manager, refractionTexture, false); dispReflection = new Picture("dispRefraction"); dispReflection.setTexture(manager, reflectionTexture, false); dispDepth = new Picture("depthTexture"); dispDepth.setTexture(manager, depthTexture, false); } }
public void postFrame(FrameBuffer out) { if (debug) { displayMap(rm.getRenderer(), dispRefraction, 64); displayMap(rm.getRenderer(), dispReflection, 256); displayMap(rm.getRenderer(), dispDepth, 448); } }
/** * sets the reflection clipping plane offset * set a nagetive value to lower the clipping plane for relection texture rendering. * @param reflectionClippingOffset */ public void setReflectionClippingOffset(float reflectionClippingOffset) { this.reflectionClippingOffset = reflectionClippingOffset; updateClipPlanes(); }
@Override public void simpleInitApp() { initInput(); initScene(); //create processor waterProcessor = new SimpleWaterProcessor(assetManager); waterProcessor.setReflectionScene(sceneNode); waterProcessor.setDebug(true); viewPort.addProcessor(waterProcessor); waterProcessor.setLightPosition(lightPos); //create water quad //waterPlane = waterProcessor.createWaterGeometry(100, 100); waterPlane=(Spatial) assetManager.loadModel("Models/WaterTest/WaterTest.mesh.xml"); waterPlane.setMaterial(waterProcessor.getMaterial()); waterPlane.setLocalScale(40); waterPlane.setLocalTranslation(-5, 0, 5); rootNode.attachChild(waterPlane); }
SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager); waterProcessor.setReflectionScene(mainScene); waterProcessor.setDebug(false); waterProcessor.setLightPosition(lightPos); waterProcessor.setRefractionClippingOffset(1.0f); waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y))); WaterUI waterUi=new WaterUI(inputManager, waterProcessor); waterProcessor.setWaterColor(ColorRGBA.Brown); waterProcessor.setDebug(true); water.setShadowMode(ShadowMode.Receive); water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); water.setMaterial(waterProcessor.getMaterial()); water.setLocalTranslation(-200, -20, 250);
public void initialize(RenderManager rm, ViewPort vp) { this.rm = rm; this.vp = vp; loadTextures(manager); createTextures(); applyTextures(material); createPreViews(); material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar())); if (debug) { dispRefraction = new Picture("dispRefraction"); dispRefraction.setTexture(manager, refractionTexture, false); dispReflection = new Picture("dispRefraction"); dispReflection.setTexture(manager, reflectionTexture, false); dispDepth = new Picture("depthTexture"); dispDepth.setTexture(manager, depthTexture, false); } }
/** * Sets the refraction clipping plane offset * set a positive value to raise the clipping plane for refraction texture rendering * @param refractionClippingOffset */ public void setRefractionClippingOffset(float refractionClippingOffset) { this.refractionClippingOffset = refractionClippingOffset; updateClipPlanes(); }
public void postFrame(FrameBuffer out) { if (debug) { displayMap(rm.getRenderer(), dispRefraction, 64); displayMap(rm.getRenderer(), dispReflection, 256); displayMap(rm.getRenderer(), dispDepth, 448); } }
public void initialize(RenderManager rm, ViewPort vp) { this.rm = rm; this.vp = vp; loadTextures(manager); createTextures(); applyTextures(material); createPreViews(); material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar())); if (debug) { dispRefraction = new Picture("dispRefraction"); dispRefraction.setTexture(manager, refractionTexture, false); dispReflection = new Picture("dispRefraction"); dispReflection.setTexture(manager, reflectionTexture, false); dispDepth = new Picture("depthTexture"); dispDepth.setTexture(manager, depthTexture, false); } }
/** * Set the water plane using an origin (location) and a normal (reflection direction). * @param origin Set to 0,-6,0 if your water quad is at that location for correct reflection * @param normal Set to 0,1,0 (Vector3f.UNIT_Y) for normal planar water */ public void setPlane(Vector3f origin, Vector3f normal) { this.plane.setOriginNormal(origin, normal); updateClipPlanes(); }
public void postFrame(FrameBuffer out) { if (debug) { displayMap(rm.getRenderer(), dispRefraction, 64); displayMap(rm.getRenderer(), dispReflection, 256); displayMap(rm.getRenderer(), dispDepth, 448); } }
public void initialize(RenderManager rm, ViewPort vp) { this.rm = rm; this.vp = vp; loadTextures(manager); createTextures(); applyTextures(material); createPreViews(); material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar())); if (debug) { dispRefraction = new Picture("dispRefraction"); dispRefraction.setTexture(manager, refractionTexture, false); dispReflection = new Picture("dispRefraction"); dispReflection.setTexture(manager, reflectionTexture, false); dispDepth = new Picture("depthTexture"); dispDepth.setTexture(manager, depthTexture, false); } }
/** * Set the water plane for this processor. * @param plane */ public void setPlane(Plane plane) { this.plane.setConstant(plane.getConstant()); this.plane.setNormal(plane.getNormal()); updateClipPlanes(); }
public void postFrame(FrameBuffer out) { if (debug) { displayMap(rm.getRenderer(), dispRefraction, 64); displayMap(rm.getRenderer(), dispReflection, 256); displayMap(rm.getRenderer(), dispDepth, 448); } }
/** * Creates a SimpleWaterProcessor * @param manager the asset manager */ public SimpleWaterProcessor(AssetManager manager) { this.manager = manager; material = new Material(manager, "Common/MatDefs/Water/SimpleWater.j3md"); material.setFloat("waterDepth", waterDepth); material.setFloat("waterTransparency", waterTransparency / 10); material.setColor("waterColor", ColorRGBA.White); material.setVector3("lightPos", new Vector3f(1, -1, 1)); material.setFloat("distortionScale", distortionScale); material.setFloat("distortionMix", distortionMix); material.setFloat("texScale", texScale); updateClipPlanes(); }
/** * sets the reflection clipping plane offset * set a nagetive value to lower the clipping plane for relection texture rendering. * @param reflectionClippingOffset */ public void setReflectionClippingOffset(float reflectionClippingOffset) { this.reflectionClippingOffset = reflectionClippingOffset; updateClipPlanes(); }
/** * sets the reflection clipping plane offset * set a nagetive value to lower the clipping plane for relection texture rendering. * @param reflectionClippingOffset */ public void setReflectionClippingOffset(float reflectionClippingOffset) { this.reflectionClippingOffset = reflectionClippingOffset; updateClipPlanes(); }
/** * sets the reflection clipping plane offset * set a nagetive value to lower the clipping plane for relection texture rendering. * @param reflectionClippingOffset */ public void setReflectionClippingOffset(float reflectionClippingOffset) { this.reflectionClippingOffset = reflectionClippingOffset; updateClipPlanes(); }
/** * Sets the refraction clipping plane offset * set a positive value to raise the clipping plane for refraction texture rendering * @param refractionClippingOffset */ public void setRefractionClippingOffset(float refractionClippingOffset) { this.refractionClippingOffset = refractionClippingOffset; updateClipPlanes(); }
/** * Sets the refraction clipping plane offset * set a positive value to raise the clipping plane for refraction texture rendering * @param refractionClippingOffset */ public void setRefractionClippingOffset(float refractionClippingOffset) { this.refractionClippingOffset = refractionClippingOffset; updateClipPlanes(); }