public RotateWidget(final IFilterList filterList) { super(filterList); _handle = new Node("rotationHandle"); final ZBufferState zstate = new ZBufferState(); zstate.setFunction(TestFunction.LessThanOrEqualTo); _handle.setRenderState(zstate); _handle.getSceneHints().setRenderBucketType(RenderBucketType.Transparent); _handle.updateGeometricState(0); if (RotateWidget.DEFAULT_CURSOR != null) { setMouseOverCallback(new SetCursorCallback(RotateWidget.DEFAULT_CURSOR)); } }
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; }
/** * <code>draw</code> updates the billboards orientation then renders the billboard's children. * * @param r * the renderer used to draw. * @see com.ardor3d.scenegraph.Spatial#draw(com.ardor3d.renderer.Renderer) */ @Override public void draw(final Renderer r) { rotateBillboard(); super.draw(r); }
protected void updateBlendStates(final Spatial highlight) { _handle.acceptVisitor(new Visitor() { @Override public void visit(final Spatial spatial) { final BlendState bs = (BlendState) spatial.getLocalRenderState(StateType.Blend); if (bs != null) { bs.setSourceFunction(spatial == highlight ? SourceFunction.One : SourceFunction.SourceAlpha); } } }, true); _handle.updateGeometricState(0); }
/** * * <code>detachAllChildren</code> removes all children attached to this node. */ public void detachAllChildren() { for (int i = getNumberOfChildren() - 1; i >= 0; i--) { detachChildAt(i); } logger.fine("All children removed."); }
@Override protected void updateChildren(final double time) { for (int i = getNumberOfChildren() - 1; i >= 0; i--) { final Spatial pkChild = getChild(i); if (pkChild != null) { pkChild.updateGeometricState(time, false); } } }
protected Node clone(final Node original) { Node copy = null; try { copy = original.getClass().newInstance(); } catch (final InstantiationException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } catch (final IllegalAccessException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } copy.setName(original.getName() + "_copy"); copy.getSceneHints().set(original.getSceneHints()); copy.setTransform(original.getTransform()); for (final StateType type : StateType.values()) { final RenderState state = original.getLocalRenderState(type); if (state != null) { copy.setRenderState(state); } } return copy; } }
public LineGrapher(final int width, final int height, final Renderer renderer, final ContextCapabilities caps) { super(width, height, renderer, caps); // Setup our static horizontal graph lines createHLines(); _defBlendState = new BlendState(); _defBlendState.setEnabled(true); _defBlendState.setBlendEnabled(true); _defBlendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); _defBlendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); _graphRoot.setRenderState(_defBlendState); _graphRoot.getSceneHints().setCullHint(CullHint.Never); }
@Override public void render(final Renderer renderer, final InteractManager manager) { final Spatial spat = manager.getSpatialTarget(); if (spat == null) { return; } _handle.setTranslation(spat.getWorldTranslation()); _handle.updateGeometricState(0); renderer.draw(_handle); }
public SimpleScaleWidget withArrow(final ReadOnlyVector3 arrowDirection, final ReadOnlyColorRGBA color, final double lengthGap, final double tipGap) { _arrowDirection = new Vector3(arrowDirection); _handle = new InteractArrow("scaleHandle", 1.0, 0.125, lengthGap, tipGap); if (!_arrowDirection.equals(Vector3.UNIT_Z)) { _handle.setRotation(new Quaternion().fromVectorToVector(Vector3.UNIT_Z, _arrowDirection)); } final BlendState blend = new BlendState(); blend.setBlendEnabled(true); _handle.setRenderState(blend); ((Arrow) _handle).setDefaultColor(color); final ZBufferState zstate = new ZBufferState(); zstate.setWritable(false); zstate.setFunction(TestFunction.Always); _handle.setRenderState(zstate); _handle.getSceneHints().setRenderBucketType(RenderBucketType.PostBucket); _handle.updateGeometricState(0); return this; }
@Override public int attachChild(final Spatial child) { return _targetScene.attachChild(child); }
@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; }
public void update(final ReadOnlyTimer timer, final InteractManager manager) { _handle.updateGeometricState(timer.getTimePerFrame()); }
tmpLocation.set(skyBox.getTranslation()); skyBox.setTranslation(tRenderer.getCamera().getLocation()); skyBox.updateGeometricState(0.0f); skyBox.getSceneHints().setCullHint(CullHint.Never); skyBox.getSceneHints().setCullHint(CullHint.Always); skyBox.setTranslation(tmpLocation); skyBox.updateGeometricState(0.0f); skyBox.getSceneHints().setCullHint(CullHint.Never);
final Node skinNode = new Node(meshNode.getName()); for (final Spatial spat : meshNode.getChildren()) { if (spat instanceof Mesh && ((Mesh) spat).getMeshData().getVertexCount() > 0) { final Mesh sourceMesh = (Mesh) spat; skinNode.attachChild(skMesh); ardorParentNode.attachChild(skinNode);
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; }
public QuadImposterNode(final String name, final int twidth, final int theight, final int depth, final int samples, final Timer timer) { super(name); _twidth = twidth; _theight = theight; _depth = depth; _samples = samples; _timer = timer; _texture = new Texture2D(); _imposterQuad = new Quad("ImposterQuad"); _imposterQuad.resize(1, 1); _imposterQuad.setModelBound(new BoundingBox()); _imposterQuad.getSceneHints().setTextureCombineMode(TextureCombineMode.Replace); _imposterQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off); super.attachChild(_imposterQuad); getSceneHints().setRenderBucketType(RenderBucketType.Transparent); _targetScene = new Node(); super.attachChild(_targetScene); for (int i = 0; i < _corners.length; i++) { _corners[i] = new Vector3(); } if (timer != null) { _redrawRate = _elapsed = 0.05; // 20x per sec } else { setCameraAngleThreshold(10.0); setCameraDistanceThreshold(0.2); } _haveDrawn = false; }
if (colladaGeometry.getChild("mesh") != null) { final Element cMesh = colladaGeometry.getChild("mesh"); final Node meshNode = new Node(colladaGeometry.getAttributeValue("name", colladaGeometry.getName())); if (child != null) { if (child.getName() == null) { child.setName(meshNode.getName() + "_polygons"); meshNode.attachChild(child); hasChild = true; if (child != null) { if (child.getName() == null) { child.setName(meshNode.getName() + "_polylist"); meshNode.attachChild(child); hasChild = true; if (child != null) { if (child.getName() == null) { child.setName(meshNode.getName() + "_triangles"); meshNode.attachChild(child); hasChild = true; if (child != null) { if (child.getName() == null) { child.setName(meshNode.getName() + "_lines");
final Node sceneRoot = new Node( visualScene.getAttributeValue("name") != null ? visualScene.getAttributeValue("name") : "Collada Root"); final Node subNode = buildNode(n, baseJointNode); if (subNode != null) { sceneRoot.attachChild(subNode); sceneRoot.updateWorldTransform(true); initDefaultJointTransforms(baseJointNode);
nodeName = dNode.getAttributeValue("id", dNode.getName()); final Node node = new Node(nodeName); final Transform localTransform = getNodeTransforms(transforms); node.setTransform(localTransform); if (jointChildNode != null) { jointChildNode.setSceneNode(node); node.attachChild(mesh); final Node subNode = getNode(in, jointNode); if (subNode != null) { node.attachChild(subNode); if (nodeType == NodeType.JOINT && getNodeType(_colladaDOMUtil.findTargetWithId(in.getAttributeValue("url"))) == NodeType.NODE) { final Node subNode = buildNode(n, jointNode); if (subNode != null) { node.attachChild(subNode); if (nodeType == NodeType.JOINT && getNodeType(n) == NodeType.NODE) {