/** * Defines a shader with a given name. If the shader type name is left * <code>null</code>, the shader with the given name will be updated (if * it exists). * * @param name a unique name given to the shader * @param shaderType a shader plugin type */ public void shader(string name, string shaderType) { if (!isIncremental(shaderType)) { // we are declaring a shader for the first time if (renderObjects.has(name)) { UI.printError(UI.Module.API, "Unable to declare shader \"{0}\", name is already in use", name); parameterList.clear(true); return; } IShader shader = PluginRegistry.shaderPlugins.createObject(shaderType); if (shader == null) { UI.printError(UI.Module.API, "Unable to create shader of type \"{0}\"", shaderType); return; } renderObjects.put(name, shader); } // update existing shader (only if it is valid) if (lookupShader(name) != null) { update(name); } else { UI.printError(UI.Module.API, "Unable to update shader \"{0}\" - shader object was not found", name); parameterList.clear(true); } }
/** * Defines a shader with a given name. If the shader object is * <code>null</code>, the shader with the given name will be updated (if * it exists). * * @param name a unique name given to the shader * @param shader a shader object */ public void shader(string name, IShader shader) { if (shader != null) { // we are declaring a shader for the first time if (renderObjects.has(name)) { UI.printError(UI.Module.API, "Unable to declare shader \"{0}\", name is already in use", name); parameterList.clear(true); return; } renderObjects.put(name, shader); } // update existing shader (only if it is valid) if (lookupShader(name) != null) { update(name); } else { UI.printError(UI.Module.API, "Unable to update shader \"{0}\" - shader object was not found", name); parameterList.clear(true); } }