Search in sources :

Example 51 with Application

use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.

the class VRViewManagerOpenVR method setupFinalFullTexture.

private void setupFinalFullTexture(Camera cam) {
    if (environment != null) {
        if (environment.getApplication() != null) {
            // create offscreen framebuffer
            FrameBuffer out = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1);
            //offBuffer.setSrgb(true);
            //setup framebuffer's texture
            dualEyeTex = new Texture2D(cam.getWidth(), cam.getHeight(), Image.Format.RGBA8);
            dualEyeTex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
            dualEyeTex.setMagFilter(Texture.MagFilter.Bilinear);
            logger.config("Dual eye texture " + dualEyeTex.getName() + " (" + dualEyeTex.getImage().getId() + ")");
            logger.config("               Type: " + dualEyeTex.getType());
            logger.config("               Size: " + dualEyeTex.getImage().getWidth() + "x" + dualEyeTex.getImage().getHeight());
            logger.config("        Image depth: " + dualEyeTex.getImage().getDepth());
            logger.config("       Image format: " + dualEyeTex.getImage().getFormat());
            logger.config("  Image color space: " + dualEyeTex.getImage().getColorSpace());
            //setup framebuffer to use texture
            out.setDepthBuffer(Image.Format.Depth);
            out.setColorTexture(dualEyeTex);
            ViewPort viewPort = environment.getApplication().getViewPort();
            viewPort.setClearFlags(true, true, true);
            viewPort.setBackgroundColor(ColorRGBA.Black);
            viewPort.setOutputFrameBuffer(out);
        } 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.");
    }
}
Also used : Texture2D(com.jme3.texture.Texture2D) ViewPort(com.jme3.renderer.ViewPort) FrameBuffer(com.jme3.texture.FrameBuffer)

Example 52 with Application

use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.

the class VideoRecorderAppState method initialize.

@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = app;
    this.oldTimer = app.getTimer();
    app.setTimer(new IsoTimer(framerate));
    if (file == null) {
        String filename = System.getProperty("user.home") + File.separator + "jMonkey-" + System.currentTimeMillis() / 1000 + ".avi";
        file = new File(filename);
    }
    processor = new VideoProcessor();
    List<ViewPort> vps = app.getRenderManager().getPostViews();
    for (int i = vps.size() - 1; i >= 0; i--) {
        lastViewPort = vps.get(i);
        if (lastViewPort.isEnabled()) {
            break;
        }
    }
    lastViewPort.addProcessor(processor);
}
Also used : ViewPort(com.jme3.renderer.ViewPort) File(java.io.File)

Example 53 with Application

use of com.jme3.app.Application in project openmrs-core by openmrs.

the class HL7ServiceTest method processHL7InQueue_shouldParseOruR01MessageUsingOverriddenParserProvidedByAModule.

/**
 * @see HL7Service#processHL7InQueue(HL7InQueue)
 */
@Test
@Ignore("TRUNK-3945")
public void processHL7InQueue_shouldParseOruR01MessageUsingOverriddenParserProvidedByAModule() throws Exception {
    executeDataSet("org/openmrs/hl7/include/ORUTest-initialData.xml");
    Properties props = super.getRuntimeProperties();
    props.setProperty(ModuleConstants.RUNTIMEPROPERTY_MODULE_LIST_TO_LOAD, "org/openmrs/hl7/include/examplehl7handlers-0.1.omod");
    // the above module provides a handler for messages of type "ADR" with trigger "A19"
    ModuleUtil.startup(props);
    // the application context cannot restart here to load in the moduleApplicationContext that
    // calls the setHL7Handlers method so we're doing it manually here
    Class<Application> c = (Class<Application>) Context.loadClass("org.openmrs.module.examplehl7handlers.AlternateORUR01Handler");
    Application classInstance = c.newInstance();
    HashMap<String, Application> map = new HashMap<>();
    map.put("ORU_R01", classInstance);
    HL7ServiceImpl.getInstance().setHL7Handlers(map);
    HL7Service hl7service = Context.getHL7Service();
    // a valid ORU_R01
    HL7InQueue queueItem = hl7service.getHL7InQueue(1);
    // this will create 1 HL7InError item
    hl7service.processHL7InQueue(queueItem);
    List<HL7InError> errors = hl7service.getAllHL7InErrors();
    // get the last error, the one made by this test presumably
    HL7InError error = errors.get(errors.size() - 1);
    Assert.assertTrue(error.getErrorDetails().contains("In alternate oru r01 parser"));
    ModuleUtil.shutdown();
}
Also used : HashMap(java.util.HashMap) Properties(java.util.Properties) Application(ca.uhn.hl7v2.app.Application) Ignore(org.junit.Ignore) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 54 with Application

use of com.jme3.app.Application in project TeachingInSimulation by ScOrPiOzzy.

the class TestJmeToJFXImageView method makeJmeApplication.

@NotNull
private static JmeToJFXApplication makeJmeApplication() {
    final AppSettings settings = JmeToJFXIntegrator.prepareSettings(new AppSettings(true), 60);
    final JmeToJFXApplication application = new JmeToJFXApplication() {

        protected Spatial player;

        @Override
        public void simpleInitApp() {
            super.simpleInitApp();
            // stateManager.attach(new SceneCameraState());
            float aspect = (float) cam.getWidth() / cam.getHeight();
            // flyCam.setDragToRotate(true);
            cam.setFrustumPerspective(45f, aspect, 0.01f, 1000);
            assetManager.registerLocator("E:\\JME_SDKPROJ_HOME\\robot_assets\\assets\\", FileLocator.class);
            assetManager.registerLocator("http://192.168.1.19:8082/assets/", UrlLocator.class);
            player = assetManager.loadModel("Models\\elecComp\\DZ47LEC32.j3o");
            // player = assetManager.loadModel("Model/RT28N-32X/RT28N-32X.j3o");
            // Box b = new Box(1, 1, 1);
            // player = new Geometry("Player", b);
            // Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            // mat.setColor("Color", ColorRGBA.Blue);
            // player.setMaterial(mat);
            rootNode.attachChild(player);
        }
    };
    application.setSettings(settings);
    application.setShowSettings(false);
    return application;
}
Also used : JmeToJFXApplication(com.jme3x.jfx.injfx.JmeToJFXApplication) AppSettings(com.jme3.system.AppSettings) Spatial(com.jme3.scene.Spatial) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AppSettings (com.jme3.system.AppSettings)11 Material (com.jme3.material.Material)10 Vector2f (com.jme3.math.Vector2f)8 ViewPort (com.jme3.renderer.ViewPort)8 Geometry (com.jme3.scene.Geometry)8 Camera (com.jme3.renderer.Camera)6 Spatial (com.jme3.scene.Spatial)6 Texture2D (com.jme3.texture.Texture2D)6 Node (com.jme3.scene.Node)5 FrameBuffer (com.jme3.texture.FrameBuffer)5 KeyTrigger (com.jme3.input.controls.KeyTrigger)4 InputManager (com.jme3.input.InputManager)3 OSVR (com.jme3.input.vr.OSVR)3 VRAPI (com.jme3.input.vr.VRAPI)3 Application (ca.uhn.hl7v2.app.Application)2 BitmapText (com.jme3.font.BitmapText)2 MouseInput (com.jme3.input.MouseInput)2 ActionListener (com.jme3.input.controls.ActionListener)2 MouseButtonTrigger (com.jme3.input.controls.MouseButtonTrigger)2 Vector3f (com.jme3.math.Vector3f)2