本文整理匯總了Java中com.jme3.scene.BatchNode類的典型用法代碼示例。如果您正苦於以下問題:Java BatchNode類的具體用法?Java BatchNode怎麽用?Java BatchNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BatchNode類屬於com.jme3.scene包,在下文中一共展示了BatchNode類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import com.jme3.scene.BatchNode; //導入依賴的package包/類
@Override
public void update(float tpf) {
if(entities.applyChanges()) {
removeModels(entities.getRemovedEntities());
addModels(entities.getAddedEntities());
updateModels(entities.getChangedEntities());
}
for(BatchNode batchNode : batchedNodes.values()) {
if(batchNode.getUserData("batched").equals(false)) {
batchNode.setUserData("batched", true);
batchNode.batch();
}
}
}
示例2: removeModels
import com.jme3.scene.BatchNode; //導入依賴的package包/類
private void removeModels(Set<Entity> entities) {
for(Entity e : entities) {
Spatial s = models.remove(e.getId());
BatchNode batchNode = batchedNodes.get(s.getName());
s.removeFromParent();
if(batchNode.getChildren().isEmpty()) {
batchNode.removeFromParent();
batchedNodes.remove(s.getName());
}
}
}
示例3: BatchZone
import com.jme3.scene.BatchNode; //導入依賴的package包/類
public BatchZone(String name, Vector3f center, float xExtent, float yExtent, float zExtent) {
batchZoneNode = new BatchNode(name);
bb = new BoundingBox(center, xExtent, yExtent, zExtent);
}
示例4: VisualAppState
import com.jme3.scene.BatchNode; //導入依賴的package包/類
public VisualAppState() {
this.models = new HashMap<EntityId, Spatial>();
this.batchedNodes = new HashMap<String, BatchNode>();
}
示例5: simpleInitApp
import com.jme3.scene.BatchNode; //導入依賴的package包/類
@Override
public void simpleInitApp() {
timer = new NanoTimer();
batch = new BatchNode("theBatchNode");
/**
* A cube with a color "bleeding" through transparent texture. Uses
* Texture from jme3-test-data library!
*/
Box boxshape4 = new Box(Vector3f.ZERO, 1f, 1f, 1f );
cube = new Geometry("cube1", boxshape4);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
cube.setMaterial(mat);
// Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
// mat.setColor("Diffuse", ColorRGBA.Blue);
// mat.setBoolean("UseMaterialColors", true);
/**
* A cube with a color "bleeding" through transparent texture. Uses
* Texture from jme3-test-data library!
*/
Box box = new Box(Vector3f.ZERO, 1f, 1f, 1f);
cube2 = new Geometry("cube2", box);
cube2.setMaterial(mat);
TangentBinormalGenerator.generate(cube);
TangentBinormalGenerator.generate(cube2);
n = new Node("aNode");
// n.attachChild(cube2);
batch.attachChild(cube);
batch.attachChild(cube2);
// batch.setMaterial(mat);
batch.batch();
rootNode.attachChild(batch);
cube.setLocalTranslation(3, 0, 0);
cube2.setLocalTranslation(0, 3, 0);
dl=new DirectionalLight();
dl.setColor(ColorRGBA.White.mult(2));
dl.setDirection(new Vector3f(1, -1, -1));
rootNode.addLight(dl);
flyCam.setMoveSpeed(10);
}