本文整理匯總了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;
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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();
}
示例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");
}
示例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);
}
示例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();
}
示例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();
}