use of com.jme3.math.Vector3f in project jmonkeyengine by jMonkeyEngine.
the class TestCinematic method createScene.
private void createScene() {
model = (Spatial) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
model.center();
model.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(model);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Cyan);
teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
teapot.setLocalTranslation(10, 0, 10);
teapot.setMaterial(mat);
teapot.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(teapot);
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
matSoil.setBoolean("UseMaterialColors", true);
matSoil.setColor("Ambient", ColorRGBA.Gray);
matSoil.setColor("Diffuse", ColorRGBA.Green);
matSoil.setColor("Specular", ColorRGBA.Black);
Geometry soil = new Geometry("soil", new Box(50, 1, 50));
soil.setLocalTranslation(0, -6, 0);
soil.setMaterial(matSoil);
soil.setShadowMode(ShadowMode.Receive);
rootNode.attachChild(soil);
DirectionalLight light = new DirectionalLight();
light.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
light.setColor(ColorRGBA.White.mult(1.5f));
rootNode.addLight(light);
fpp = new FilterPostProcessor(assetManager);
fade = new FadeFilter();
fpp.addFilter(fade);
if (renderer.getCaps().contains(Caps.GLSL100)) {
PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
pssm.setShadowIntensity(0.4f);
viewPort.addProcessor(pssm);
viewPort.addProcessor(fpp);
}
}
use of com.jme3.math.Vector3f in project jmonkeyengine by jMonkeyEngine.
the class TestCinematic method createCameraMotion.
private void createCameraMotion() {
CameraNode camNode = cinematic.bindCamera("topView", cam);
camNode.setLocalTranslation(new Vector3f(0, 50, 0));
camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y);
CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
path = new MotionPath();
path.setCycle(true);
path.addWayPoint(new Vector3f(20, 3, 0));
path.addWayPoint(new Vector3f(0, 3, 20));
path.addWayPoint(new Vector3f(-20, 3, 0));
path.addWayPoint(new Vector3f(0, 3, -20));
path.setCurveTension(0.83f);
cameraMotionEvent = new MotionEvent(camNode2, path);
cameraMotionEvent.setLoopMode(LoopMode.Loop);
cameraMotionEvent.setLookAt(model.getWorldTranslation(), Vector3f.UNIT_Y);
cameraMotionEvent.setDirectionType(MotionEvent.Direction.LookAt);
}
use of com.jme3.math.Vector3f in project jmonkeyengine by jMonkeyEngine.
the class TestUrlLoading method simpleInitApp.
@Override
public void simpleInitApp() {
// create a simple plane/quad
Quad quadMesh = new Quad(1, 1);
quadMesh.updateGeometry(1, 1, true);
Geometry quad = new Geometry("Textured Quad", quadMesh);
assetManager.registerLocator("https://raw.githubusercontent.com/jMonkeyEngine/BookSamples/master/assets/Textures/", UrlLocator.class);
TextureKey key = new TextureKey("mucha-window.png", false);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
quad.setMaterial(mat);
float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight();
quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1));
quad.center();
rootNode.attachChild(quad);
}
use of com.jme3.math.Vector3f in project jmonkeyengine by jMonkeyEngine.
the class TestAmbient method simpleInitApp.
@Override
public void simpleInitApp() {
float[] eax = new float[] { 15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f, -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f };
Environment env = new Environment(eax);
audioRenderer.setEnvironment(env);
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false);
waves.setPositional(true);
waves.setLocalTranslation(new Vector3f(0, 0, 0));
waves.setMaxDistance(100);
waves.setRefDistance(5);
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
nature.setPositional(false);
nature.setVolume(3);
waves.playInstance();
nature.play();
// just a blue box to mark the spot
Box box1 = new Box(.5f, .5f, .5f);
Geometry player = new Geometry("Player", box1);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Blue);
player.setMaterial(mat1);
rootNode.attachChild(player);
}
use of com.jme3.math.Vector3f in project jmonkeyengine by jMonkeyEngine.
the class TestJaime method setupLights.
public void setupLights() {
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1));
rootNode.addLight(al);
SpotLight sl = new SpotLight();
sl.setColor(ColorRGBA.White.mult(1.0f));
sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f));
sl.setDirection(sl.getPosition().mult(-1));
sl.setSpotOuterAngle(0.1f);
sl.setSpotInnerAngle(0.004f);
rootNode.addLight(sl);
//pointlight to fake indirect light coming from the ground
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White.mult(1.5f));
pl.setPosition(new Vector3f(0, 0, 1));
pl.setRadius(2);
rootNode.addLight(pl);
SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024);
shadows.setLight(sl);
shadows.setShadowIntensity(0.3f);
shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
viewPort.addProcessor(shadows);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
SSAOFilter filter = new SSAOFilter(0.10997847f, 0.440001f, 0.39999998f, -0.008000026f);
;
fpp.addFilter(filter);
fpp.addFilter(new FXAAFilter());
fpp.addFilter(new FXAAFilter());
viewPort.addProcessor(fpp);
}
Aggregations