當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。