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;
}
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);
}
}
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);
}
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);
}
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);
}
}
Aggregations