com.ardor3d.scenegraph.Node.attachChild()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中com.ardor3d.scenegraph.Node.attachChild()方法的一些代码示例,展示了Node.attachChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.attachChild()方法的具体详情如下:
包路径:com.ardor3d.scenegraph.Node
类名称:Node
方法名:attachChild

Node.attachChild介绍

[英]attachChild attaches a child to this node. This node becomes the child's parent. The current number of children maintained is returned.
If the child already had a parent it is detached from that former parent.
[中]attachChild将子节点附加到此节点。此节点将成为子节点的父节点。返回当前维护的子级数。
如果孩子已经有了父母,它就会与以前的父母分离。

代码示例

代码示例来源:origin: com.ardor3d/ardor3d-core

@Override
public int attachChild(final Spatial child) {
  return _targetScene.attachChild(child);
}

代码示例来源:origin: Renanse/Ardor3D

public MovePlanarWidget withHandle(final Spatial handle) {
  _handle.attachChild(handle);
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public int attachChild(final Spatial child) {
  return _targetScene.attachChild(child);
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public int attachChild(final Spatial child) {
  if (!(child instanceof TextMesh)) {
    throw new IllegalArgumentException("Must be a TextMesh!");
  }
  return super.attachChild(child);
}

代码示例来源:origin: com.ardor3d/ardor3d-ui

@Override
public int attachChild(final Spatial child) {
  if (!(child instanceof TextMesh)) {
    throw new IllegalArgumentException("Must be a TextMesh!");
  }
  return super.attachChild(child);
}

代码示例来源:origin: Renanse/Ardor3D

private MoveWidget verifyMoveWidget() {
  MoveWidget moveWidget = (MoveWidget) _widgets.get(CompoundInteractWidget.MOVE_KEY);
  if (moveWidget == null) {
    moveWidget = new MoveWidget(_filters);
    _widgets.put(CompoundInteractWidget.MOVE_KEY, moveWidget);
    _handle.attachChild(moveWidget.getHandle());
  }
  return moveWidget;
}

代码示例来源:origin: Renanse/Ardor3D

private RotateWidget verifyRotateWidget() {
  RotateWidget rotateWidget = (RotateWidget) _widgets.get(CompoundInteractWidget.ROTATE_KEY);
  if (rotateWidget == null) {
    rotateWidget = new RotateWidget(_filters);
    _widgets.put(CompoundInteractWidget.ROTATE_KEY, rotateWidget);
    _handle.attachChild(rotateWidget.getHandle());
  }
  return rotateWidget;
}

代码示例来源:origin: Renanse/Ardor3D

public void reattachAttachments(final Node scene) {
    for (final AttachmentPoint point : _dataCache.getAttachmentPoints().values()) {
      scene.attachChild(point.getAttachment());
    }
  }
}

代码示例来源:origin: Renanse/Ardor3D

public CompoundInteractWidget withMultiPlanarHandle() {
  MoveMultiPlanarWidget widget = (MoveMultiPlanarWidget) _widgets
      .get(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY);
  if (widget != null) {
    widget.getHandle().removeFromParent();
  }
  widget = new MoveMultiPlanarWidget(_filters);
  _widgets.put(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY, widget);
  _handle.attachChild(widget.getHandle());
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

public CompoundInteractWidget withMultiPlanarHandle(final double extent) {
  MoveMultiPlanarWidget widget = (MoveMultiPlanarWidget) _widgets
      .get(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY);
  if (widget != null) {
    widget.getHandle().removeFromParent();
  }
  widget = new MoveMultiPlanarWidget(_filters, extent);
  _widgets.put(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY, widget);
  _handle.attachChild(widget.getHandle());
  return this;
}

代码示例来源:origin: com.ardor3d/ardor3d-core

private static Spatial makeCopy(final Spatial source, final Spatial parent, final CopyLogic logic) {
  final AtomicBoolean recurse = new AtomicBoolean();
  final Spatial result = logic.copy(source, recurse);
  if (recurse.get() && source instanceof Node && result instanceof Node
      && ((Node) source).getNumberOfChildren() > 0) {
    for (final Spatial child : ((Node) source).getChildren()) {
      final Spatial copy = makeCopy(child, result, logic);
      if (copy != null) {
        ((Node) result).attachChild(copy);
      }
    }
  }
  return result;
}

代码示例来源:origin: com.ardor3d/ardor3d-core

@Override
public Node makeInstanced() {
  // get copy of basic spatial info
  final Node node = (Node) super.makeInstanced();
  // add copy of children
  for (final Spatial child : getChildren()) {
    final Spatial copy = child.makeInstanced();
    node.attachChild(copy);
  }
  return node;
}

代码示例来源:origin: com.ardor3d/ardor3d-core

@Override
public Node makeCopy(final boolean shareGeometricData) {
  // get copy of basic spatial info
  final Node node = (Node) super.makeCopy(shareGeometricData);
  // add copy of children
  for (final Spatial child : getChildren()) {
    final Spatial copy = child.makeCopy(shareGeometricData);
    node.attachChild(copy);
  }
  // return
  return node;
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public Node makeInstanced() {
  // get copy of basic spatial info
  final Node node = (Node) super.makeInstanced();
  // add copy of children
  for (final Spatial child : getChildren()) {
    final Spatial copy = child.makeInstanced();
    node.attachChild(copy);
  }
  return node;
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public Node makeCopy(final boolean shareGeometricData) {
  // get copy of basic spatial info
  final Node node = (Node) super.makeCopy(shareGeometricData);
  // add copy of children
  for (final Spatial child : getChildren()) {
    final Spatial copy = child.makeCopy(shareGeometricData);
    node.attachChild(copy);
  }
  // return
  return node;
}

代码示例来源:origin: Renanse/Ardor3D

public CompoundInteractWidget withPlanarHandle(final MovePlane plane, final ReadOnlyColorRGBA color) {
  MovePlanarWidget widget = (MovePlanarWidget) _widgets.get(CompoundInteractWidget.MOVE_PLANAR_KEY);
  if (widget != null) {
    widget.getHandle().removeFromParent();
  }
  widget = new MovePlanarWidget(_filters).withPlane(plane).withDefaultHandle(.5, .25, color);
  _widgets.put(CompoundInteractWidget.MOVE_PLANAR_KEY, widget);
  _handle.attachChild(widget.getHandle());
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

public CompoundInteractWidget withPlanarHandle(final MovePlane plane, final double radius, final double height,
    final ReadOnlyColorRGBA color) {
  MovePlanarWidget widget = (MovePlanarWidget) _widgets.get(CompoundInteractWidget.MOVE_PLANAR_KEY);
  if (widget != null) {
    widget.getHandle().removeFromParent();
  }
  widget = new MovePlanarWidget(_filters).withPlane(plane).withDefaultHandle(radius, height, color);
  _widgets.put(CompoundInteractWidget.MOVE_PLANAR_KEY, widget);
  _handle.attachChild(widget.getHandle());
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

public MoveWidget withZAxis(final ReadOnlyColorRGBA color, final double scale, final double width,
    final double lengthGap, final double tipGap) {
  if (_zArrow != null) {
    _zArrow.removeFromParent();
  }
  _zColor.set(color);
  _zArrow = new InteractArrow("zMoveArrow", scale, width, lengthGap, tipGap);
  _zArrow.setDefaultColor(color);
  _handle.attachChild(_zArrow);
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

public RotateWidget withZAxis(final ReadOnlyColorRGBA color, final float scale, final float width) {
  if (_zRing != null) {
    _zRing.removeFromParent();
  }
  _zRing = new InteractRing("zRotRing", 4, 32, scale, width);
  _zRing.setDefaultColor(color);
  _handle.attachChild(_zRing);
  final BlendState blend = new BlendState();
  blend.setBlendEnabled(true);
  _zRing.setRenderState(blend);
  return this;
}

代码示例来源:origin: Renanse/Ardor3D

public MoveWidget withXAxis(final ReadOnlyColorRGBA color, final double scale, final double width,
    final double lengthGap, final double tipGap) {
  if (_xArrow != null) {
    _xArrow.removeFromParent();
  }
  _xColor.set(color);
  _xArrow = new InteractArrow("xMoveArrow", scale, width, lengthGap, tipGap);
  _xArrow.setDefaultColor(color);
  final Quaternion rotate = new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_Y);
  _xArrow.setRotation(rotate);
  _handle.attachChild(_xArrow);
  return this;
}

相关文章