Search in sources :

Example 16 with Vector2f

use of com.jme3.math.Vector2f in project jmonkeyengine by jMonkeyEngine.

the class VRBounds method init.

/**
     * Initialize the VR bounds.
     * @return <code>true</code> if the initialization is a success and <code>false</code> otherwise.
     */
public static boolean init() {
    logger.config("Initialize VR bounds...");
    if (vrChaperone == null) {
        vrChaperone = new VR_IVRChaperone_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRChaperone_Version, OpenVR.hmdErrorStore).getPointer());
        if (vrChaperone != null) {
            vrChaperone.setAutoSynch(false);
            vrChaperone.read();
            FloatByReference fbX = new FloatByReference();
            FloatByReference fbZ = new FloatByReference();
            vrChaperone.GetPlayAreaSize.apply(fbX, fbZ);
            playSize = new Vector2f(fbX.getValue(), fbZ.getValue());
            logger.config("Initialize VR bounds [SUCCESS]");
            // init success
            return true;
        }
        logger.warning("Initialize VR bounds [FAILED].");
        // failed to init
        return false;
    }
    logger.config("Initialize VR bounds already done.");
    // already initialized
    return true;
}
Also used : FloatByReference(com.sun.jna.ptr.FloatByReference) Vector2f(com.jme3.math.Vector2f) VR_IVRChaperone_FnTable(com.jme3.system.jopenvr.VR_IVRChaperone_FnTable)

Example 17 with Vector2f

use of com.jme3.math.Vector2f in project jmonkeyengine by jMonkeyEngine.

the class PssmShadowRenderer method setShadowZFadeLength.

/**
     * Define the length over which the shadow will fade out when using a
     * shadowZextend This is useful to make dynamic shadows fade into baked
     * shadows in the distance.
     *
     * @param length the fade length in world units
     */
public void setShadowZFadeLength(float length) {
    if (length == 0) {
        fadeInfo = null;
        fadeLength = 0;
        postshadowMat.clearParam("FadeInfo");
    } else {
        if (zFarOverride == 0) {
            fadeInfo = new Vector2f(0, 0);
        } else {
            fadeInfo = new Vector2f(zFarOverride - length, 1.0f / length);
        }
        fadeLength = length;
        postshadowMat.setVector2("FadeInfo", fadeInfo);
    }
}
Also used : Vector2f(com.jme3.math.Vector2f)

Example 18 with Vector2f

use of com.jme3.math.Vector2f in project jmonkeyengine by jMonkeyEngine.

the class DirectionalLightShadowRenderer method read.

@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    lambda = ic.readFloat("lambda", 0.65f);
    zFarOverride = ic.readInt("zFarOverride", 0);
    light = (DirectionalLight) ic.readSavable("light", null);
    fadeInfo = (Vector2f) ic.readSavable("fadeInfo", null);
    fadeLength = ic.readFloat("fadeLength", 0f);
    init(nbShadowMaps, (int) shadowMapSize);
}
Also used : InputCapsule(com.jme3.export.InputCapsule)

Example 19 with Vector2f

use of com.jme3.math.Vector2f in project jmonkeyengine by jMonkeyEngine.

the class SpotLightShadowRenderer method read.

@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    zFarOverride = ic.readInt("zFarOverride", 0);
    light = (SpotLight) ic.readSavable("light", null);
    fadeInfo = (Vector2f) ic.readSavable("fadeInfo", null);
    fadeLength = ic.readFloat("fadeLength", 0f);
    init((int) shadowMapSize);
}
Also used : InputCapsule(com.jme3.export.InputCapsule)

Example 20 with Vector2f

use of com.jme3.math.Vector2f in project jmonkeyengine by jMonkeyEngine.

the class AbstractShadowRenderer method setShadowZFadeLength.

/**
     * Define the length over which the shadow will fade out when using a
     * shadowZextend This is useful to make dynamic shadows fade into baked
     * shadows in the distance.
     *
     * @param length the fade length in world units
     */
public void setShadowZFadeLength(float length) {
    if (length == 0) {
        fadeInfo = null;
        fadeLength = 0;
        postshadowMat.clearParam("FadeInfo");
    } else {
        if (zFarOverride == 0) {
            fadeInfo = new Vector2f(0, 0);
        } else {
            fadeInfo = new Vector2f(zFarOverride - length, 1.0f / length);
        }
        fadeLength = length;
        postshadowMat.setVector2("FadeInfo", fadeInfo);
    }
}
Also used : Vector2f(com.jme3.math.Vector2f)

Aggregations

Vector2f (com.jme3.math.Vector2f)80 Vector3f (com.jme3.math.Vector3f)38 Geometry (com.jme3.scene.Geometry)22 Material (com.jme3.material.Material)20 Box (com.jme3.scene.shape.Box)17 ArrayList (java.util.ArrayList)14 Texture (com.jme3.texture.Texture)9 List (java.util.List)9 Node (com.jme3.scene.Node)8 Sphere (com.jme3.scene.shape.Sphere)8 FloatBuffer (java.nio.FloatBuffer)8 InputCapsule (com.jme3.export.InputCapsule)7 Spatial (com.jme3.scene.Spatial)7 DirectionalLight (com.jme3.light.DirectionalLight)6 Mesh (com.jme3.scene.Mesh)6 AmbientLight (com.jme3.light.AmbientLight)5 Quad (com.jme3.scene.shape.Quad)5 BoundingBox (com.jme3.bounding.BoundingBox)4 RigidBodyControl (com.jme3.bullet.control.RigidBodyControl)4 CollisionResult (com.jme3.collision.CollisionResult)4