本文整理了Java中com.ardor3d.scenegraph.Node
类的一些代码示例,展示了Node
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node
类的具体详情如下:
包路径:com.ardor3d.scenegraph.Node
类名称:Node
[英]Node defines an internal node of a scene graph. The internal node maintains a collection of children and handles merging said children into a single bound to allow for very fast culling of multiple nodes. Node allows for any number of children to be attached.
[中]节点定义场景图的内部节点。内部节点维护子节点的集合,并处理将所述子节点合并到单个绑定中的操作,以允许非常快速地剔除多个节点。节点允许连接任意数量的子节点。
代码示例来源:origin: Renanse/Ardor3D
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));
}
}
代码示例来源: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
/**
* <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);
}
代码示例来源:origin: Renanse/Ardor3D
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);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
*
* <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.");
}
代码示例来源:origin: com.ardor3d/ardor3d-core
@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);
}
}
}
代码示例来源:origin: com.ardor3d/ardor3d-core
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;
}
}
代码示例来源:origin: com.ardor3d/ardor3d-core
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);
}
代码示例来源:origin: Renanse/Ardor3D
@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);
}
代码示例来源:origin: Renanse/Ardor3D
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;
}
代码示例来源:origin: com.ardor3d/ardor3d-core
@Override
public int attachChild(final Spatial child) {
return _targetScene.attachChild(child);
}
代码示例来源: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
public void update(final ReadOnlyTimer timer, final InteractManager manager) {
_handle.updateGeometricState(timer.getTimePerFrame());
}
代码示例来源:origin: com.ardor3d/ardor3d-effects
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);
代码示例来源:origin: Renanse/Ardor3D
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);
代码示例来源: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: com.ardor3d/ardor3d-core
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;
}
代码示例来源:origin: Renanse/Ardor3D
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");
代码示例来源:origin: Renanse/Ardor3D
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);
代码示例来源:origin: Renanse/Ardor3D
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) {
内容来源于网络,如有侵权,请联系作者删除!