use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class TestLoadKtx method simpleInitApp.
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
assetManager.registerLoader(KTXLoader.class, "ktx");
Texture2D t = (Texture2D) assetManager.loadTexture("Textures/ktx/down-reference.ktx");
Picture p = new Picture("bla", false);
p.setTexture(assetManager, t, false);
p.setLocalTranslation(200, 200, 0);
p.setWidth(t.getImage().getWidth());
p.setHeight(t.getImage().getHeight());
guiNode.attachChild(p);
Texture2D t2 = (Texture2D) assetManager.loadTexture("Textures/ktx/up-reference.ktx");
Picture p2 = new Picture("bla", false);
p2.setTexture(assetManager, t2, false);
p2.setLocalTranslation(400, 200, 0);
p2.setWidth(t2.getImage().getWidth());
p2.setHeight(t2.getImage().getHeight());
guiNode.attachChild(p2);
Texture2D t3 = (Texture2D) assetManager.loadTexture("Textures/ktx/rgba-reference.ktx");
Picture p3 = new Picture("bla", false);
p3.setTexture(assetManager, t3, false);
p3.setLocalTranslation(200, 400, 0);
p3.setWidth(t3.getImage().getWidth());
p3.setHeight(t3.getImage().getHeight());
guiNode.attachChild(p3);
Texture2D t4 = (Texture2D) assetManager.loadTexture("Textures/ktx/rgb-amg-reference.ktx");
Picture p4 = new Picture("bla", false);
p4.setTexture(assetManager, t4, false);
p4.setLocalTranslation(400, 400, 0);
p4.setWidth(t4.getImage().getWidth());
p4.setHeight(t4.getImage().getHeight());
guiNode.attachChild(p4);
flyCam.setDragToRotate(true);
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class VRViewManagerOSVR method setupMirrorBuffers.
private ViewPort setupMirrorBuffers(Camera cam, Texture tex, boolean expand) {
if (environment != null) {
if (environment.getApplication() != null) {
Camera clonecam = cam.clone();
ViewPort viewPort = environment.getApplication().getRenderManager().createPostView("MirrorView", clonecam);
clonecam.setParallelProjection(true);
viewPort.setClearFlags(true, true, true);
viewPort.setBackgroundColor(ColorRGBA.Black);
Picture pic = new Picture("fullscene");
pic.setLocalTranslation(-0.75f, -0.5f, 0f);
if (expand) {
pic.setLocalScale(3f, 1f, 1f);
} else {
pic.setLocalScale(1.5f, 1f, 1f);
}
pic.setQueueBucket(Bucket.Opaque);
pic.setTexture(environment.getApplication().getAssetManager(), (Texture2D) tex, false);
viewPort.attachScene(pic);
viewPort.setOutputFrameBuffer(null);
pic.updateGeometricState();
return viewPort;
} else {
throw new IllegalStateException("This VR environment is not attached to any application.");
}
} else {
throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
}
}
use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.
the class AbstractShadowRendererVR 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();
}
Aggregations