Java Code Examples for com.jme3.renderer.RenderManager#renderScene()

The following examples show how to use com.jme3.renderer.RenderManager#renderScene() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestFBOPassthrough.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleRender(RenderManager rm){
    Renderer r = rm.getRenderer();

    //do FBO rendering
    r.setFrameBuffer(fb);

    rm.setCamera(cam, false); // FBO uses current camera
    r.clearBuffers(true, true, true);
    rm.renderScene(fbNode, viewPort);
    rm.flushQueue(viewPort);

    //go back to default rendering and let
    //SimpleApplication render the default scene
    r.setFrameBuffer(null);
}
 
Example 2
Source File: TestDepthStencil.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleRender(RenderManager rm){
    Renderer r = rm.getRenderer();

    //do FBO rendering
    r.setFrameBuffer(fb);

    rm.setCamera(cam, false); // FBO uses current camera
    r.clearBuffers(true, true, true);
    rm.renderScene(fbNode, viewPort);
    rm.flushQueue(viewPort);

    //go back to default rendering and let
    //SimpleApplication render the default scene
    r.setFrameBuffer(null);
}
 
Example 3
Source File: TestFBOPassthrough.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void simpleRender(RenderManager rm){
    Renderer r = rm.getRenderer();

    //do FBO rendering
    r.setFrameBuffer(fb);

    rm.setCamera(cam, false); // FBO uses current camera
    r.clearBuffers(true, true, true);
    rm.renderScene(fbNode, viewPort);
    rm.flushQueue(viewPort);

    //go back to default rendering and let
    //SimpleApplication render the default scene
    r.setFrameBuffer(null);
}
 
Example 4
Source File: KinematicRagdollControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * For internal use only
 * specific render for the ragdoll(if debugging)      
 * @param rm
 * @param vp 
 */
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (!debug) {
            attachDebugShape(space.getDebugManager());
        }
        for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
            PhysicsBoneLink physicsBoneLink = it.next();
            Spatial debugShape = physicsBoneLink.rigidBody.debugShape();
            if (debugShape != null) {
                debugShape.setLocalTranslation(physicsBoneLink.rigidBody.getMotionState().getWorldLocation());
                debugShape.setLocalRotation(physicsBoneLink.rigidBody.getMotionState().getWorldRotationQuat());
                debugShape.updateGeometricState();
                rm.renderScene(debugShape, vp);
            }
        }
    }
}
 
Example 5
Source File: KinematicRagdollControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * For internal use only
 * specific render for the ragdoll(if debugging)      
 * @param rm
 * @param vp 
 */
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (!debug) {
            attachDebugShape(space.getDebugManager());
        }
        for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
            PhysicsBoneLink physicsBoneLink = it.next();
            Spatial debugShape = physicsBoneLink.rigidBody.debugShape();
            if (debugShape != null) {
                debugShape.setLocalTranslation(physicsBoneLink.rigidBody.getMotionState().getWorldLocation());
                debugShape.setLocalRotation(physicsBoneLink.rigidBody.getMotionState().getWorldRotationQuat());
                debugShape.updateGeometricState();
                rm.renderScene(debugShape, vp);
            }
        }
    }
}
 
Example 6
Source File: PhysicsHoverControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        debugShape.setLocalTranslation(motionState.getWorldLocation());
        debugShape.setLocalRotation(motionState.getWorldRotation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 7
Source File: GhostControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 8
Source File: RigidBodyControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        //TODO: using spatial traslation/rotation..
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 9
Source File: CharacterControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        debugShape.setLocalTranslation(getPhysicsLocation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 10
Source File: GhostControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 11
Source File: RigidBodyControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        //TODO: using spatial traslation/rotation..
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 12
Source File: CharacterControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        debugShape.setLocalTranslation(getPhysicsLocation());
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 13
Source File: LightsDebugState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void render(RenderManager rm) {
    if(!isEnabled()){
        return;
    }
    rm.renderScene(debugNode, getApplication().getViewPort());
}
 
Example 14
Source File: BulletDebugAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Render this state. Should be invoked only by a subclass or by the
 * AppStateManager. Invoked once per frame, provided the state is attached
 * and enabled.
 *
 * @param rm the render manager (not null)
 */
@Override
public void render(RenderManager rm) {
    super.render(rm);
    if (viewPort != null) {
        rm.renderScene(physicsDebugRootNode, viewPort);
    }
}
 
Example 15
Source File: DebugTools.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Render all the debug geometries to the specified view port.
 *
 * @param rm the render manager (not null)
 * @param vp the view port (not null)
 */
public void show(RenderManager rm, ViewPort vp) {
    if (!Vector3f.UNIT_X.equals(UNIT_X_CHECK) || !Vector3f.UNIT_Y.equals(UNIT_Y_CHECK) || !Vector3f.UNIT_Z.equals(UNIT_Z_CHECK)
            || !Vector3f.UNIT_XYZ.equals(UNIT_XYZ_CHECK) || !Vector3f.ZERO.equals(ZERO_CHECK)) {
        throw new IllegalStateException("Unit vectors compromised!"
                + "\nX: " + Vector3f.UNIT_X
                + "\nY: " + Vector3f.UNIT_Y
                + "\nZ: " + Vector3f.UNIT_Z
                + "\nXYZ: " + Vector3f.UNIT_XYZ
                + "\nZERO: " + Vector3f.ZERO);
    }
    debugNode.updateLogicalState(0);
    debugNode.updateGeometricState();
    rm.renderScene(debugNode, vp);
}
 
Example 16
Source File: VehicleControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        Node debugNode = (Node) debugShape;
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        int i = 0;
        for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) {
            VehicleWheel physicsVehicleWheel = it.next();
            Vector3f location = physicsVehicleWheel.getLocation().clone();
            Vector3f direction = physicsVehicleWheel.getDirection().clone();
            Vector3f axle = physicsVehicleWheel.getAxle().clone();
            float restLength = physicsVehicleWheel.getRestLength();
            float radius = physicsVehicleWheel.getRadius();

            Geometry locGeom = (Geometry) debugNode.getChild("WheelLocationDebugShape" + i);
            Geometry dirGeom = (Geometry) debugNode.getChild("WheelDirectionDebugShape" + i);
            Geometry axleGeom = (Geometry) debugNode.getChild("WheelAxleDebugShape" + i);
            Geometry wheelGeom = (Geometry) debugNode.getChild("WheelRadiusDebugShape" + i);

            Arrow locArrow = (Arrow) locGeom.getMesh();
            locArrow.setArrowExtent(location);
            Arrow axleArrow = (Arrow) axleGeom.getMesh();
            axleArrow.setArrowExtent(axle.normalizeLocal().multLocal(0.3f));
            Arrow wheelArrow = (Arrow) wheelGeom.getMesh();
            wheelArrow.setArrowExtent(direction.normalizeLocal().multLocal(radius));
            Arrow dirArrow = (Arrow) dirGeom.getMesh();
            dirArrow.setArrowExtent(direction.normalizeLocal().multLocal(restLength));

            dirGeom.setLocalTranslation(location);
            axleGeom.setLocalTranslation(location.addLocal(direction));
            wheelGeom.setLocalTranslation(location);
            i++;
        }
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}
 
Example 17
Source File: VehicleControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void render(RenderManager rm, ViewPort vp) {
    if (enabled && space != null && space.getDebugManager() != null) {
        if (debugShape == null) {
            attachDebugShape(space.getDebugManager());
        }
        Node debugNode = (Node) debugShape;
        debugShape.setLocalTranslation(spatial.getWorldTranslation());
        debugShape.setLocalRotation(spatial.getWorldRotation());
        int i = 0;
        for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) {
            VehicleWheel physicsVehicleWheel = it.next();
            Vector3f location = physicsVehicleWheel.getLocation().clone();
            Vector3f direction = physicsVehicleWheel.getDirection().clone();
            Vector3f axle = physicsVehicleWheel.getAxle().clone();
            float restLength = physicsVehicleWheel.getRestLength();
            float radius = physicsVehicleWheel.getRadius();

            Geometry locGeom = (Geometry) debugNode.getChild("WheelLocationDebugShape" + i);
            Geometry dirGeom = (Geometry) debugNode.getChild("WheelDirectionDebugShape" + i);
            Geometry axleGeom = (Geometry) debugNode.getChild("WheelAxleDebugShape" + i);
            Geometry wheelGeom = (Geometry) debugNode.getChild("WheelRadiusDebugShape" + i);

            Arrow locArrow = (Arrow) locGeom.getMesh();
            locArrow.setArrowExtent(location);
            Arrow axleArrow = (Arrow) axleGeom.getMesh();
            axleArrow.setArrowExtent(axle.normalizeLocal().multLocal(0.3f));
            Arrow wheelArrow = (Arrow) wheelGeom.getMesh();
            wheelArrow.setArrowExtent(direction.normalizeLocal().multLocal(radius));
            Arrow dirArrow = (Arrow) dirGeom.getMesh();
            dirArrow.setArrowExtent(direction.normalizeLocal().multLocal(restLength));

            dirGeom.setLocalTranslation(location);
            axleGeom.setLocalTranslation(location.addLocal(direction));
            wheelGeom.setLocalTranslation(location);
            i++;
        }
        debugShape.updateLogicalState(0);
        debugShape.updateGeometricState();
        rm.renderScene(debugShape, vp);
    }
}