本文整理匯總了Java中com.jme3.scene.Node.addControl方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.addControl方法的具體用法?Java Node.addControl怎麽用?Java Node.addControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.scene.Node
的用法示例。
在下文中一共展示了Node.addControl方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateRigidBodies
import com.jme3.scene.Node; //導入方法依賴的package包/類
private void updateRigidBodies() {
final Filter filter = getFilter();
final Map<PhysicsRigidBody, Spatial> prevBodies = getPrevBodies();
final Map<PhysicsRigidBody, Spatial> bodies = getBodies();
prevBodies.putAll(bodies);
bodies.clear();
final Collection<PhysicsRigidBody> current = physicsSpace.getRigidBodyList();
for (final PhysicsRigidBody object : current) {
// copy existing spatials
if (prevBodies.containsKey(object)) {
bodies.put(object, prevBodies.get(object));
} else {
if (filter == null || filter.test(object)) {
//create new spatial
final Node node = new Node(object.toString());
node.addControl(new BulletRigidBodyDebugControl(this, object));
bodies.put(object, node);
debugRootNode.attachChild(node);
}
}
}
for (final Map.Entry<PhysicsRigidBody, Spatial> entry : prevBodies.entrySet()) {
if(!bodies.containsKey(entry.getKey())) {
entry.getValue().removeFromParent();
}
}
prevBodies.clear();
}
示例2: updateCharacters
import com.jme3.scene.Node; //導入方法依賴的package包/類
private void updateCharacters() {
final Filter filter = getFilter();
final Map<PhysicsCharacter, Spatial> prevCharacters = getPrevCharacters();
final Map<PhysicsCharacter, Spatial> characters = getCharacters();
prevCharacters.putAll(characters);
characters.clear();
final Collection<PhysicsCharacter> current = physicsSpace.getCharacterList();
for (final PhysicsCharacter object : current) {
// copy existing spatials
if (prevCharacters.containsKey(object)) {
characters.put(object, prevCharacters.get(object));
} else {
if (filter == null || filter.test(object)) {
//create new spatial
final Node node = new Node(object.toString());
node.addControl(new BulletCharacterDebugControl(this, object));
characters.put(object, node);
debugRootNode.attachChild(node);
}
}
}
for (final Map.Entry<PhysicsCharacter, Spatial> entry : prevCharacters.entrySet()) {
if(!characters.containsKey(entry.getKey())) {
entry.getValue().removeFromParent();
}
}
prevCharacters.clear();
}
示例3: updateVehicles
import com.jme3.scene.Node; //導入方法依賴的package包/類
private void updateVehicles() {
final Filter filter = getFilter();
final Map<PhysicsVehicle, Spatial> prevVehicles = getPrevVehicles();
final Map<PhysicsVehicle, Spatial> vehicles = getVehicles();
prevVehicles.putAll(vehicles);
vehicles.clear();
final Collection<PhysicsVehicle> current = physicsSpace.getVehicleList();
for (final PhysicsVehicle object : current) {
// copy existing spatials
if (prevVehicles.containsKey(object)) {
vehicles.put(object, prevVehicles.get(object));
} else {
if (filter == null || filter.test(object)) {
//create new spatial
final Node node = new Node(object.toString());
node.addControl(new BulletVehicleDebugControl(this, object));
vehicles.put(object, node);
debugRootNode.attachChild(node);
}
}
}
for (final Map.Entry<PhysicsVehicle, Spatial> entry : prevVehicles.entrySet()) {
if(!vehicles.containsKey(entry.getKey())) {
entry.getValue().removeFromParent();
}
}
prevVehicles.clear();
}
示例4: prepareScene
import com.jme3.scene.Node; //導入方法依賴的package包/類
/**
* Prepare a transfer processor to transfer preview result to a image view.
*
* @return the transfer processor.
*/
@JMEThread
private @NotNull FrameTransferSceneProcessor prepareScene() {
final Editor editor = Editor.getInstance();
final AssetManager assetManager = editor.getAssetManager();
final Spatial sky = SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr",
SkyFactory.EnvMapType.EquirectMap);
final DirectionalLight light = new DirectionalLight();
light.setDirection(LIGHT_DIRECTION);
final Node cameraNode = new Node("Camera node");
final Node rootNode = editor.getPreviewNode();
rootNode.addControl(this);
rootNode.attachChild(sky);
rootNode.addLight(light);
rootNode.attachChild(cameraNode);
rootNode.attachChild(modelNode);
final Camera camera = editor.getPreviewCamera();
final EditorCamera editorCamera = new EditorCamera(camera, cameraNode);
editorCamera.setMaxDistance(10000);
editorCamera.setMinDistance(0.01F);
editorCamera.setSmoothMotion(false);
editorCamera.setRotationSensitivity(1);
editorCamera.setZoomSensitivity(0.2F);
//TODO added supporting moving the camera
processor = bind(editor, imageView, imageView, editor.getPreviewViewPort(), false);
processor.setTransferMode(ON_CHANGES);
processor.setEnabled(false);
return processor;
}