use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.
the class BloomFilter method initFilter.
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
this.renderManager = renderManager;
this.viewPort = vp;
this.assetManager = manager;
this.initalWidth = w;
this.initalHeight = h;
screenWidth = (int) Math.max(1, (w / downSamplingFactor));
screenHeight = (int) Math.max(1, (h / downSamplingFactor));
// System.out.println(screenWidth + " " + screenHeight);
if (glowMode != GlowMode.Scene) {
preGlowPass = new Pass();
preGlowPass.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth);
}
postRenderPasses = new ArrayList<Pass>();
//configuring extractPass
extractMat = new Material(manager, "Common/MatDefs/Post/BloomExtract.j3md");
extractPass = new Pass() {
@Override
public boolean requiresSceneAsTexture() {
return true;
}
@Override
public void beforeRender() {
extractMat.setFloat("ExposurePow", exposurePower);
extractMat.setFloat("ExposureCutoff", exposureCutOff);
if (glowMode != GlowMode.Scene) {
extractMat.setTexture("GlowMap", preGlowPass.getRenderedTexture());
}
extractMat.setBoolean("Extract", glowMode != GlowMode.Objects);
}
};
extractPass.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth, 1, extractMat);
postRenderPasses.add(extractPass);
//configuring horizontal blur pass
hBlurMat = new Material(manager, "Common/MatDefs/Blur/HGaussianBlur.j3md");
horizontalBlur = new Pass() {
@Override
public void beforeRender() {
hBlurMat.setTexture("Texture", extractPass.getRenderedTexture());
hBlurMat.setFloat("Size", screenWidth);
hBlurMat.setFloat("Scale", blurScale);
}
};
horizontalBlur.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth, 1, hBlurMat);
postRenderPasses.add(horizontalBlur);
//configuring vertical blur pass
vBlurMat = new Material(manager, "Common/MatDefs/Blur/VGaussianBlur.j3md");
verticalalBlur = new Pass() {
@Override
public void beforeRender() {
vBlurMat.setTexture("Texture", horizontalBlur.getRenderedTexture());
vBlurMat.setFloat("Size", screenHeight);
vBlurMat.setFloat("Scale", blurScale);
}
};
verticalalBlur.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth, 1, vBlurMat);
postRenderPasses.add(verticalalBlur);
//final material
material = new Material(manager, "Common/MatDefs/Post/BloomFinal.j3md");
material.setTexture("BloomTex", verticalalBlur.getRenderedTexture());
}
use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.
the class CartoonEdgeFilter method initFilter.
@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);
}
use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.
the class ColorOverlayFilter method initFilter.
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
material = new Material(manager, "Common/MatDefs/Post/Overlay.j3md");
material.setColor("Color", color);
}
use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.
the class CrossHatchFilter method initFilter.
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
material = new Material(manager, "Common/MatDefs/Post/CrossHatch.j3md");
material.setColor("LineColor", lineColor);
material.setColor("PaperColor", paperColor);
material.setFloat("ColorInfluenceLine", colorInfluenceLine);
material.setFloat("ColorInfluencePaper", colorInfluencePaper);
material.setFloat("FillValue", fillValue);
material.setFloat("Luminance1", luminance1);
material.setFloat("Luminance2", luminance2);
material.setFloat("Luminance3", luminance3);
material.setFloat("Luminance4", luminance4);
material.setFloat("Luminance5", luminance5);
material.setFloat("LineThickness", lineThickness);
material.setFloat("LineDistance", lineDistance);
}
use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.
the class GammaCorrectionFilter method initFilter.
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
material = new Material(manager, "Common/MatDefs/Post/GammaCorrection.j3md");
material.setFloat("InvGamma", 1.0f / gamma);
}
Aggregations