当前位置: 首页>>代码示例>>Java>>正文


Java DesktopAssetManager类代码示例

本文整理汇总了Java中com.jme3.asset.DesktopAssetManager的典型用法代码示例。如果您正苦于以下问题:Java DesktopAssetManager类的具体用法?Java DesktopAssetManager怎么用?Java DesktopAssetManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DesktopAssetManager类属于com.jme3.asset包,在下文中一共展示了DesktopAssetManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uploadTextureBitmap

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
/**
 * <code>uploadTextureBitmap</code> uploads a native android bitmap
 * @param target
 * @param bitmap
 * @param generateMips
 * @param powerOf2
 */
public static void uploadTextureBitmap(final int target, Bitmap bitmap, boolean generateMips, boolean powerOf2) {
    int MAX_RETRY_COUNT = 1;
    for(int retryCount = 0;retryCount<MAX_RETRY_COUNT;retryCount++) {
        try {
            uploadTextureBitmap2(target, bitmap, generateMips, powerOf2);
        }catch(OutOfMemoryError ex) {
            if (!(retryCount < MAX_RETRY_COUNT)){
                throw ex;
            }
            DesktopAssetManager assetManager = 
                    (DesktopAssetManager)((AndroidHarness)JmeSystem.getActivity())
                    .getJmeApplication().getAssetManager();
            assetManager.clearCache();
            System.gc();
            System.runFinalization();
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:26,代码来源:TextureUtil.java

示例2: AudioApp

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public AudioApp(){
    AppSettings settings = new AppSettings(true);
    settings.setRenderer(null); // force dummy renderer (?)
    settings.setAudioRenderer(AppSettings.LWJGL_OPENAL);
    audioRenderer = JmeSystem.newAudioRenderer(settings);
    audioRenderer.initialize();
    assetManager = new DesktopAssetManager(true);

    listener = new Listener();
    audioRenderer.setListener(listener);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:AudioApp.java

示例3: main

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public static void main(String[] args){
    AssetManager am = new DesktopAssetManager();

    am.registerLoader(AWTLoader.class.getName(), "png");
    am.registerLoader(WAVLoader.class.getName(), "wav");

    // register absolute locator
    am.registerLocator("/",  ClasspathLocator.class.getName());

    // find a sound
    AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");

    // find a texture
    Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.png");

    if (audio == null)
        throw new RuntimeException("Cannot find audio!");
    else
        System.out.println("Audio loaded from Sounds/Effects/Gun.wav");

    if (tex == null)
        throw new RuntimeException("Cannot find texture!");
    else
        System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.png");

    System.out.println("Success!");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:28,代码来源:TestAbsoluteLocators.java

示例4: reload

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public void reload() {
	if (selectedTheme == null)
		throw new IllegalStateException("Cannot reload when no theme is selected.");
	if (defaultStyle != null) {
		defaultStyle.deinit();
	}
	AssetManager mgr = ToolKit.get().getApplication().getAssetManager();
	if (mgr instanceof DesktopAssetManager) {
		((DesktopAssetManager) mgr).clearCache();
	}
	init();
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:13,代码来源:StyleManager.java

示例5: VehicleEditorController

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public VehicleEditorController(JmeSpatial jmeRootNode, BinaryModelDataObject currentFileObject) {
    this.jmeRootNode = jmeRootNode;
    this.currentFileObject = currentFileObject;
    rootNode = jmeRootNode.getLookup().lookup(Node.class);
    toolsNode = new Node("ToolsNode");
    toolController = new SceneToolController(toolsNode, currentFileObject.getLookup().lookup(ProjectAssetManager.class));
    toolController.setShowSelection(true);
    result = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class);
    result.addLookupListener(this);
    toolsNode.addLight(new DirectionalLight());
    Node track = (Node) new DesktopAssetManager(true).loadModel("Models/Racetrack/Raceway.j3o");
    track.getChild("Grass").getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(30, -1, 0));
    track.getChild("Grass").getControl(RigidBodyControl.class).setPhysicsRotation(new Quaternion().fromAngleAxis(FastMath.HALF_PI * 0.68f, Vector3f.UNIT_Y).toRotationMatrix());
    track.getChild("Road").getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(30, 0, 0));
    track.getChild("Road").getControl(RigidBodyControl.class).setPhysicsRotation(new Quaternion().fromAngleAxis(FastMath.HALF_PI * 0.68f, Vector3f.UNIT_Y).toRotationMatrix());
    toolsNode.attachChild(track);
    bulletState = new BulletAppState();

    result2 = Utilities.actionsGlobalContext().lookupResult(VehicleWheel.class);
    LookupListener listener = new LookupListener() {

        public void resultChanged(LookupEvent ev) {
            for (Iterator<? extends VehicleWheel> it = result2.allInstances().iterator(); it.hasNext();) {
                VehicleWheel wheel = it.next();
                toolController.updateSelection(wheel.getWheelSpatial());
            }
        }
    };
    result2.addLookupListener(listener);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:31,代码来源:VehicleEditorController.java

示例6: ImportWorldForgeAction

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public ImportWorldForgeAction(AssetPackProject context) {
    this.project = context;
    pm = project.getProjectAssetManager();
    folder = pm.getAssetFolder();
    mgr = new DesktopAssetManager(true);
    mgr.registerLocator(folder.getPath(), "com.jme3.asset.plugins.FileLocator");
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:8,代码来源:ImportWorldForgeAction.java

示例7: setUp

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
@Before
public void setUp() {
	HeadlessContext hc = new HeadlessContext();
	assertTrue(hc.createOpenCLContext(false));
	clPlatform = hc.getClPlatform();
	clDevice = hc.getClDevice();
	clContext = hc.getClContext();
	clCommandQueue = clContext.createQueue(clDevice);
	assetManager = new DesktopAssetManager(true);
	settings = new OpenCLSettings(clContext, clCommandQueue, null, assetManager);
	LOG.info("OpenCL initialized");
	rand = new Random();
}
 
开发者ID:shamanDevel,项目名称:jME3-OpenCL-Library,代码行数:14,代码来源:AbstractOpenCLTest.java

示例8: getAssetManager

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public static AssetManager getAssetManager() {
    if (app == null) {
        DesktopAssetManager am = new DesktopAssetManager(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
        return am;
    }
    return app.getAssetManager();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:8,代码来源:LuoYing.java

示例9: getUIConfig

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
/**
 * 获取默认的UI配置
 * @return 
 */
public static UIConfig getUIConfig() {
    if (uiConfig == null) {
        AssetManager assetManager = new DesktopAssetManager(
                Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
        uiConfig = new UIConfigImpl(assetManager);
    }
    return uiConfig;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:13,代码来源:UIFactory.java

示例10: reloadAssets

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public void reloadAssets() {
	if (ConfigurationService.getInstance().getGameFolder().equals(ConfigurationService.DEFAULT_GAME_NAME)) {
		ConfigurationService.getInstance().initGameFolder();
		ConfigurationService.getInstance().save();
	}
	TextureService.getInstance().loadTileTexture();
	ExternalModelService.getInstance().clear();
	CardService.getInstance().loadCardInventory();
	DiceService.getInstance().loadDiceTypes();

	HexScapeCore.getInstance().getHexScapeJme3Application().enqueue(new Callable<Void>() {

		@Override
		public Void call() throws Exception {
			TitleScreen.getInstance().populateNode();
			if (HexScapeCore.getInstance().getMapManager() != null) {
				AssetManager assetManager = HexScapeCore.getInstance().getHexScapeJme3Application().getAssetManager(); 
				if (assetManager instanceof DesktopAssetManager) {
					((DesktopAssetManager) assetManager).clearCache();
				}
				
				HexScapeCore.getInstance().getMapManager().redraw();
			}
			return null;
		}

	});
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:29,代码来源:AssetService.java

示例11: main

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public static void main(String[] args){
    AssetManager am = new DesktopAssetManager();

    am.registerLoader(AWTLoader.class.getName(), "jpg");
    am.registerLoader(WAVLoader.class.getName(), "wav");

    // register absolute locator
    am.registerLocator("/",  ClasspathLocator.class.getName());

    // find a sound
    AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");

    // find a texture
    Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg");

    if (audio == null)
        throw new RuntimeException("Cannot find audio!");
    else
        System.out.println("Audio loaded from Sounds/Effects/Gun.wav");

    if (tex == null)
        throw new RuntimeException("Cannot find texture!");
    else
        System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.jpg");

    System.out.println("Success!");
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:28,代码来源:TestAbsoluteLocators.java

示例12: actionPerformed

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public void actionPerformed(ActionEvent ev) {
    final ProjectAssetManager manager = context.getLookup().lookup(ProjectAssetManager.class);
    if (manager == null) {
        return;
    }
    Runnable call = new Runnable() {

        public void run() {
            ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Opening in Terrain Editor");
            progressHandle.start();

            
            final Spatial asset = context.loadAsset();

            if(asset!=null){
                java.awt.EventQueue.invokeLater(new Runnable() {

                    public void run() {
                        ((DesktopAssetManager)manager.getManager()).clearCache();
                        TerrainEditorTopComponent composer = TerrainEditorTopComponent.findInstance();
                        composer.openScene(asset, context, manager);
                    }
                });
            }else {
                Confirmation msg = new NotifyDescriptor.Confirmation(
                        "Error opening " + context.getPrimaryFile().getNameExt(),
                        NotifyDescriptor.OK_CANCEL_OPTION,
                        NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notify(msg);
            }
            progressHandle.finish();
        }
    };
    new Thread(call).start();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:36,代码来源:EditTerrainAction.java

示例13: NiftyJmeDisplay

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public NiftyJmeDisplay(AssetManager assetManager, 
                       InputSystem inputManager,
                       AudioRenderer audioRenderer,
                       ViewPort vp){
    this.assetManager = assetManager;
    //TODO: move
    ((DesktopAssetManager)assetManager).clearCache();
    w = vp.getCamera().getWidth();
    h = vp.getCamera().getHeight();

    soundDev = new SoundDeviceJme(assetManager, audioRenderer);
    renderDev = new RenderDeviceJme(this);
    nifty = new Nifty(renderDev, soundDev, inputManager, new TimeProvider());
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:15,代码来源:NiftyJmeDisplay.java

示例14: main

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public static void main(String[] args){
    AssetManager am = new DesktopAssetManager();

    am.registerLocator("http://www.jmonkeyengine.com/wp-content/uploads/2010/09/",
                       UrlLocator.class);

    am.registerLocator("town.zip", ZipLocator.class);
    am.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip",
                       HttpZipLocator.class);
    
    
    am.registerLocator("/", ClasspathLocator.class);
    
    

    // Try loading from Core-Data source package
    AssetInfo a = am.locateAsset(new AssetKey<Object>("Interface/Fonts/Default.fnt"));

    // Try loading from town scene zip file
    AssetInfo b = am.locateAsset(new ModelKey("casaamarela.jpg"));

    // Try loading from wildhouse online scene zip file
    AssetInfo c = am.locateAsset(new ModelKey("glasstile2.png"));

    // Try loading directly from HTTP
    AssetInfo d = am.locateAsset(new TextureKey("planet-2.jpg"));

    if (a == null)
        System.out.println("Failed to load from classpath");
    else
        System.out.println("Found classpath font: " + a.toString());

    if (b == null)
        System.out.println("Failed to load from town.zip");
    else
        System.out.println("Found zip image: " + b.toString());

    if (c == null)
        System.out.println("Failed to load from wildhouse.zip on googlecode.com");
    else
        System.out.println("Found online zip image: " + c.toString());

    if (d == null)
        System.out.println("Failed to load from HTTP");
    else
        System.out.println("Found HTTP showcase image: " + d.toString());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:48,代码来源:TestManyLocators.java

示例15: newAssetManager

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
public static AssetManager newAssetManager(URL configFile) {
    return new DesktopAssetManager(configFile);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:JmeSystem.java


注:本文中的com.jme3.asset.DesktopAssetManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。