use of com.jme3.math.Quaternion in project jmonkeyengine by jMonkeyEngine.
the class PhysicsGhostObject method getPhysicsRotation.
/**
* @return the physicsLocation
*/
public Quaternion getPhysicsRotation() {
Quaternion quat = new Quaternion();
getPhysicsRotation(objectId, quat);
return quat;
}
use of com.jme3.math.Quaternion in project jmonkeyengine by jMonkeyEngine.
the class PhysicsRigidBody method getPhysicsRotation.
/**
* @return the physicsLocation
*/
public Quaternion getPhysicsRotation() {
Quaternion quat = new Quaternion();
getPhysicsRotation(objectId, quat);
return quat;
}
use of com.jme3.math.Quaternion in project jmonkeyengine by jMonkeyEngine.
the class BufferUtils method createFloatBuffer.
/**
* Generate a new FloatBuffer using the given array of Quaternion objects.
* The FloatBuffer will be 4 * data.length long and contain the vector data.
*
* @param data
* array of Quaternion objects to place into a new FloatBuffer
*/
public static FloatBuffer createFloatBuffer(Quaternion... data) {
if (data == null) {
return null;
}
FloatBuffer buff = createFloatBuffer(4 * data.length);
for (Quaternion element : data) {
if (element != null) {
buff.put(element.getX()).put(element.getY()).put(element.getZ()).put(element.getW());
} else {
buff.put(0).put(0).put(0).put(0);
}
}
buff.flip();
return buff;
}
use of com.jme3.math.Quaternion in project jmonkeyengine by jMonkeyEngine.
the class TestAnisotropicFilter method simpleInitApp.
@Override
public void simpleInitApp() {
maxAniso = renderer.getLimits().get(Limits.TextureAnisotropy);
flyCam.setDragToRotate(true);
flyCam.setMoveSpeed(100);
cam.setLocation(new Vector3f(197.02617f, 4.6769195f, -194.89545f));
cam.setRotation(new Quaternion(0.07921988f, 0.8992258f, -0.18292196f, 0.38943136f));
Quad q = new Quad(1000, 1000);
q.scaleTextureCoordinates(new Vector2f(1000, 1000));
Geometry geom = new Geometry("quad", q);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.setMaterial(createCheckerBoardMaterial(assetManager));
rootNode.attachChild(geom);
inputManager.addMapping("higher", new KeyTrigger(KeyInput.KEY_1));
inputManager.addMapping("lower", new KeyTrigger(KeyInput.KEY_2));
inputManager.addListener(this, "higher");
inputManager.addListener(this, "lower");
}
use of com.jme3.math.Quaternion in project jmonkeyengine by jMonkeyEngine.
the class TestPostWaterLake method simpleInitApp.
public void simpleInitApp() {
this.flyCam.setMoveSpeed(10);
cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
// cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
// load sky
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
File file = new File("wildhouse.zip");
if (file.exists()) {
useHttp = false;
}
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class);
} else {
assetManager.registerLocator("wildhouse.zip", ZipLocator.class);
}
Spatial scene = assetManager.loadModel("main.scene");
rootNode.attachChild(scene);
DirectionalLight sun = new DirectionalLight();
Vector3f lightDir = new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
sun.setDirection(lightDir);
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
final WaterFilter water = new WaterFilter(rootNode, lightDir);
water.setWaterHeight(-20);
water.setUseFoam(false);
water.setUseRipples(false);
water.setDeepWaterColor(ColorRGBA.Brown);
water.setWaterColor(ColorRGBA.Brown.mult(2.0f));
water.setWaterTransparency(0.2f);
water.setMaxAmplitude(0.3f);
water.setWaveScale(0.008f);
water.setSpeed(0.7f);
water.setShoreHardness(1.0f);
water.setRefractionConstant(0.2f);
water.setShininess(0.3f);
water.setSunScale(1.0f);
water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));
fpp.addFilter(water);
viewPort.addProcessor(fpp);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if (isPressed) {
if (water.isUseHQShoreline()) {
water.setUseHQShoreline(false);
} else {
water.setUseHQShoreline(true);
}
}
}
}, "HQ");
inputManager.addMapping("HQ", new KeyTrigger(keyInput.KEY_SPACE));
}
Aggregations