use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class AbstractShadowRenderer method init.
private void init(AssetManager assetManager, int nbShadowMaps, int shadowMapSize) {
this.postshadowMat = new Material(assetManager, "Common/MatDefs/Shadow/PostShadow.j3md");
shadowFB = new FrameBuffer[nbShadowMaps];
shadowMaps = new Texture2D[nbShadowMaps];
dispPic = new Picture[nbShadowMaps];
lightViewProjectionsMatrices = new Matrix4f[nbShadowMaps];
shadowMapStringCache = new String[nbShadowMaps];
lightViewStringCache = new String[nbShadowMaps];
//DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
dummyTex = new Texture2D(shadowMapSize, shadowMapSize, Format.RGBA8);
preshadowMat = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
postshadowMat.setFloat("ShadowMapSize", shadowMapSize);
for (int i = 0; i < nbShadowMaps; i++) {
lightViewProjectionsMatrices[i] = new Matrix4f();
shadowFB[i] = new FrameBuffer(shadowMapSize, shadowMapSize, 1);
shadowMaps[i] = new Texture2D(shadowMapSize, shadowMapSize, Format.Depth);
shadowFB[i].setDepthTexture(shadowMaps[i]);
//DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
shadowFB[i].setColorTexture(dummyTex);
shadowMapStringCache[i] = "ShadowMap" + i;
lightViewStringCache[i] = "LightViewProjectionMatrix" + i;
postshadowMat.setTexture(shadowMapStringCache[i], shadowMaps[i]);
//quads for debuging purpose
dispPic[i] = new Picture("Picture" + i);
dispPic[i].setTexture(assetManager, shadowMaps[i], false);
}
setShadowCompareMode(shadowCompareMode);
setEdgeFilteringMode(edgeFilteringMode);
setShadowIntensity(shadowIntensity);
initForcedRenderState();
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class HDRRenderer method createDisplayQuad.
public Picture createDisplayQuad() /*int mode, Texture tex*/
{
if (scene64 == null)
return null;
Material mat = new Material(manager, "Common/MatDefs/Hdr/LogLum.j3md");
// if (mode == LUMMODE_ENCODE_LUM)
// mat.setBoolean("EncodeLum", true);
// else if (mode == LUMMODE_DECODE_LUM)
mat.setBoolean("DecodeLum", true);
mat.setTexture("Texture", scene64);
// mat.setTexture("Texture", tex);
Picture dispQuad = new Picture("Luminance Display");
dispQuad.setMaterial(mat);
return dispQuad;
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class HDRRenderer method initialize.
public void initialize(RenderManager rm, ViewPort vp) {
if (!enabled)
return;
renderer = rm.getRenderer();
renderManager = rm;
viewPort = vp;
// loadInitial()
fsQuad = new Picture("HDR Fullscreen Quad");
Format lumFmt = Format.RGB8;
scene64FB = new FrameBuffer(64, 64, 1);
scene64 = new Texture2D(64, 64, lumFmt);
scene64FB.setColorTexture(scene64);
scene64.setMagFilter(fbMagFilter);
scene64.setMinFilter(fbMinFilter);
scene8FB = new FrameBuffer(8, 8, 1);
scene8 = new Texture2D(8, 8, lumFmt);
scene8FB.setColorTexture(scene8);
scene8.setMagFilter(fbMagFilter);
scene8.setMinFilter(fbMinFilter);
scene1FB[0] = new FrameBuffer(1, 1, 1);
scene1[0] = new Texture2D(1, 1, lumFmt);
scene1FB[0].setColorTexture(scene1[0]);
scene1FB[1] = new FrameBuffer(1, 1, 1);
scene1[1] = new Texture2D(1, 1, lumFmt);
scene1FB[1].setColorTexture(scene1[1]);
// prepare tonemap shader
tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
tone.setFloat("A", 0.18f);
tone.setFloat("White", 100);
// load();
int w = vp.getCamera().getWidth();
int h = vp.getCamera().getHeight();
reshape(vp, w, h);
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class TestOrtho method simpleInitApp.
public void simpleInitApp() {
Picture p = new Picture("Picture");
// make it appear behind stats view
p.move(0, 0, -1);
p.setPosition(0, 0);
p.setWidth(settings.getWidth());
p.setHeight(settings.getHeight());
p.setImage(assetManager, "Interface/Logo/Monkey.png", false);
// attach geometry to orthoNode
guiNode.attachChild(p);
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class TestSoftwareMouse method simpleInitApp.
@Override
public void simpleInitApp() {
flyCam.setEnabled(false);
// inputManager.setCursorVisible(false);
Texture tex = assetManager.loadTexture("Interface/Logo/Cursor.png");
cursor = new Picture("cursor");
cursor.setTexture(assetManager, (Texture2D) tex, true);
cursor.setWidth(64);
cursor.setHeight(64);
guiNode.attachChild(cursor);
inputManager.addRawInputListener(inputListener);
// Image img = tex.getImage();
// ByteBuffer data = img.getData(0);
// IntBuffer image = BufferUtils.createIntBuffer(64 * 64);
// for (int y = 0; y < 64; y++){
// for (int x = 0; x < 64; x++){
// int rgba = data.getInt();
// image.put(rgba);
// }
// }
// image.clear();
//
// try {
// Cursor cur = new Cursor(64, 64, 2, 62, 1, image, null);
// Mouse.setNativeCursor(cur);
// } catch (LWJGLException ex) {
// Logger.getLogger(TestSoftwareMouse.class.getName()).log(Level.SEVERE, null, ex);
// }
}
Aggregations