本文整理汇总了Java中com.jme3.scene.plugins.ogre.OgreMeshKey类的典型用法代码示例。如果您正苦于以下问题:Java OgreMeshKey类的具体用法?Java OgreMeshKey怎么用?Java OgreMeshKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OgreMeshKey类属于com.jme3.scene.plugins.ogre包,在下文中一共展示了OgreMeshKey类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleInitApp
import com.jme3.scene.plugins.ogre.OgreMeshKey; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Spatial signpost = (Spatial) assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml"));
signpost.setMaterial( (Material) assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"));
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial( (Material) assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
// flourescent main light
pl = new PointLight();
pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal());
dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f));
rootNode.addLight(dl);
}
示例2: simpleInitApp
import com.jme3.scene.plugins.ogre.OgreMeshKey; //导入依赖的package包/类
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
flyCam.setMoveSpeed(100);
setupKeys();
this.cam.setFrustumFar(2000);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White.clone().multLocal(2));
dl.setDirection(new Vector3f(-1, -1, -1).normalize());
rootNode.addLight(dl);
AmbientLight am = new AmbientLight();
am.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(am);
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/quake3level.zip", HttpZipLocator.class.getName());
} else {
assetManager.registerLocator("quake3level.zip", ZipLocator.class.getName());
}
// create the geometry and attach it
MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
gameLevel = (Node) assetManager.loadAsset(key);
gameLevel.setLocalScale(0.1f);
// add a physics control, it will generate a MeshCollisionShape based on the gameLevel
gameLevel.addControl(new RigidBodyControl(0));
player = new PhysicsCharacter(new SphereCollisionShape(5), .01f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(60, 10, -60));
rootNode.attachChild(gameLevel);
getPhysicsSpace().addAll(gameLevel);
getPhysicsSpace().add(player);
}
示例3: simpleInitApp
import com.jme3.scene.plugins.ogre.OgreMeshKey; //导入依赖的package包/类
public void simpleInitApp() {
// this.flyCam.setMoveSpeed(2000);
// this.cam.setFrustumFar(10000);
MeshLoader.AUTO_INTERLEAVE = false;
// mat = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
// mat.setColor("Color", ColorRGBA.White);
// mat2 = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
assetManager.registerLocator("quake3level.zip", "com.jme3.asset.plugins.ZipLocator");
MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
Spatial scene = assetManager.loadModel(key);
// Spatial scene = assetManager.loadModel("Models/Teapot/teapot.obj");
// scene.scale(3);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(new Vector3f(-1, -1, -1).normalize());
rootNode.addLight(dl);
DirectionalLight dl2 = new DirectionalLight();
dl2.setColor(ColorRGBA.White);
dl2.setDirection(new Vector3f(1, -1, 1).normalize());
rootNode.addLight(dl2);
// generate octree
// tree = new Octree(scene, 20000);
tree = new Octree(scene, 50);
tree.construct();
ArrayList<Geometry> globalGeomList = new ArrayList<Geometry>();
tree.createFastOctnodes(globalGeomList);
tree.generateFastOctnodeLinks();
for (Geometry geom : globalGeomList){
geom.addLight(dl);
geom.addLight(dl2);
geom.updateGeometricState();
}
globalGeoms = globalGeomList.toArray(new Geometry[0]);
fastRoot = tree.getFastRoot();
octBox = tree.getBound();
viewPort.addProcessor(this);
}
示例4: loadAsset
import com.jme3.scene.plugins.ogre.OgreMeshKey; //导入依赖的package包/类
@Override
public synchronized Spatial loadAsset() {
if (isModified() && savable != null) {
return (Spatial) savable;
}
ProjectAssetManager mgr = getLookup().lookup(ProjectAssetManager.class);
if (mgr == null) {
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("File is not part of a project!\nCannot load without ProjectAssetManager."));
return null;
}
String name = getPrimaryFile().getName();
int idx = name.toLowerCase().indexOf(".mesh");
if(idx!=-1){
name = name.substring(0, idx);
}
String matName = ((OgreMeshKey)getAssetKey()).getMaterialName();
if(matName == null){
matName = name;
}
FileObject sourceMatFile = getPrimaryFile().getParent().getFileObject(matName, "material");
if (sourceMatFile == null || !sourceMatFile.isValid()) {
Confirmation msg = new NotifyDescriptor.Confirmation(
"No material file found for " + getPrimaryFile().getNameExt() + "\n"
+ "A file named " + matName + ".material should be in the same folder.\n"
+ "Press OK to import mesh only.",
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.WARNING_MESSAGE);
Object result = DialogDisplayer.getDefault().notify(msg);
if (!NotifyDescriptor.OK_OPTION.equals(result)) {
return null;
}
}
FileLock lock = null;
try {
lock = getPrimaryFile().lock();
mgr.deleteFromCache(getAssetKey());
listListener.start();
Spatial spatial = mgr.loadModel(getAssetKey());
listListener.stop();
savable = spatial;
lock.releaseLock();
return spatial;
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
} finally {
if (lock != null) {
lock.releaseLock();
}
}
return null;
}