Ejemplo 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());
 }
Ejemplo n.º 2
0
 @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());
 }
Ejemplo n.º 3
0
 @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);
 }
Ejemplo n.º 4
0
 @Override
 protected Material getMaterial() {
   material.setTexture("NormalsTexture", normalPass.getRenderedTexture());
   return material;
 }
Ejemplo n.º 5
0
 @Override
 protected void cleanUpFilter(Renderer r) {
   normalPass.cleanup(r);
 }