• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DesktopAssetManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: reloadAsset

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
private void reloadAsset(FileNode asset) {
    if (asset == null) {
        return;
    }
    if (assetManager instanceof DesktopAssetManager) {
        ModelKey mk = new ModelKey(asset.getFullName());
        DesktopAssetManager dt = (DesktopAssetManager) assetManager;
        dt.deleteFromCache(mk);
    }
    if (project != null) {
        String fullName = asset.getFullName();
        for (dae.project.Level l : project.getLevels()) {
            if (asset.getExtension().equals("j3o")) {
                List<MeshObject> meshesToChange = l.descendantMatches(MeshObject.class);
                for (MeshObject mo : meshesToChange) {
                    MeshComponent mc = (MeshComponent) mo.getComponent("MeshComponent");
                    if (mc.getMeshFile().equals(fullName)) {
                        mo.reloadMesh();
                    }
                }
            } else if (asset.getExtension().equals("klatch")) {
                List<Klatch> klatchesToChange = l.descendantMatches(Klatch.class);
                for (Klatch k : klatchesToChange) {
                    if (k.getKlatchFile().equals(fullName)) {
                        Node parent = k.getParent();
                        Transform backup = k.getLocalTransform();
                        k.removeFromParent();

                        Klatch newversion = (Klatch) this.assetManager.loadModel(k.getKlatchFile());
                        newversion.setLocalTransform(backup);
                        parent.attachChild(newversion);
                        for (Spatial s : k.getChildren()) {
                            Object klatchpart = s.getUserData("klatchpart");
                            if (klatchpart != Boolean.TRUE) {
                                newversion.attachChild(s);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:44,代码来源:SandboxViewport.java


示例17: newAssetManager

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


示例18: simpleInitApp

import com.jme3.asset.DesktopAssetManager; //导入依赖的package包/类
@Override
    public void simpleInitApp() {
        
        Models();
        
        
        // Load a blender file. 
        DesktopAssetManager dsk = (DesktopAssetManager) assetManager;        
        ModelKey bk = new ModelKey("Models/blender_test_scene/blender_test_scene.blend");
        Node nd =  (Node) dsk.loadModel(bk); 
        
        //Create empty Scene Node
        Node ndscene = new Node("Scene");
        
        
        // Attach boxes with names and transformations of the blend file to a Scene
         for (int j=0; j<ndmd.getChildren().size();j++){
            String strmd = ndmd.getChild(j).getName();
                
            for (int i=0; i<nd.getChildren().size(); i++) {
                      
               String strndscene = nd.getChild(i).getName();
             if (strmd.length() < strndscene.length())  strndscene = strndscene.substring(0, strmd.length());
               
         
            if (strndscene.equals(strmd) == true){
                Geometry ndGet = (Geometry) ndmd.getChild(j).clone(false);
                ndGet.setName(nd.getChild(i).getName());
                ndGet.setLocalTransform(nd.getChild(i).getWorldTransform());
                ndscene.attachChild(ndGet);   
                 
         }    
         }
         }
           
        rootNode.attachChild(ndscene);

        // Clear Cache
        nd.detachAllChildren();
        nd.removeFromParent();
        dsk.clearCache();
  
        
        mat_sphr.setColor("Color", ColorRGBA.Yellow); //check if material is shared
        
        
        
        guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
        BitmapText ch = new BitmapText(guiFont, false);
        ch.setSize(guiFont.getCharSet().getRenderedSize());
        ch.setText("Transformations are loaded from blender_test_scene.blend"); // crosshairs
        ch.setColor(new ColorRGBA(1f,0.8f,0.1f,1f));
        ch.setLocalTranslation(settings.getWidth()*0.3f,settings.getHeight()*0.1f,0);
        guiNode.attachChild(ch);
        
        
        
        flyCam.setMoveSpeed(30);
        viewPort.setBackgroundColor(ColorRGBA.Gray);

}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:62,代码来源:BlenderSceneComposer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Structure类代码示例发布时间:2022-05-22
下一篇:
Java PsiElementListCellRenderer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap