private boolean testHardwareSupported(RenderManager rm) { //Only 255 bones max supported with hardware skinning if (skeleton.getBoneCount() > 255) { return false; } switchToHardware(); try { rm.preloadScene(spatial); return true; } catch (RendererException e) { Logger.getLogger(SkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e); return false; } }
private boolean testHardwareSupported(RenderManager rm) { //Only 255 bones max supported with hardware skinning if (armature.getJointCount() > 255) { return false; } switchToHardware(); try { rm.preloadScene(spatial); return true; } catch (RendererException e) { logger.log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e); return false; } }
public Material reloadMaterial(Material mat) { //clear the entire cache, there might be more clever things to do, like clearing only the matdef, and the associated shaders. assetManager.clearCache(); //creating a dummy mat with the mat def of the mat to reload // Force the reloading of the asset, otherwise the new shader code will not be applied. Material dummy = new Material(assetManager, mat.getMaterialDef().getAssetName()); for (MatParam matParam : mat.getParams()) { dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue()); } dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState()); //creating a dummy geom and assigning the dummy material to it Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f)); dummyGeom.setMaterial(dummy); try { //preloading the dummyGeom, this call will compile the shader again renderManager.preloadScene(dummyGeom); } catch (RendererException e) { //compilation error, the shader code will be output to the console //the following code will output the error //System.err.println(e.getMessage()); Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage()); return null; } Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.INFO, "Material succesfully reloaded"); //System.out.println("Material succesfully reloaded"); return dummy; }
try { rm.preloadScene(spatial); compilationOk = true; } catch (RendererException e) {
List<Spatial> children = n.getChildren(); for (int i = 0; i < children.size(); i++) { preloadScene(children.get(i));
@Override public void simpleInitApp() { createFlame(); createFlash(); createSpark(); createRoundSpark(); createSmokeTrail(); createDebris(); createShockwave(); explosionEffect.setLocalScale(0.5f); renderManager.preloadScene(explosionEffect); cam.setLocation(new Vector3f(0, 3.5135868f, 10)); cam.setRotation(new Quaternion(1.5714673E-4f, 0.98696727f, -0.16091813f, 9.6381607E-4f)); rootNode.attachChild(explosionEffect); }
private boolean testHardwareSupported(RenderManager rm) { //Only 255 bones max supported with hardware skinning if (skeleton.getBoneCount() > 255) { return false; } switchToHardware(); try { rm.preloadScene(spatial); return true; } catch (RendererException e) { Logger.getLogger(SkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e); return false; } }
private boolean testHardwareSupported(RenderManager rm) { for (Material m : materials) { // Some of the animated mesh(es) do not support hardware skinning, // so it is not supported by the model. if (m.getMaterialDef().getMaterialParam("NumberOfBones") == null) { Logger.getLogger(SkeletonControl.class.getName()).log(Level.WARNING, "Not using hardware skinning for {0}, " + "because material {1} doesn''t support it.", new Object[]{spatial, m.getMaterialDef().getName()}); return false; } } switchToHardware(); try { rm.preloadScene(spatial); return true; } catch (RendererException e) { Logger.getLogger(SkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e); return false; } }
app.getRenderManager().preloadScene(spatial);
public Material reloadMaterial(Material mat) { //clear the entire cache, there might be more clever things to do, like clearing only the matdef, and the associated shaders. assetManager.clearCache(); //creating a dummy mat with the mat def of the mat to reload // Force the reloading of the asset, otherwise the new shader code will not be applied. Material dummy = new Material(assetManager, mat.getMaterialDef().getAssetName()); for (MatParam matParam : mat.getParams()) { dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue()); } dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState()); //creating a dummy geom and assigning the dummy material to it Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f)); dummyGeom.setMaterial(dummy); try { //preloading the dummyGeom, this call will compile the shader again renderManager.preloadScene(dummyGeom); } catch (RendererException e) { //compilation error, the shader code will be output to the console //the following code will output the error //System.err.println(e.getMessage()); Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage()); return null; } Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.INFO, "Material succesfully reloaded"); //System.out.println("Material succesfully reloaded"); return dummy; }
List<Spatial> children = n.getChildren(); for (int i = 0; i < children.size(); i++) { preloadScene(children.get(i));
List<Spatial> children = n.getChildren(); for (int i = 0; i < children.size(); i++) { preloadScene(children.get(i));
@Override public void onLoadComplete() { // Prewarm the whole scene GameState.this.app.getRenderManager().preloadScene(rootNode); // Enable player state GameState.this.stateManager.getState(PlayerState.class).setEnabled(true); GameState.this.stateManager.getState(SoundState.class).setEnabled(true); // Set initialized GameState.this.initialized = true; // Set the processors GameState.this.app.setViewProcessors(); // FIXME: this is not correct // Enqueue the thread starting to next frame so that the states are initialized app.enqueue(() -> { // Enable game logic thread exec.resume(); return null; }); } };