I watched this video:
Can i somewhere find that plugin?
That is by @ghoust. Take a look in This thread
foxhavendesigns hit the nail on the head. In that thread should be everything you need. If you are missing something, or get stuck, then just ask…
I downloaded all your source code from 2 links u gave. How put that all as a plugin?
Grass is really easy to make.
[java]
public Spatial createGrassSpatial()
{
float angle = 90 * FastMath.DEG_TO_RAD;
Quad q = new Quad(2f, 2f);
Geometry g = new Geometry("Grass4_Quad1", q);
Material mat = assetManager.loadMaterial("MatDefs/Vegetation/Grass_4.j3m");
g.setMaterial(mat);
g.setLocalTranslation(-1f, 0, 0);
Quad q2 = new Quad(2f, 2f);
Geometry g2 = new Geometry("Grass4_Quad2", q2);
g2.setMaterial(mat);
g2.setLocalTranslation(0, 0, 1f);
g2.setLocalRotation(new Quaternion(new float[] { 0, angle, 0 }));
Node bb = new Node("Grass4_Billboard");
bb.attachChild(g);
bb.attachChild(g2);
return bb;
}
[/java]
That just makes two quads, rotates one of them 90 degrees and applies a material to each one.
Using that, you add a ton of grass to a node, set their locations and then use GeometryBatchFactory on it to merge it into one mesh.
for example:
[java]
Spatial spatial = createGrassSpatial();
Node grassNode = new Node(“grassPatch”);
for (int i = 0; i < 200; i++)
{
float x = FastMath.rand.nextInt(129)
float z = FastMath.rand.nextInt(129)
float y = myTerrainQuad.getHeight(new Vector2f(x, z));
Spatial grass = spatial.clone();
grass.setLocalTranslation(x, y, z);
grassNode.attachChild(grass);
}
Node optimizedGrass = GeometryBatchFactory.optimize(grassNode, true);
rootNode.attachChild(optimizedGrass);
[/java]
you could also use ‘Create NBM’ to create a jar archive (placed in build/modules subdirectory) for distribution I guess.