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


Java Node.attachChild方法代码示例

本文整理汇总了Java中com.jme3.scene.Node.attachChild方法的典型用法代码示例。如果您正苦于以下问题:Java Node.attachChild方法的具体用法?Java Node.attachChild怎么用?Java Node.attachChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.scene.Node的用法示例。


在下文中一共展示了Node.attachChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
@JMEThread
public void initialize(@NotNull final AppStateManager stateManager, @NotNull final Application application) {
    super.initialize(stateManager, application);
    this.stateManager = stateManager;

    final Node rootNode = EDITOR.getRootNode();
    rootNode.attachChild(getStateNode());

    final TonegodTranslucentBucketFilter translucentBucketFilter = EDITOR.getTranslucentBucketFilter();
    translucentBucketFilter.setEnabled(true);

    final EditorCamera editorCamera = getEditorCamera();
    final InputManager inputManager = EDITOR.getInputManager();

    checkAndAddMappings(inputManager);
    registerActionListener(inputManager);
    registerAnalogListener(inputManager);

    if (editorCamera != null) {
        editorCamera.setEnabled(true);
        editorCamera.registerInput(inputManager);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:25,代码来源:AdvancedAbstractEditor3DState.java

示例2: render

import com.jme3.scene.Node; //导入方法依赖的package包/类
public void render( List<Prof> ofs, Tweed tweed, ColorRGBA col, Node n ) {

//		Random randy = new Random(ofs.hashCode());
		
		Material mat = new Material( tweed.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md" );
		
//		ColorRGBA col = new ColorRGBA(
//				randy.nextFloat(), 
//				0.2f+ 0.5f * randy.nextFloat(), 
//				0.5f+ 0.5f * randy.nextFloat(), 1);
		
		mat.setColor( "Diffuse", col );
		mat.setColor( "Ambient", col.mult( 0.1f ) );
		mat.setBoolean( "UseMaterialColors", true );
		
		for (Prof p : ofs) {
			Geometry g = new Geometry();
			g.setMesh( p.renderStrip(  TweedSettings.settings.profileHSampleDist/2, null ) );
			g.setMaterial( mat );
			n.attachChild( g );
		}
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:23,代码来源:ProfileGen.java

示例3: onAttached

import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
protected void onAttached(@NotNull final Node node) {
    super.onAttached(node);

    final Spatial editedModel = notNull(getEditedModel());
    final Geometry baseMarker = getBaseMarker();
    final Geometry targetMarker = getTargetMarker();
    final Geometry line = getLine();

    final Node markersNode = component.getMarkersNode();
    markersNode.attachChild(baseMarker);
    markersNode.attachChild(targetMarker);
    markersNode.attachChild(line);

    baseMarker.setLocalTranslation(editedModel.getWorldTranslation());
    targetMarker.setLocalTranslation(editedModel.getWorldTranslation());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:SlopeTerrainToolControl.java

示例4: updateAudioShowedImpl

import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
 * The process to change audio showing.
 */
@JMEThread
private void updateAudioShowedImpl(final boolean showed) {
    if (showed == isAudioShowed()) return;

    final Node audioNode = getAudioNode();
    final Node modelNode = getModelNode();

    if (showed) {
        modelNode.attachChild(audioNode);
    } else {
        modelNode.detachChild(audioNode);
    }

    setAudioShowed(showed);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:SceneEditor3DState.java

示例5: loadImpl

import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
 * Load the audio data.
 *
 * @param audioData the audio data.
 * @param audioKey  the audio key.
 */
@JMEThread
private void loadImpl(@NotNull final AudioData audioData, @NotNull final AudioKey audioKey) {
    removeAudioNode();
    setAudioData(audioData);
    setAudioKey(audioKey);

    final Node stateNode = getStateNode();

    final AudioNode audioNode = new AudioNode(audioData, audioKey);
    audioNode.setPositional(false);
    stateNode.attachChild(audioNode);

    setAudioNode(audioNode);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:AudioViewer3DState.java

示例6: controlUpdate

import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
protected void controlUpdate(float tpf) {
    if (myShape != body.getCollisionShape()) {
        Node node = (Node) this.spatial;
        node.detachChild(geom);
        geom = DebugShapeFactory.getDebugShape(body.getCollisionShape());
        //  geom.setMaterial(debugAppState.DEBUG_YELLOW);
        node.attachChild(geom);
    }
    applyPhysicsTransform(body.getPhysicsLocation(location), body.getPhysicsRotation(rotation));
    geom.setLocalScale(body.getCollisionShape()
                           .getScale());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:14,代码来源:BulletGhostObjectDebugControl.java

示例7: onAttached

import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
protected void onAttached(@NotNull final Node node) {
    super.onAttached(node);

    final Spatial editedModel = notNull(getEditedModel());
    final Geometry levelMarker = getLevelMarker();

    final Node markersNode = component.getMarkersNode();
    markersNode.attachChild(levelMarker);

    levelMarker.setLocalTranslation(editedModel.getWorldTranslation());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:13,代码来源:LevelTerrainToolControl.java

示例8: initialize

import com.jme3.scene.Node; //导入方法依赖的package包/类
@Override
public void initialize(@NotNull final AppStateManager stateManager, @NotNull final Application application) {
    super.initialize(stateManager, application);
    this.application = application;
    this.assetManager = application.getAssetManager();

    if (getRootNode() == null) {
        setRootNode(((SimpleApplication) application).getRootNode());
    }

    loadMaterials(application);

    final Node rootNode = requireNonNull(getRootNode());
    rootNode.attachChild(debugRootNode);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:16,代码来源:BulletDebugAppState.java

示例9: createPlayer

import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
 * Create a new player.
 * @param parentNode Parent of player. Should be root node.
 * @param playerIdx Order of created player starting at 0.
 * @return Spatial of new player.
 */
private Spatial createPlayer(Node parentNode, int playerIdx) {
  // Currently a simple box is used for the player.
  Box box = new Box(1, 1, 1);
  Geometry player = new Geometry("PLAYER" + playerIdx, box);

  Material mat = new Material(application.getAssetManager(),
      "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", ColorRGBA.Blue);
  player.setMaterial(mat);

  // Move player in front of first course point.
  Spatial[] coursePoints = coursePath.getCoursePoints();
  if (coursePoints.length > 0) {
    Spatial startPoint = coursePoints[0];
    Vector3f forward = startPoint.getWorldRotation().mult(Vector3f.UNIT_Z);
    player.move(forward.mult(PLAYER_START_DISTANCE));
  }

  // Attribute that this is a player.
  player.setUserData(IS_PLAYER_ATTR, true);
  // Add physics to player
  CollisionShape shape = CollisionShapeFactory.createBoxShape(player);
  GhostControl playerPhysics = new GhostControl(shape);
  player.addControl(playerPhysics);
  bullet.getPhysicsSpace().add(playerPhysics);

  // Attach to root node and course path.
  parentNode.attachChild(player);
  coursePath.addPlayer(player);
  return player;
}
 
开发者ID:meoblast001,项目名称:seally-racing,代码行数:38,代码来源:PlayerManager.java

示例10: AdvancedPBRWithStudioSky3DEditorState

import com.jme3.scene.Node; //导入方法依赖的package包/类
public AdvancedPBRWithStudioSky3DEditorState(@NotNull final T fileEditor) {
    super(fileEditor);

    final AssetManager assetManager = EDITOR.getAssetManager();

    final Geometry sky = (Geometry) SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr",
            SkyFactory.EnvMapType.EquirectMap);

    final Node stateNode = getStateNode();
    stateNode.attachChild(sky);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:12,代码来源:AdvancedPBRWithStudioSky3DEditorState.java

示例11: 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

示例12: notifyProbeComplete

import com.jme3.scene.Node; //导入方法依赖的package包/类
/**
 * Activate the node with models.
 */
@JMEThread
private void notifyProbeComplete() {

    final Node stateNode = getStateNode();
    stateNode.attachChild(getModelNode());
    stateNode.attachChild(getToolNode());

    final Node customSkyNode = getCustomSkyNode();
    customSkyNode.detachAllChildren();

    final TonegodTranslucentBucketFilter translucentBucketFilter = EDITOR.getTranslucentBucketFilter();
    translucentBucketFilter.refresh();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:ModelEditor3DState.java

示例13: ModelEditor3DState

import com.jme3.scene.Node; //导入方法依赖的package包/类
public ModelEditor3DState(final ModelFileEditor fileEditor) {
    super(fileEditor);
    this.customSkyNode = new Node("Custom Sky");
    this.customSky = ArrayFactory.newArray(Spatial.class);

    final Node stateNode = getStateNode();
    stateNode.attachChild(getCustomSkyNode());

    setLightEnabled(true);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:11,代码来源:ModelEditor3DState.java

示例14: Container

import com.jme3.scene.Node; //导入方法依赖的package包/类
public Container(EntityData ed, AssetManager assetManager, Node root) {
    super(ed, CapsuleView.class);
    this.root = new Node(CapsuleView.class.getSimpleName()+" root");
    root.attachChild(this.root);
    this.assetManager = assetManager;
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:7,代码来源:CapsuleView.java

示例15: ShapeContainer

import com.jme3.scene.Node; //导入方法依赖的package包/类
public ShapeContainer(EntityData ed, AssetManager assetManager, Node root, Class<? extends EntityComponent> viewComponent) {
    super(ed, viewComponent);
    this.root = new Node(viewComponent.getSimpleName()+" root");
    root.attachChild(this.root);
    this.assetManager = assetManager;
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:7,代码来源:ShapeContainer.java


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