當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.getAssetManager方法代碼示例

本文整理匯總了Java中com.jme3.app.Application.getAssetManager方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getAssetManager方法的具體用法?Java Application.getAssetManager怎麽用?Java Application.getAssetManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.app.Application的用法示例。


在下文中一共展示了Application.getAssetManager方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
public void initialize(AppStateManager stateManager, Application app) {
    if (niftyXmlPath != null) {
        NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(),
                app.getInputManager(),
                app.getAudioRenderer(),
                app.getGuiViewPort());
        nifty = niftyDisplay.getNifty();
        nifty.fromXmlWithoutStartScreen(niftyXmlPath);
        app.getGuiViewPort().addProcessor(niftyDisplay);
    }
    for (CinematicEvent cinematicEvent : cinematicEvents) {
        cinematicEvent.initEvent(app, this);
    }



    initialized = true;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:19,代碼來源:Cinematic.java

示例2: ToolKit

import com.jme3.app.Application; //導入方法依賴的package包/類
protected ToolKit(Application application) {
	if (defaultInstance != null)
		throw new IllegalStateException("Toolkit already initialised.");
	defaultInstance = this;
	this.application = application;

	AssetManager assetManager = application.getAssetManager();
	assetManager.registerLoader(LayoutLoader.class, "yaml");
	assetManager.registerLoader(CssLoader.class, "css");
	assetManager.registerLoader(ThemeLoader.class, "theme");
	assetManager.unregisterLoader(BitmapFontLoader.class);
	assetManager.registerLoader(BitmapFontLoaderX.class, "fnt");

	styleManager = new StyleManager();
	

	thread = Thread.currentThread();
}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:19,代碼來源:ToolKit.java

示例3: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
protected void initialize(Application app) {
    rootNode = new Node("ZayES-Bullet Debug Root");
    customView = new BodyView<>(entityData, app.getAssetManager(), rootNode, CustomShape.class, shape -> MeshFactory.create(shape, customShapeFactory));
    boxView = new BodyView<>(entityData, app.getAssetManager(), rootNode, BoxShape.class, MeshFactory::create);
    sphereView = new BodyView<>(entityData, app.getAssetManager(), rootNode, SphereShape.class, MeshFactory::create);
    bodyPositions = entityData.getEntities(RigidBody.class, PhysicsPosition.class);
    positionMarkers = new PositionMarkers(entityData, app.getAssetManager(), rootNode);
    customView.start();
    boxView.start();
    sphereView.start();
    positionMarkers.start();
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:14,代碼來源:ESDebugViewState.java

示例4: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
protected void initialize(Application app) {
    sceneRoot = new Node("Shapes");
    assetManager = app.getAssetManager();
    containers = new ArrayList<>(4);
    containers.add(new BoxView.Container(entityData, app.getAssetManager(), sceneRoot));
    containers.add(new CylinderView.Container(entityData, app.getAssetManager(), sceneRoot));
    containers.add(new SphereView.Container(entityData, app.getAssetManager(), sceneRoot));
    containers.add(new CapsuleView.Container(entityData, app.getAssetManager(), sceneRoot));
    containers.forEach(SpatialContainer::start);
    shadedEntities = entityData.getEntities(ShadedColor.class);
    unshadedEntities = entityData.getEntities(UnshadedColor.class);
    locatedEntities = entityData.getEntities(ViewLocation.class);
    rotatedEntities = entityData.getEntities(ViewRotation.class);
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:16,代碼來源:ShapeViewState.java

示例5: install

import com.jme3.app.Application; //導入方法依賴的package包/類
/**
 * Install a scene loader to the asset manager.
 *
 * @param application the application.
 * @param processor   the processor.
 */
public static void install(@NotNull final Application application, @Nullable final FilterPostProcessor processor) {
    final AssetManager assetManager = application.getAssetManager();
    assetManager.registerLoader(SceneLoader.class, "j3o", "j3f", "j3s");
    SceneLoader.application = application;
    SceneLoader.processor = processor;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:13,代碼來源:SceneLoader.java

示例6: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
public void initialize(@NotNull final AppStateManager stateManager, @NotNull final Application application) {
    super.initialize(stateManager, application);
    this.application = application;
    this.assetManager = application.getAssetManager();

    if (getRootNode() == null) {
        setRootNode(((SimpleApplication) application).getRootNode());
    }

    loadMaterials(application);

    final Node rootNode = requireNonNull(getRootNode());
    rootNode.attachChild(debugRootNode);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:16,代碼來源:BulletDebugAppState.java

示例7: loadMaterials

import com.jme3.app.Application; //導入方法依賴的package包/類
private void loadMaterials(@NotNull final Application application) {

        final AssetManager assetManager = application.getAssetManager();

        if (debugBlue == null) {
            debugBlue = createDebugMaterial(assetManager, ColorRGBA.Blue);
        }

        if (debugGreen == null) {
            debugGreen = createDebugMaterial(assetManager, ColorRGBA.Green);
        }

        if (debugRed == null) {
            debugRed = createDebugMaterial(assetManager, ColorRGBA.Red);
        }

        if (debugYellow == null) {
            debugYellow = createDebugMaterial(assetManager, ColorRGBA.Yellow);
        }

        if (debugMagenta == null) {
            debugMagenta = createDebugMaterial(assetManager, ColorRGBA.Magenta);
        }

        if (debugPink == null) {
            debugPink = createDebugMaterial(assetManager, ColorRGBA.Pink);
        }
    }
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:29,代碼來源:BulletDebugAppState.java

示例8: initializeSound

import com.jme3.app.Application; //導入方法依賴的package包/類
private void initializeSound(final Application app) {
    AudioNode matchAudio = new AudioNode(app.getAssetManager(), "sound/Match_1.ogg");
    matchAudio.setLooping(true);
    matchAudio.setPositional(false);
    matchAudio.setVolume(3);
    rootNode.attachChild(matchAudio);
    matchAudio.play();
}
 
開發者ID:NintendoStuff,項目名稱:worldcup,代碼行數:9,代碼來源:MatchAppState.java

示例9: createBallShooter

import com.jme3.app.Application; //導入方法依賴的package包/類
/**
 * creates the necessary inputlistener and action to shoot balls from teh camera
 * @param app
 * @param rootNode
 * @param space
 */
public static void createBallShooter(final Application app, final Node rootNode, final PhysicsSpace space) {
    ActionListener actionListener = new ActionListener() {

        public void onAction(String name, boolean keyPressed, float tpf) {
            Sphere bullet = new Sphere(32, 32, 0.4f, true, false);
            bullet.setTextureMode(TextureMode.Projected);
            Material mat2 = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
            TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
            key2.setGenerateMips(true);
            Texture tex2 = app.getAssetManager().loadTexture(key2);
            mat2.setTexture("ColorMap", tex2);
            if (name.equals("shoot") && !keyPressed) {
                Geometry bulletg = new Geometry("bullet", bullet);
                bulletg.setMaterial(mat2);
                bulletg.setShadowMode(ShadowMode.CastAndReceive);
                bulletg.setLocalTranslation(app.getCamera().getLocation());
                RigidBodyControl bulletControl = new RigidBodyControl(1);
                bulletg.addControl(bulletControl);
                bulletControl.setLinearVelocity(app.getCamera().getDirection().mult(25));
                bulletg.addControl(bulletControl);
                rootNode.attachChild(bulletg);
                space.add(bulletControl);
            }
        }
    };
    app.getInputManager().addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    app.getInputManager().addListener(actionListener, "shoot");
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:35,代碼來源:PhysicsTestHelper.java

示例10: initEvent

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
public void initEvent(Application app, Cinematic cinematic) {
    audioRenderer = app.getAudioRenderer();
    audioNode = new AudioNode(audioRenderer, app.getAssetManager(), path, stream);
    setLoopMode(loopMode);

}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:8,代碼來源:SoundTrack.java

示例11: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);

//        LoggerFactory.getLogger(DebugUtil.class).info("Initting debugs for app: {}, with selected: {}.", app, selected);

        pool = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() - 1);
        rootNode = ((SimpleApplication)app).getRootNode();
        assetManager = app.getAssetManager();
    }
 
開發者ID:NemesisMate,項目名稱:UtilJME3-Debug,代碼行數:11,代碼來源:DebugStateProperties.java

示例12: load

import com.jme3.app.Application; //導入方法依賴的package包/類
private void load() {
    Application application = getApplication();
    AppStateManager stateManager = application.getStateManager();
    AssetManager assetManager = application.getAssetManager();
    ViewPort viewPort = application.getViewPort();
    Camera camera = application.getCamera();
    
    for (Spatial scene : viewPort.getScenes()) {
        if (scene instanceof Node) {
            ((Node) scene).attachChild(gameRoot);
            break;
        }
    }
    
    new Thread(() -> {
        try {
            progress = 25;
            progressBar.setText("Initializint camera...");
            CameraNode cameraNode = new CameraNode("camera", camera);
            progress = 30;
            progressBar.setText("Initializint skybox...");
            Spatial skyBox = assetManager.loadModel("Models/Skybox.j3o");
            skyBox.setLocalScale(camera.getFrustumFar());
            cameraNode.attachChild(skyBox);
            progress = 40;
            progressBar.setText("Initializint sunlight...");
            DirectionalLight sun = new DirectionalLight();
            sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
            sun.setColor(ColorRGBA.White);
            progress = 50;
            progressBar.setText("Initializint shadows...");
            DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, 1024, 2);
            dlsr.setLight(sun);
            progress = 70;
            progressBar.setText("Initializint Bullet...");
            BulletAppState bulletAppState = new BulletAppState();
            stateManager.attach(bulletAppState);
            progress = 99;
            progressBar.setText("Queueing Changes...");
            application.enqueue(() -> {
                gameRoot.attachChild(cameraNode);
                gameRoot.addLight(sun);
                viewPort.addProcessor(dlsr);
                progress = 100;
                return null;
            }).get();
            
        } catch (InterruptedException | ExecutionException ex) {
            Logger.getLogger(LoadingScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }).start();
}
 
開發者ID:SkidRunner,項目名稱:jME3-Examples,代碼行數:53,代碼來源:LoadingScreen.java


注:本文中的com.jme3.app.Application.getAssetManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。