/**
  * init the given filter
  *
  * @param filter
  * @param vp
  */
 private void initFilter(Filter filter, ViewPort vp) {
   filter.setProcessor(this);
   if (filter.isRequiresDepthTexture()) {
     if (!computeDepth && renderFrameBuffer != null) {
       depthTexture = new Texture2D(width, height, Format.Depth24);
       renderFrameBuffer.setDepthTexture(depthTexture);
     }
     computeDepth = true;
     filter.init(assetManager, renderManager, vp, width, height);
     filter.setDepthTexture(depthTexture);
   } else {
     filter.init(assetManager, renderManager, vp, width, height);
   }
 }
Example #2
0
  public void init(final ServletContext servletContext, Injector injector) throws ServletException {
    // this may or may not be a singleton, but is only initialized once
    final Filter filter = injector.getInstance(filterKey);

    // initialize our filter with the configured context params and servlet context
    //noinspection OverlyComplexAnonymousInnerClass,AnonymousInnerClassWithTooManyMethods
    filter.init(
        new FilterConfig() {
          public String getFilterName() {
            return filterKey.toString();
          }

          public ServletContext getServletContext() {
            return servletContext;
          }

          public String getInitParameter(String s) {
            return initParams.get(s);
          }

          public Enumeration getInitParameterNames() {
            //noinspection InnerClassTooDeeplyNested,AnonymousInnerClassWithTooManyMethods
            return new Enumeration() {
              private final Iterator<String> paramNames = initParams.keySet().iterator();

              public boolean hasMoreElements() {
                return paramNames.hasNext();
              }

              public Object nextElement() {
                return paramNames.next();
              }
            };
          }
        });
  }