public void displayNonDeformingJoint(boolean display) { joints.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always); outlines.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always); wires.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always); ((Node) outlines.getChild(1)).getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always); ((Node) wires.getChild(1)).getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always); }
@Override public void done(LightProbe result) { System.err.println("Done rendering env maps"); tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager); rootNode.getChild(0).setCullHint(Spatial.CullHint.Dynamic); } });
public void readScenes(JsonPrimitive defaultScene, Node rootNode) throws IOException { if (scenes == null) { //no scene... lets handle this later... throw new AssetLoadException("Gltf files with no scene is not yet supported"); } for (JsonElement scene : scenes) { Node sceneNode = new Node(); //specs says that only the default scene should be rendered, // if there are several scenes, they are attached to the rootScene, but they are culled sceneNode.setCullHint(Spatial.CullHint.Always); sceneNode.setName(getAsString(scene.getAsJsonObject(), "name")); JsonArray sceneNodes = scene.getAsJsonObject().getAsJsonArray("nodes"); sceneNode = customContentManager.readExtensionAndExtras("scene", scene, sceneNode); rootNode.attachChild(sceneNode); for (JsonElement node : sceneNodes) { readChild(sceneNode, node); } } //Setting the default scene cul hint to inherit. int activeChild = 0; if (defaultScene != null) { activeChild = defaultScene.getAsInt(); } rootNode.getChild(activeChild).setCullHint(Spatial.CullHint.Inherit); }
spatial.setCullHint(CullHint.Always);
rootNode.getChild(i).setCullHint(Spatial.CullHint.Always); this.scaleAsParent(percent, playerPos, distVect); currentActiveChild.scaleAsChild(percent, distVect); } else if (currentActiveChild != null && currentActiveChild.getPositionInParent().equals(vector3f)) { rootNode.getChild(i).setCullHint(Spatial.CullHint.Inherit);
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Path.hdr", SkyFactory.EnvMapType.EquirectMap); rootNode.attachChild(sky); rootNode.getChild(0).setCullHint(Spatial.CullHint.Always);
sky.setCullHint(Spatial.CullHint.Never); rootNode.attachChild(sky);
"Textures/Sky/Bright/FullskiesBlueClear03.dds", EnvMapType.CubeMap); sky.setCullHint(Spatial.CullHint.Never); rootNode.attachChild(sky);
"Textures/Sky/Bright/FullskiesBlueClear03.dds", EnvMapType.CubeMap); sky.setCullHint(Spatial.CullHint.Never); rootNode.attachChild(sky);
"Textures/Sky/Bright/FullskiesBlueClear03.dds", EnvMapType.CubeMap); sky.setCullHint(Spatial.CullHint.Never); rootNode.attachChild(sky);
@Override public void setSpatial(Spatial spatial) { super.setSpatial(spatial); spatial.setCullHint(Spatial.CullHint.Always); }
@Override protected void controlUpdate(float tpf) { AudioNode audioNode = (AudioNode) spatial.getParent(); if(audioNode.getStatus() == AudioSource.Status.Playing && spatial.getCullHint() == Spatial.CullHint.Always) { spatial.setCullHint(Spatial.CullHint.Dynamic); } else if(audioNode.getStatus() == AudioSource.Status.Stopped && spatial.getCullHint() == Spatial.CullHint.Dynamic) { spatial.setCullHint(Spatial.CullHint.Always); } }
private static Spatial loadModel(AssetManager assetManager, String resourceName, Node creatureRoot) { // Load the model and attach it without the root Spatial model = AssetUtils.loadModel(assetManager, resourceName); model = ((Node) model).getChild(0); model.setCullHint(Spatial.CullHint.Always); creatureRoot.attachChild(model); return model; }
private static void hideAllNodes(Node root) { UnitFlowerControl aufc = root.getControl(UnitFlowerControl.class); for (Spatial child : root.getChildren()) { // Don't hide the unit flower if (Boolean.FALSE.equals(child.getUserData(AssetUtils.USER_DATA_KEY_REMOVABLE))) { continue; } child.setCullHint(Spatial.CullHint.Always); // Also stop any animations AnimControl animControl = (AnimControl) child.getControl(AnimControl.class); if (animControl != null) { animControl.setEnabled(false); } } }
protected Spatial getDebugShape() { Spatial spatial = DebugShapeFactory.getDebugShape(collisionShape); if (spatial == null) { return new Node("nullnode"); } if (spatial instanceof Node) { List<Spatial> children = ((Node) spatial).getChildren(); for (Iterator<Spatial> it1 = children.iterator(); it1.hasNext();) { Spatial spatial1 = it1.next(); Geometry geom = ((Geometry) spatial1); geom.setMaterial(debugMaterialBlue); geom.setCullHint(Spatial.CullHint.Never); } } else { Geometry geom = ((Geometry) spatial); geom.setMaterial(debugMaterialBlue); geom.setCullHint(Spatial.CullHint.Never); } spatial.setCullHint(Spatial.CullHint.Never); return spatial; }
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { // Start the real animation Spatial spat = root.getChild(resource.getName()); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); // Hide us control.setEnabled(false); control.getSpatial().setCullHint(Spatial.CullHint.Always); }
public void readScenes(JsonPrimitive defaultScene, Node rootNode) throws IOException { if (scenes == null) { //no scene... lets handle this later... throw new AssetLoadException("Gltf files with no scene is not yet supported"); } for (JsonElement scene : scenes) { Node sceneNode = new Node(); //specs says that only the default scene should be rendered, // if there are several scenes, they are attached to the rootScene, but they are culled sceneNode.setCullHint(Spatial.CullHint.Always); sceneNode.setName(getAsString(scene.getAsJsonObject(), "name")); JsonArray sceneNodes = scene.getAsJsonObject().getAsJsonArray("nodes"); sceneNode = customContentManager.readExtensionAndExtras("scene", scene, sceneNode); rootNode.attachChild(sceneNode); for (JsonElement node : sceneNodes) { readChild(sceneNode, node); } } //Setting the default scene cul hint to inherit. int activeChild = 0; if (defaultScene != null) { activeChild = defaultScene.getAsInt(); } rootNode.getChild(activeChild).setCullHint(Spatial.CullHint.Inherit); }
sky.setCullHint(CullHint.Never);
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { cyclesCount++; // Signal that the main animation cycle is done animationControl.onAnimationCycleDone(); // See if we need to stop if (animationControl.isStopAnimation() || channel.getLoopMode() == LoopMode.DontLoop) { // Stop us control.setEnabled(false); // We need to stop if (resource.getFlags().contains(ArtResource.ArtResourceFlag.HAS_END_ANIMATION)) { // Hide us control.getSpatial().setCullHint(Spatial.CullHint.Always); Spatial spat = root.getChild(END_ANIMATION_NAME); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); } else { // Signal stop animationControl.onAnimationStop(); } } }
spat.setCullHint(Spatial.CullHint.Inherit); if (animControl != null) { // Not all are anims AnimChannel channel = animControl.getChannel(0);