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


Java SimpleApplication.getAssetManager方法代碼示例

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


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

示例1: makeFloor

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public static void makeFloor(SimpleApplication app) {    	
      Box box=new Box(160,.2f,160);
      Geometry floor=new Geometry("the Floor",box);
      floor.setLocalTranslation(0,-4f,0);
      Material mat1=new Material(app.getAssetManager(),"Common/MatDefs/Light/Lighting.j3md");
      mat1.setColor("Diffuse",new ColorRGBA(.54f,.68f,.16f,1f));
      mat1.setBoolean("UseMaterialColors",true);
      floor.setMaterial(mat1);
      
      CollisionShape floorcs=new MeshCollisionShape(floor.getMesh());
RigidBodyControl floor_phy=new RigidBodyControl(floorcs,0);
floor.addControl(floor_phy);
floor_phy.setPhysicsLocation(new Vector3f(0,-30,0));		
app.getStateManager().getState(BulletAppState.class).getPhysicsSpace().add(floor_phy);		
app.getRootNode().attachChild(floor);			
  }
 
開發者ID:riccardobl,項目名稱:jme3-bullet-vhacd,代碼行數:17,代碼來源:Commons.java

示例2: registerAction_ShowBound

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static void registerAction_ShowBound(SpatialExplorer se, SimpleApplication app) {
	Material matModel = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	matModel.setColor("Color", ColorRGBA.Orange);
	Material matWorld = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	matWorld.setColor("Color", ColorRGBA.Red);

	se.treeItemActions.add(new Action("Show Bounds", (evt) -> {
		Spatial target = ((TreeItem<Spatial>)evt.getSource()).getValue();
		app.enqueue(() -> {
			target.breadthFirstTraversal(new SceneGraphVisitorAdapter(){
				public void visit(Geometry geom) {
					ShowBoundsControl ctrl = geom.getControl(ShowBoundsControl.class);
					if (ctrl != null) {
						geom.removeControl(ctrl);
					} else {
						geom.addControl(new ShowBoundsControl(matModel, matWorld));
					}
				}
			});
			return null;
		});
	}));
}
 
開發者ID:davidB,項目名稱:jme3_ext_spatial_explorer,代碼行數:25,代碼來源:Helper.java

示例3: ShipWeaponControl

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public ShipWeaponControl(SimpleApplication asm, Node ship) {
    
    shipNode = ship;
    this.asm = asm;
    
     shape = new BoxCollisionShape(new Vector3f(0.15f, 0.15f, 0.5f));
     bullets = new Node("bullets");
     bulletTimer = 0f;
     fire = false;
    
    // Setup Bullet
    Box b = new Box(Vector3f.ZERO, 0.15f, 0.15f, 0.5f);
    bullet = new Geometry("Box", b);
    Material mat_bullet = new Material(asm.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    mat_bullet.setColor("Color", ColorRGBA.Red);
    bullet.setMaterial(mat_bullet);
    
    this.asm.getRootNode().attachChild(bullets);
            // add ourselves as collision listener
    
    bulletApp = asm.getStateManager().getState(BulletAppState.class);
    
    bulletApp.getPhysicsSpace().addCollisionListener(this);
    
}
 
開發者ID:mifth,項目名稱:JME-Simple-Examples,代碼行數:26,代碼來源:ShipWeaponControl.java

示例4: LabelAppState

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public LabelAppState(SimpleApplication app) {
    // pre grab values so no nullpointers are thrown
    assetManager = app.getAssetManager();
    guiNode = app.getGuiNode();
    cam = app.getCamera();

    offset = new Vector3f(-2.5f, 37.5f, 0f);
}
 
開發者ID:matthewseal,項目名稱:MoleculeViewer,代碼行數:9,代碼來源:LabelAppState.java

示例5: initializeEnvironment

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public static void initializeEnvironment(SimpleApplication simpleApplication){
    DirectionalLight directionalLight = new DirectionalLight();
    directionalLight.setDirection(lightDirection);
    directionalLight.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
    simpleApplication.getRootNode().addLight(directionalLight);
    simpleApplication.getRootNode().attachChild(SkyFactory.createSky(simpleApplication.getAssetManager(), "Textures/cubes/sky.jpg", true));
    
    DirectionalLightShadowRenderer directionalLightShadowRenderer = new DirectionalLightShadowRenderer(simpleApplication.getAssetManager(), 2048, 3);
    directionalLightShadowRenderer.setLight(directionalLight);
    directionalLightShadowRenderer.setShadowIntensity(0.3f);
    simpleApplication.getViewPort().addProcessor(directionalLightShadowRenderer);
}
 
開發者ID:jMonkeyEngine-Contributions,項目名稱:cubes,代碼行數:13,代碼來源:CubesTestAssets.java

示例6: getFilterPostProcessor

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
private static FilterPostProcessor getFilterPostProcessor(SimpleApplication simpleApplication){
    List<SceneProcessor> sceneProcessors = simpleApplication.getViewPort().getProcessors();
    for(int i=0;i<sceneProcessors.size();i++){
        SceneProcessor sceneProcessor = sceneProcessors.get(i);
        if(sceneProcessor instanceof FilterPostProcessor){
            return (FilterPostProcessor) sceneProcessor;
        }
    }
    FilterPostProcessor filterPostProcessor = new FilterPostProcessor(simpleApplication.getAssetManager());
    simpleApplication.getViewPort().addProcessor(filterPostProcessor);
    return filterPostProcessor;
}
 
開發者ID:jMonkeyEngine-Contributions,項目名稱:cubes,代碼行數:13,代碼來源:CubesTestAssets.java

示例7: makeScene

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public static Node makeScene(SimpleApplication app) {
	Node scene = new Node("_referential");
	AssetManager assetManager = app.getAssetManager();
	scene.attachChild(makeGrid(Vector3f.ZERO, 10, ColorRGBA.Blue, assetManager));
	scene.attachChild(makeCoordinateAxes(Vector3f.ZERO, assetManager));
	return scene;
}
 
開發者ID:davidB,項目名稱:jme3_ext_spatial_explorer,代碼行數:8,代碼來源:Helper.java

示例8: registerBarAction_SceneInWireframe

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public static void registerBarAction_SceneInWireframe(SpatialExplorer se, SimpleApplication app) {
	WireProcessor p = new WireProcessor(app.getAssetManager());
	se.barActions.add(makeAction("Scene In Wireframe", FontAwesome.Glyph.DIAMOND, (evt) -> {
		app.enqueue(() -> {
			if (app.getViewPort().getProcessors().contains(p)) {
				app.getViewPort().removeProcessor(p);
			} else {
				app.getViewPort().addProcessor(p);
			}
			return null;
		});
	}));
}
 
開發者ID:davidB,項目名稱:jme3_ext_spatial_explorer,代碼行數:14,代碼來源:Helper.java

示例9: HealthBarControl

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public HealthBarControl(SimpleApplication app, Spatial spatial) {
    this.app = app;
    float spatialHeight = ((BoundingBox) spatial.getWorldBound()).getYExtent() * 3.0f + (10.0f - (spatial.getLocalScale().y) * 10.0f);
    float spatialWidth  = 0.2f + (10.0f - (spatial.getLocalScale().x) * 10.0f)/4;
    //System.out.println("spatial height = " + spatialHeight + " widht = " + spatialWidth + 
    //        " scale = " + spatial.getLocalScale());
    Sphere health = new Sphere(16, 16, spatialWidth + 0.1f);
    Sphere healthBg = new Sphere(16, 16, spatialWidth + 0.2f);
    Geometry healthSphere = new  Geometry("healthSphere", health);
    Geometry healthSphereBg = new Geometry("healthSphereBg", healthBg);
    Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    Material materialBg = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", new ColorRGBA(1.0f, 0.0f, 0.0f, 0.8f));
    materialBg.setColor("Color", new ColorRGBA(0.5f, 0.5f, 0.5f, 0.5f));
    material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    materialBg.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    healthSphere.setMaterial(material);
    healthSphereBg.setMaterial(materialBg);
    healthSphere.setQueueBucket(RenderQueue.Bucket.Transparent);
    healthSphereBg.setQueueBucket(RenderQueue.Bucket.Transparent);
    healthSphereNode = new Node("healthSphereNode");
    healthSphereNode.attachChild(healthSphere);
    healthSphereNode.attachChild(healthSphereBg);
    ((Node) spatial).attachChild(healthSphereNode);
    // spatial height
    healthSphereNode.move(0.0f, spatialHeight , 0.0f);
    spatial.setUserData("health", 100);
}
 
開發者ID:duodecimo,項目名稱:magicallyous,代碼行數:29,代碼來源:HealthBarControl.java

示例10: lit

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public static Material lit( SimpleApplication sa, double r, double g, double b ) {

		Material mat = new Material( sa.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md" );
		mat.setColor( "Diffuse", new ColorRGBA( (float) r, (float) g, (float) b, 1 ) );
		mat.setColor( "Ambient", new ColorRGBA( (float) r, (float) g, (float) b, 1 ) );
		mat.setBoolean( "UseMaterialColors", true );
		return mat;
	}
 
開發者ID:twak,項目名稱:siteplan,代碼行數:9,代碼來源:Jme3z.java

示例11: initMaterial

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
static public void initMaterial(SimpleApplication app) {
	wmat = new Material(app.getAssetManager(),
			"Common/MatDefs/Light/Lighting.j3md");
	wmat.setBoolean("UseVertexColor", true);
	wmat.setBoolean("UseMaterialColors", true);
	wmat.setColor("Ambient", new ColorRGBA(0.5f, 0.5f, 1f, 1f));
	wmat.setColor("Diffuse", new ColorRGBA(0.5f, 0.5f, 1f, 1f));
	wmat.setColor("Specular", new ColorRGBA(0.5f, 0.5f, 1f, 1f));
	wmat.setBoolean("VertexLighting", true);
}
 
開發者ID:Daepso,項目名稱:minerim,代碼行數:11,代碼來源:Chunk.java

示例12: StartScreenState

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
public StartScreenState(SimpleApplication app){
  this.rootNode     = app.getRootNode();
  this.viewPort     = app.getViewPort();
  this.guiNode      = app.getGuiNode();
  this.assetManager = app.getAssetManager();  
}
 
開發者ID:devinbost,項目名稱:jMathGame3d,代碼行數:7,代碼來源:StartScreenState.java

示例13: initialize

import com.jme3.app.SimpleApplication; //導入方法依賴的package包/類
@Override
public void initialize(AppStateManager stateManager, Application app)
{
    super.initialize(stateManager, app);
    
    initialTime = System.currentTimeMillis();
    
    simpleApp = (SimpleApplication) app;
    
    this.stateManager = simpleApp.getStateManager();
    this.assetManager = simpleApp.getAssetManager();
    this.camera = simpleApp.getCamera();
    this.flyCam = simpleApp.getFlyByCamera();
    this.inputManager = simpleApp.getInputManager();
    this.rootNode = simpleApp.getRootNode();
    this.guiNode = simpleApp.getGuiNode();
    this.viewPort = simpleApp.getViewPort();
    
    Music.setAssetManager(assetManager);
    
    showTitle();

    setCamPosition();
 
    initCave();
    
    initAtmosphere(); 
    
    initFloorLighting();
    
    initFadeFilter();
    
    initKeyboardControls();
    
    Music.playIntroTheme();
    
    spiders = new LinkedList<>();
}
 
開發者ID:abnercoimbre,項目名稱:tower-defense-cave,代碼行數:39,代碼來源:StartScreenAppState.java

示例14: initialize

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

    simpleApp = (SimpleApplication) app;
    
    gameNarrator = new Narrator(stateManager, simpleApp.getAssetManager(), simpleApp.getGuiNode());

    initResources();

    initGUI();

    initBloomFilter();

    initCameraLighting();

    initStaticObjects();
    
    initForceShields();

    setMusicAndSound();
    
    setPlayerControls();
    
    attachNodes();
    
    initialTime = System.currentTimeMillis();
    
    initialTime2 = System.currentTimeMillis();
    
    gameNarrator.talk("W A S D and Arrow Keys to Navigate", 10);
}
 
開發者ID:abnercoimbre,項目名稱:tower-defense-cave,代碼行數:34,代碼來源:GameRunningAppState.java


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