Exemplo n.º 1
0
 public static void getPreNormals(
     RenderManager renderManager, Pass normalPass, ViewPort viewPort) {
   curCount++;
   // do we already have a valid cache to set the framebuffer to?
   Renderer r = renderManager.getRenderer();
   if (cachedPreNormals != null) {
     r.copyFrameBuffer(cachedPreNormals, normalPass.getRenderFrameBuffer(), false);
   } else {
     // lets make the prenormals
     r.setFrameBuffer(normalPass.getRenderFrameBuffer());
     renderManager.getRenderer().clearBuffers(true, true, true);
     if (renderManager.getRenderer().getCaps().contains(Caps.GLSL150)) {
       renderManager.setForcedTechnique("PreNormalPass15");
     } else {
       renderManager.setForcedTechnique("PreNormalPass");
     }
     renderManager.renderViewPortQueues(viewPort, false);
     renderManager.setForcedTechnique(null);
     // if we should cache this, do it now
     if (lastNormalPassesCount > 1) {
       cachedPreNormals = normalPass.getRenderFrameBuffer();
     }
   }
   renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
 }
 @Override
 protected void postQueue(RenderQueue queue) {
   Renderer r = renderManager.getRenderer();
   r.setFrameBuffer(normalPass.getRenderFrameBuffer());
   renderManager.getRenderer().clearBuffers(true, true, true);
   renderManager.setForcedTechnique("PreNormalPass");
   renderManager.renderViewPortQueues(viewPort, false);
   renderManager.setForcedTechnique(null);
   renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
 }
 @Override
 protected void initFilter(
     AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
   this.renderManager = renderManager;
   this.viewPort = vp;
   normalPass = new Pass();
   normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth);
   material = new Material(manager, "Common/MatDefs/Post/CartoonEdge.j3md");
   material.setFloat("EdgeWidth", edgeWidth);
   material.setFloat("EdgeIntensity", edgeIntensity);
   material.setFloat("NormalThreshold", normalThreshold);
   material.setFloat("DepthThreshold", depthThreshold);
   material.setFloat("NormalSensitivity", normalSensitivity);
   material.setFloat("DepthSensitivity", depthSensitivity);
   material.setColor("EdgeColor", edgeColor);
 }
 @Override
 protected Material getMaterial() {
   material.setTexture("NormalsTexture", normalPass.getRenderedTexture());
   return material;
 }
 @Override
 protected void cleanUpFilter(Renderer r) {
   normalPass.cleanup(r);
 }