Search in sources :

Example 6 with RenderQueue

use of com.jme3.renderer.queue.RenderQueue in project jmonkeyengine by jMonkeyEngine.

the class CartoonEdgeFilter method postQueue.

@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());
}
Also used : Renderer(com.jme3.renderer.Renderer)

Example 7 with RenderQueue

use of com.jme3.renderer.queue.RenderQueue in project jmonkeyengine by jMonkeyEngine.

the class BasicShadowRenderer method postQueue.

public void postQueue(RenderQueue rq) {
    for (Spatial scene : viewPort.getScenes()) {
        ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), ShadowMode.Receive, lightReceivers);
    }
    // update frustum points based on current camera
    Camera viewCam = viewPort.getCamera();
    ShadowUtil.updateFrustumPoints(viewCam, viewCam.getFrustumNear(), viewCam.getFrustumFar(), 1.0f, points);
    Vector3f frustaCenter = new Vector3f();
    for (Vector3f point : points) {
        frustaCenter.addLocal(point);
    }
    frustaCenter.multLocal(1f / 8f);
    // update light direction
    shadowCam.setProjectionMatrix(null);
    shadowCam.setParallelProjection(true);
    //        shadowCam.setFrustumPerspective(45, 1, 1, 20);
    shadowCam.lookAtDirection(direction, Vector3f.UNIT_Y);
    shadowCam.update();
    shadowCam.setLocation(frustaCenter);
    shadowCam.update();
    shadowCam.updateViewProjection();
    // render shadow casters to shadow map
    ShadowUtil.updateShadowCamera(viewPort, lightReceivers, shadowCam, points, shadowOccluders, shadowMapSize);
    if (shadowOccluders.size() == 0) {
        noOccluders = true;
        return;
    } else {
        noOccluders = false;
    }
    Renderer r = renderManager.getRenderer();
    renderManager.setCamera(shadowCam, false);
    renderManager.setForcedMaterial(preshadowMat);
    r.setFrameBuffer(shadowFB);
    r.clearBuffers(true, true, true);
    viewPort.getQueue().renderShadowQueue(shadowOccluders, renderManager, shadowCam, true);
    r.setFrameBuffer(viewPort.getOutputFrameBuffer());
    renderManager.setForcedMaterial(null);
    renderManager.setCamera(viewCam, false);
}
Also used : Spatial(com.jme3.scene.Spatial) Vector3f(com.jme3.math.Vector3f) Renderer(com.jme3.renderer.Renderer) Camera(com.jme3.renderer.Camera)

Example 8 with RenderQueue

use of com.jme3.renderer.queue.RenderQueue in project jmonkeyengine by jMonkeyEngine.

the class AbstractShadowRendererVR method postQueue.

@SuppressWarnings("fallthrough")
public void postQueue(RenderQueue rq) {
    lightReceivers.clear();
    skipPostPass = false;
    if (!checkCulling(viewPort.getCamera())) {
        skipPostPass = true;
        return;
    }
    updateShadowCams(viewPort.getCamera());
    Renderer r = renderManager.getRenderer();
    renderManager.setForcedMaterial(preshadowMat);
    renderManager.setForcedTechnique("PreShadow");
    for (int shadowMapIndex = 0; shadowMapIndex < nbShadowMaps; shadowMapIndex++) {
        if (debugfrustums) {
            doDisplayFrustumDebug(shadowMapIndex);
        }
        renderShadowMap(shadowMapIndex);
    }
    debugfrustums = false;
    //restore setting for future rendering
    r.setFrameBuffer(viewPort.getOutputFrameBuffer());
    renderManager.setForcedMaterial(null);
    renderManager.setForcedTechnique(null);
    renderManager.setCamera(viewPort.getCamera(), false);
}
Also used : Renderer(com.jme3.renderer.Renderer)

Aggregations

Renderer (com.jme3.renderer.Renderer)6 Camera (com.jme3.renderer.Camera)2 Spatial (com.jme3.scene.Spatial)2 Vector3f (com.jme3.math.Vector3f)1 SceneProcessor (com.jme3.post.SceneProcessor)1 RenderQueue (com.jme3.renderer.queue.RenderQueue)1 Node (com.jme3.scene.Node)1