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