public void simpleInitApp() { original = new Sphere(4, 4, 1); original.setStatic(); //original.setInterleaved(); // this will make sure all spheres are rendered always rootNode.setCullHint(CullHint.Never); solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); cam.setLocation(new Vector3f(0, 5, 0)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); Logger.getLogger(Node.class.getName()).setLevel(Level.WARNING); Logger.getLogger(NativeObjectManager.class.getName()).setLevel(Level.WARNING); }
/** * Sets the camera position in world space. * * @param position the position in world space */ public void setPosition(final Vector3f position) { this.position.set(position); if (viewports == null) { return; } for (final ViewPort viewPort : viewports) { viewPort.getCamera().setLocation(position); } }
/** * Sets the spacial for the camera control, should only be used internally * @param spatial */ public void setSpatial(Spatial spatial) { target = spatial; if (spatial == null) { return; } computePosition(); prevPos = new Vector3f(target.getWorldTranslation()); cam.setLocation(pos); }
@Override public void simpleInitApp() { System.out.println("== Tone Mapping Sample =="); System.out.println(" SPACE:\tToggle tone-mapping OFF or ON"); System.out.println(" Y:\tIncrease white-point"); System.out.println(" H:\tDecrease white-point"); fpp = new FilterPostProcessor(assetManager); toneMapFilter = new ToneMapFilter(); fpp.addFilter(toneMapFilter); viewPort.addProcessor(fpp); rootNode.attachChild(createHDRBox()); cam.setLocation(new Vector3f(0f,0f,3f)); initInputs(); }
@Override public void cloneFields( Cloner cloner, Object original ) { this.target = cloner.clone(target); computePosition(); prevPos = new Vector3f(target.getWorldTranslation()); cam.setLocation(pos); }
@Override public void simpleUpdate(float tpf) { offset += tpf; System.err.println(offset); box.setLocalTranslation(new Vector3f(offset, 0, 0)); pointLight.setPosition(new Vector3f(offset - 3f, 0, 0)); cam.setLocation(new Vector3f(offset - 5f, 0, 0)); cam.lookAtDirection(Vector3f.UNIT_X, Vector3f.UNIT_Y); } }
private void initView() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); cam.setLocation(new Vector3f(8.569681f, 3.335546f, 5.4372444f)); cam.setRotation(new Quaternion(-0.07608022f, 0.9086564f, -0.18992864f, -0.3639813f)); flyCam.setMoveSpeed(10); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(3, 3, 3)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); Texture offTex = setupOffscreenView(); Spatial sky = SkyFactory.createSky(assetManager, offTex, EnvMapType.CubeMap); rootNode.attachChild(sky); }
/** * Translate the camera upward by the specified amount. * * @param value translation amount */ protected void riseCamera(float value){ Vector3f vel = initialUpVec.mult(value * moveSpeed); Vector3f pos = cam.getLocation().clone(); if (motionAllowed != null) motionAllowed.checkMotionAllowed(pos, vel); else pos.addLocal(vel); cam.setLocation(pos); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(27.492603f, 29.138166f, -13.232513f)); cam.setRotation(new Quaternion(0.25168246f, -0.10547892f, 0.02760565f, 0.96164864f)); flyCam.setMoveSpeed(30); setupLighting(); setupFloor(); setupSignpost(); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(27.492603f, 29.138166f, -13.232513f)); cam.setRotation(new Quaternion(0.25168246f, -0.10547892f, 0.02760565f, 0.96164864f)); flyCam.setMoveSpeed(30); setupLighting(); setupFloor(); setupSignpost(); } float angle;
@Override public void simpleInitApp() { stateManager.getState(FlyCamAppState.class).getCamera().setMoveSpeed(10); mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); // Create a deep, mostly static scene Spatial oct = createOctSplit("root", 500, 5); rootNode.attachChild(oct); // Position to see most of it cam.setLocation(new Vector3f(400.8009f, 370.16455f, -408.17984f)); cam.setRotation(new Quaternion(0.24906662f, -0.3756747f, 0.105560325f, 0.88639235f)); System.out.println("Total nodes:" + totalNodes + " Total Geometry:" + totalGeometry + " Total controls:" + totalControls ); }
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(14, 14, 1); Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); for (int y = -5; y < 5; y++){ for (int x = -5; x < 5; x++){ Geometry sphere = new Geometry("sphere", sphMesh); sphere.setMaterial(solidColor); sphere.setLocalTranslation(x * 2, 0, y * 2); rootNode.attachChild(sphere); } } cam.setLocation(new Vector3f(0, 5, 0)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f)); cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f)); setupLighting(); setupSkyBox(); setupFloor(); setupSignpost(); setupFilters(); initInput(); }
/** * Forcefully takes over Camera adding functionality and placing it behind the character * @param tpf Tickes Per Frame */ private void camTakeOver(float tpf) { cam.setLocation(player.getLocalTranslation().add(-8, 2, 0)); cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y); Quaternion rot = new Quaternion(); rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z); cam.setRotation(cam.getRotation().mult(rot)); camAngle *= FastMath.pow(.99f, fpsRate * tpf); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(2,1.5f,2)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); putArrow(Vector3f.ZERO, Vector3f.UNIT_X, ColorRGBA.Red); putArrow(Vector3f.ZERO, Vector3f.UNIT_Y, ColorRGBA.Green); putArrow(Vector3f.ZERO, Vector3f.UNIT_Z, ColorRGBA.Blue); putBox(new Vector3f(2, 0, 0), 0.5f, ColorRGBA.Yellow); putGrid(new Vector3f(3.5f, 0, 0), ColorRGBA.White); putSphere(new Vector3f(4.5f, 0, 0), ColorRGBA.Magenta); }
/** * Create the save and load actions and add them to the input listener */ private void createControls() { flyCam.setMoveSpeed(50); cam.setLocation(new Vector3f(0, 100, 0)); inputManager.addMapping("save", new KeyTrigger(KeyInput.KEY_T)); inputManager.addListener(saveActionListener, "save"); inputManager.addMapping("load", new KeyTrigger(KeyInput.KEY_Y)); inputManager.addListener(loadActionListener, "load"); inputManager.addMapping("clone", new KeyTrigger(KeyInput.KEY_C)); inputManager.addListener(cloneActionListener, "clone"); }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.Gray); cam.setLocation(new Vector3f(-5.6310086f, 5.0892987f, -13.000479f)); cam.setRotation(new Quaternion(0.1779095f, 0.20036356f, -0.03702727f, 0.96272093f)); cam.update(); cam.setFrustumFar(300); flyCam.setMoveSpeed(30); rootNode.setCullHint(CullHint.Never); setupLighting(); setupModel(); setupFilters(); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(3, 3, 3)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); //setup main scene Geometry quad = new Geometry("box", new Box(1, 1, 1)); Texture offTex = setupOffscreenView(); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", offTex); quad.setMaterial(mat); rootNode.attachChild(quad); inputManager.addMapping(TOGGLE_UPDATE, new KeyTrigger(KeyInput.KEY_SPACE)); inputManager.addListener(this, TOGGLE_UPDATE); }
@Before public void setUp() { filter = new DefaultLightFilter(); cam = new Camera(512, 512); cam.setFrustumPerspective(45, 1, 1, 1000); cam.setLocation(Vector3f.ZERO); cam.lookAtDirection(Vector3f.UNIT_Z, Vector3f.UNIT_Y); filter.setCamera(cam); Box box = new Box(1, 1, 1); geom = new Geometry("geom", box); geom.setLocalTranslation(0, 0, 10); geom.updateGeometricState(); list = new LightList(geom); }