当前位置: 首页>>代码示例>>Java>>正文


Java Node.addControl方法代码示例

本文整理汇总了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();
    }
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:37,代码来源:BulletDebugAppState.java

示例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();
    }
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:37,代码来源:BulletDebugAppState.java

示例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();
    }
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:37,代码来源:BulletDebugAppState.java

示例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;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:41,代码来源:JMEFilePreviewManager.java


注:本文中的com.jme3.scene.Node.addControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。