public void attachTo(Node node) { node.attachChild(label); node.attachChild(cpuText); node.attachChild(gpuText); node.attachChild(checkBox); }
public void onAction(String name, boolean pressed, float tpf) { if (name.equals("clone") && !pressed) { Terrain clone = (Terrain) ((Node)terrain).clone(); ((Node)terrain).removeFromParent(); terrain = clone; getRootNode().attachChild((Node)terrain); } } };
public Void call() throws Exception { Spatial spatial = serverApp.getAssetManager().loadModel(finalModel); serverApp.getRootNode().attachChild(spatial); return null; } });
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { Vector3f[] points2 = points.clone(); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points, shadowMapIndex)); ShadowUtil.updateFrustumPoints2(shadowCam, points2); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points2, shadowMapIndex)); }
@Override protected void onEnable() { getApplication().setAppProfiler(prof); ((SimpleApplication) getApplication()).getGuiNode().attachChild(ui); }
@Override public void simpleInitApp() { /** this blue box is our player character */ Box b = new Box(1, 1, 1); player = new Geometry("blue cube", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); player.setMaterial(mat); rootNode.attachChild(player); }
public void loadHintText() { hintText = new BitmapText(guiFont, false); hintText.setLocalTranslation(0, getCamera().getHeight(), 0); hintText.setText("Press T to toggle wireframe"); guiNode.attachChild(hintText); }
@Override public void simpleInitApp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); geom.setMaterial(mat); rootNode.attachChild(geom); }
@Override public void simpleInitApp() { flyCam.setDragToRotate(true); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); geom.setMaterial(mat); rootNode.attachChild(geom); } }
public void simpleInitApp() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
public void setupFloor() { Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
/** * Attach a red square in the XY plane with its lower left corner at (0, 0, * 0). It is composed of 2 triangles. */ void createRedSquare() { Mesh quadMesh = new Quad(1f, 1f); Geometry redSquare = new Geometry("red square", quadMesh); Material red = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); redSquare.setMaterial(red); rootNode.attachChild(redSquare); }
private void createDebugTangents(Geometry geom) { Geometry debug = new Geometry( "Debug " + geom.getName(), TangentBinormalGenerator.genTbnLines(geom.getMesh(), 0.8f) ); Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m"); debug.setMaterial(debugMat); debug.setCullHint(Spatial.CullHint.Never); debug.getLocalTranslation().set(geom.getWorldTranslation()); debugNode.attachChild(debug); } }
public void initFloor() { Box floorBox = new Box(10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, 0, 0); floor.addControl(new RigidBodyControl(0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
public void initFloor() { Box floorBox = new Box(10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, 0, 0); floor.addControl(new RigidBodyControl(0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
protected void initCrossHairs() { BitmapText ch = new BitmapText(guiFont, false); ch.setSize(guiFont.getCharSet().getRenderedSize() * 2); ch.setText("+"); // crosshairs ch.setLocalTranslation( // center settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2, settings.getHeight() / 2 + ch.getLineHeight() / 2, 0); guiNode.attachChild(ch); }
/** A centred plus sign to help the player aim. */ protected void initCrossHairs() { setDisplayStatView(false); guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText ch = new BitmapText(guiFont, false); ch.setSize(guiFont.getCharSet().getRenderedSize() * 2); ch.setText("+"); // crosshairs ch.setLocalTranslation( // center settings.getWidth() / 2 - ch.getLineWidth()/2, settings.getHeight() / 2 + ch.getLineHeight()/2, 0); guiNode.attachChild(ch); }
public void initFloor() { Box floorBox = new Box(10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, -0.1f, 0); floor.addControl(new RigidBodyControl(new BoxCollisionShape(new Vector3f(10f, 0.1f, 5f)), 0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
@Test public void testOverrides_AddAfterAttach() { Node scene = createDummyScene(); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); root.attachChild(scene); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); validateScene(root); }
@Test public void testOverrides_AddBeforeAttach() { Node scene = createDummyScene(); scene.getChild("A").addMatParamOverride(mpoInt("val", 5)); scene.updateGeometricState(); Node root = new Node("Root Node"); root.updateGeometricState(); root.attachChild(scene); validateScene(root); }