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

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

本文整理了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

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

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

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

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

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

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

  1. @Override
  2. public int attachChild(final Spatial child) {
  3. if (!(child instanceof TextMesh)) {
  4. throw new IllegalArgumentException("Must be a TextMesh!");
  5. }
  6. return super.attachChild(child);
  7. }

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

  1. @Override
  2. public int attachChild(final Spatial child) {
  3. if (!(child instanceof TextMesh)) {
  4. throw new IllegalArgumentException("Must be a TextMesh!");
  5. }
  6. return super.attachChild(child);
  7. }

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

  1. private MoveWidget verifyMoveWidget() {
  2. MoveWidget moveWidget = (MoveWidget) _widgets.get(CompoundInteractWidget.MOVE_KEY);
  3. if (moveWidget == null) {
  4. moveWidget = new MoveWidget(_filters);
  5. _widgets.put(CompoundInteractWidget.MOVE_KEY, moveWidget);
  6. _handle.attachChild(moveWidget.getHandle());
  7. }
  8. return moveWidget;
  9. }

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

  1. private RotateWidget verifyRotateWidget() {
  2. RotateWidget rotateWidget = (RotateWidget) _widgets.get(CompoundInteractWidget.ROTATE_KEY);
  3. if (rotateWidget == null) {
  4. rotateWidget = new RotateWidget(_filters);
  5. _widgets.put(CompoundInteractWidget.ROTATE_KEY, rotateWidget);
  6. _handle.attachChild(rotateWidget.getHandle());
  7. }
  8. return rotateWidget;
  9. }

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

  1. public void reattachAttachments(final Node scene) {
  2. for (final AttachmentPoint point : _dataCache.getAttachmentPoints().values()) {
  3. scene.attachChild(point.getAttachment());
  4. }
  5. }
  6. }

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

  1. public CompoundInteractWidget withMultiPlanarHandle() {
  2. MoveMultiPlanarWidget widget = (MoveMultiPlanarWidget) _widgets
  3. .get(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY);
  4. if (widget != null) {
  5. widget.getHandle().removeFromParent();
  6. }
  7. widget = new MoveMultiPlanarWidget(_filters);
  8. _widgets.put(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY, widget);
  9. _handle.attachChild(widget.getHandle());
  10. return this;
  11. }

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

  1. public CompoundInteractWidget withMultiPlanarHandle(final double extent) {
  2. MoveMultiPlanarWidget widget = (MoveMultiPlanarWidget) _widgets
  3. .get(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY);
  4. if (widget != null) {
  5. widget.getHandle().removeFromParent();
  6. }
  7. widget = new MoveMultiPlanarWidget(_filters, extent);
  8. _widgets.put(CompoundInteractWidget.MOVE_MULTIPLANAR_KEY, widget);
  9. _handle.attachChild(widget.getHandle());
  10. return this;
  11. }

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

  1. private static Spatial makeCopy(final Spatial source, final Spatial parent, final CopyLogic logic) {
  2. final AtomicBoolean recurse = new AtomicBoolean();
  3. final Spatial result = logic.copy(source, recurse);
  4. if (recurse.get() && source instanceof Node && result instanceof Node
  5. && ((Node) source).getNumberOfChildren() > 0) {
  6. for (final Spatial child : ((Node) source).getChildren()) {
  7. final Spatial copy = makeCopy(child, result, logic);
  8. if (copy != null) {
  9. ((Node) result).attachChild(copy);
  10. }
  11. }
  12. }
  13. return result;
  14. }

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

  1. @Override
  2. public Node makeInstanced() {
  3. // get copy of basic spatial info
  4. final Node node = (Node) super.makeInstanced();
  5. // add copy of children
  6. for (final Spatial child : getChildren()) {
  7. final Spatial copy = child.makeInstanced();
  8. node.attachChild(copy);
  9. }
  10. return node;
  11. }

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

  1. @Override
  2. public Node makeCopy(final boolean shareGeometricData) {
  3. // get copy of basic spatial info
  4. final Node node = (Node) super.makeCopy(shareGeometricData);
  5. // add copy of children
  6. for (final Spatial child : getChildren()) {
  7. final Spatial copy = child.makeCopy(shareGeometricData);
  8. node.attachChild(copy);
  9. }
  10. // return
  11. return node;
  12. }

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

  1. @Override
  2. public Node makeInstanced() {
  3. // get copy of basic spatial info
  4. final Node node = (Node) super.makeInstanced();
  5. // add copy of children
  6. for (final Spatial child : getChildren()) {
  7. final Spatial copy = child.makeInstanced();
  8. node.attachChild(copy);
  9. }
  10. return node;
  11. }

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

  1. @Override
  2. public Node makeCopy(final boolean shareGeometricData) {
  3. // get copy of basic spatial info
  4. final Node node = (Node) super.makeCopy(shareGeometricData);
  5. // add copy of children
  6. for (final Spatial child : getChildren()) {
  7. final Spatial copy = child.makeCopy(shareGeometricData);
  8. node.attachChild(copy);
  9. }
  10. // return
  11. return node;
  12. }

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

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

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

  1. public CompoundInteractWidget withPlanarHandle(final MovePlane plane, final double radius, final double height,
  2. final ReadOnlyColorRGBA color) {
  3. MovePlanarWidget widget = (MovePlanarWidget) _widgets.get(CompoundInteractWidget.MOVE_PLANAR_KEY);
  4. if (widget != null) {
  5. widget.getHandle().removeFromParent();
  6. }
  7. widget = new MovePlanarWidget(_filters).withPlane(plane).withDefaultHandle(radius, height, color);
  8. _widgets.put(CompoundInteractWidget.MOVE_PLANAR_KEY, widget);
  9. _handle.attachChild(widget.getHandle());
  10. return this;
  11. }

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

  1. public MoveWidget withZAxis(final ReadOnlyColorRGBA color, final double scale, final double width,
  2. final double lengthGap, final double tipGap) {
  3. if (_zArrow != null) {
  4. _zArrow.removeFromParent();
  5. }
  6. _zColor.set(color);
  7. _zArrow = new InteractArrow("zMoveArrow", scale, width, lengthGap, tipGap);
  8. _zArrow.setDefaultColor(color);
  9. _handle.attachChild(_zArrow);
  10. return this;
  11. }

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

  1. public RotateWidget withZAxis(final ReadOnlyColorRGBA color, final float scale, final float width) {
  2. if (_zRing != null) {
  3. _zRing.removeFromParent();
  4. }
  5. _zRing = new InteractRing("zRotRing", 4, 32, scale, width);
  6. _zRing.setDefaultColor(color);
  7. _handle.attachChild(_zRing);
  8. final BlendState blend = new BlendState();
  9. blend.setBlendEnabled(true);
  10. _zRing.setRenderState(blend);
  11. return this;
  12. }

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

  1. public MoveWidget withXAxis(final ReadOnlyColorRGBA color, final double scale, final double width,
  2. final double lengthGap, final double tipGap) {
  3. if (_xArrow != null) {
  4. _xArrow.removeFromParent();
  5. }
  6. _xColor.set(color);
  7. _xArrow = new InteractArrow("xMoveArrow", scale, width, lengthGap, tipGap);
  8. _xArrow.setDefaultColor(color);
  9. final Quaternion rotate = new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_Y);
  10. _xArrow.setRotation(rotate);
  11. _handle.attachChild(_xArrow);
  12. return this;
  13. }

相关文章