private static MouseCursor createMouseCursor( final AWTImageLoader awtImageLoader, final String resourceName) throws IOException { final com.ardor3d.image.Image image = awtImageLoader.load( ResourceLocatorTool.getClassPathResourceAsStream(LwjglSwtExample.class, resourceName), false); return new MouseCursor("cursor1", image, 0, image.getHeight() - 1); }
/** * Populate a manager with layer information. * * @param layersFile the script file to read from. * @param manager the manager to add layer information to. * @param input the input store object, holding things like AnimationClips that the layers might * need for construction. * @return an output store object * @throws IOException if there is a problem accessing the contents of the layersFile. * @throws ScriptException if the script given has syntax/parse errors. */ public static OutputStore addLayers( final ResourceSource layersFile, final AnimationManager manager, final InputStore input) throws IOException, ScriptException { final OutputStore output = new OutputStore(); final ScriptEngineManager mgr = new ScriptEngineManager(); final ScriptEngine jsEngine = mgr.getEngineByExtension("js"); jsEngine.put("MANAGER", manager); jsEngine.put("INPUTSTORE", input); jsEngine.put("OUTPUTSTORE", output); // load our helper functions first... jsEngine.eval( new InputStreamReader( ResourceLocatorTool.getClassPathResourceAsStream( JSLayerImporter.class, "com/ardor3d/extension/animation/skeletal/state/loader/functions.js"))); // Add our user data... jsEngine.eval(new InputStreamReader(layersFile.openStream())); // return our output store, which may have useful items such as attachment points, etc. return output; }
public void reloadShader() { if (useProjectedShader) { if (useRefraction) { currentShaderStr = projectedShaderRefractionStr; } else { currentShaderStr = projectedShaderStr; } } else { if (useRefraction) { currentShaderStr = simpleShaderRefractionStr; } else { currentShaderStr = simpleShaderStr; } } try { logger.info("loading " + currentShaderStr); waterShader.setVertexShader( ResourceLocatorTool.getClassPathResourceAsStream( WaterNode.class, currentShaderStr + ".vert")); waterShader.setFragmentShader( ResourceLocatorTool.getClassPathResourceAsStream( WaterNode.class, currentShaderStr + ".frag")); } catch (final IOException e) { logger.log(Level.WARNING, "Error loading shader", e); return; } waterShader.setUniform("normalMap", 0); waterShader.setUniform("reflection", 1); waterShader.setUniform("dudvMap", 2); if (useRefraction) { waterShader.setUniform("refraction", 3); waterShader.setUniform("depthMap", 4); } if (useProjectedShader) { if (useRefraction) { waterShader.setUniform("foamMap", 5); } else { waterShader.setUniform("foamMap", 3); } } waterShader._needSendShader = true; try { blurShaderVertical.setVertexShader( ResourceLocatorTool.getClassPathResourceAsStream( WaterNode.class, "com/ardor3d/extension/effect/bloom/bloom_blur.vert")); blurShaderVertical.setFragmentShader( ResourceLocatorTool.getClassPathResourceAsStream( WaterNode.class, "com/ardor3d/extension/effect/bloom/bloom_blur_vertical5_down.frag")); } catch (final IOException ex) { logger.logp( Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex); } blurShaderVertical.setUniform("RT", 0); blurShaderVertical.setUniform("sampleDist", blurSampleDistance); blurShaderVertical._needSendShader = true; logger.info("Shader reloaded..."); }
/**