本文整理汇总了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;
}