Node spatNode = (Node) spatial;
Node grassLayer = new Node("grass_" + spatial.getName());
grassLayer.setModelBound(new BoundingBox());
Texture tex = assetManager.loadTexture(texturePath);
Material faceMat = new Material(assetManager,
"/com/l2client/materials/LightingGrass.j3md");
faceMat.getAdditionalRenderState().setBlendMode(
RenderState.BlendMode.Alpha);
faceMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
faceMat.getAdditionalRenderState().setDepthWrite(true);
faceMat.getAdditionalRenderState().setDepthTest(true);
faceMat.setTransparent(true);
faceMat.setTextureParam("DiffuseMap", VarType.Texture2D, tex);
faceMat.setFloat("AlphaDiscardThreshold", 0.3f);
// faceMat.setTextureParam("AlphaMap", VarType.Texture2D,tex);
faceMat.setBoolean("UseAlpha", true);
if (fadeEnd > 0f) {
faceMat.setFloat("FadeEnd", fadeEnd);// 300f);
faceMat.setFloat("FadeRange", fadeRange); // 50f);
faceMat.setBoolean("FadeEnabled", true);
}
faceMat.setBoolean("Swaying", true);
faceMat.setVector3("SwayData", new Vector3f(1.0f, 0.5f, 300f));// frequency,
// variation,
// third?
faceMat.setVector2("Wind", new Vector2f(1f, 1f));
Geometry terrain = null;
if (spatial instanceof Geometry) {
terrain = (Geometry) spatial;