Search in sources :

Example 6 with WireFrustum

use of com.jme3.scene.debug.WireFrustum in project jmonkeyengine by jMonkeyEngine.

the class AbstractShadowRendererVR method createFrustum.

/**
     * debug function to create a visible frustum
     */
protected Geometry createFrustum(Vector3f[] pts, int i) {
    WireFrustum frustum = new WireFrustum(pts);
    Geometry frustumMdl = new Geometry("f", frustum);
    frustumMdl.setCullHint(Spatial.CullHint.Never);
    frustumMdl.setShadowMode(ShadowMode.Off);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.getAdditionalRenderState().setWireframe(true);
    frustumMdl.setMaterial(mat);
    switch(i) {
        case 0:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink);
            break;
        case 1:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
            break;
        case 2:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green);
            break;
        case 3:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue);
            break;
        default:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.White);
            break;
    }
    frustumMdl.updateGeometricState();
    return frustumMdl;
}
Also used : Geometry(com.jme3.scene.Geometry) WireFrustum(com.jme3.scene.debug.WireFrustum) Material(com.jme3.material.Material)

Aggregations

Material (com.jme3.material.Material)6 Geometry (com.jme3.scene.Geometry)6 WireFrustum (com.jme3.scene.debug.WireFrustum)6 Box (com.jme3.scene.shape.Box)3 DirectionalLight (com.jme3.light.DirectionalLight)2 Vector3f (com.jme3.math.Vector3f)2 Node (com.jme3.scene.Node)2 ChaseCameraAppState (com.jme3.app.ChaseCameraAppState)1 BoundingBox (com.jme3.bounding.BoundingBox)1 ActionListener (com.jme3.input.controls.ActionListener)1 AnalogListener (com.jme3.input.controls.AnalogListener)1 KeyTrigger (com.jme3.input.controls.KeyTrigger)1 MouseAxisTrigger (com.jme3.input.controls.MouseAxisTrigger)1 MouseButtonTrigger (com.jme3.input.controls.MouseButtonTrigger)1 AmbientLight (com.jme3.light.AmbientLight)1 SpotLight (com.jme3.light.SpotLight)1 Quaternion (com.jme3.math.Quaternion)1 BatchNode (com.jme3.scene.BatchNode)1 LightNode (com.jme3.scene.LightNode)1 Spatial (com.jme3.scene.Spatial)1