Added the tgr Material loader
If you update the plugin you will get a new library in jMPThe jMonkeyPlatform, a full-fledged IDE with plugins for editing jME3 content and assets. Integral part of the jME3 SDK.. Go to the projects properties and add the “NeoTexture-Libraries” library.
To use it first create a new tgr file and edit it. In the properties field of any image node, enter the name of the texture as it would appear in a j3m file, like “m_ColorMap” for SimpleTextured.j3md. Save the file.
Now open your Main.java file and the Palette (Window->Palette) and you will see two presets in the palette for adding the loader to the assetManager and for loading a material. Drag&Drop them both to the initialize() method of your Application, correct the MaterialDef and tgr file path names to your desire and you’re ready to load your procedural material

import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.material.plugins.NeoTextureMaterialKey;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;
import com.jme3.util.TangentBinormalGenerator;
/**
* test
* @author normenhansen
*/
public class Main extends SimpleApplication{
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(32, 32, 1);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 1, false, false);
TangentBinormalGenerator.generate(sphMesh);
Geometry spat=new Geometry("boxgeom",sphMesh);
assetManager.registerLoader("com.jme3.material.plugins.NeoTextureMaterialLoader","tgr");
NeoTextureMaterialKey key = new NeoTextureMaterialKey("Materials/neoMaterial.tgr");
Material mat = assetManager.loadAsset(key);
mat.setFloat("m_Shininess",12);
spat.setMaterial(mat);
rootNode.attachChild(spat);
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1,-1,1).normalizeLocal());
dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f));
rootNode.addLight(dl);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}
Bitmap textures are not supported yet, only procedural ones!
There is also a TextureLoader for tgr files but its not fleshed out yet, it should be integrated so that tgr files can be used as texture names in j3m files or something similar.
Cheers,
Normen