use of com.jme3.material.Material in project jmonkeyengine by jMonkeyEngine.
the class TestLightScattering method simpleInitApp.
@Override
public void simpleInitApp() {
// put the camera in a bad position
cam.setLocation(new Vector3f(55.35316f, -0.27061665f, 27.092093f));
cam.setRotation(new Quaternion(0.010414706f, 0.9874893f, 0.13880467f, -0.07409228f));
// cam.setDirection(new Vector3f(0,-0.5f,1.0f));
// cam.setLocation(new Vector3f(0, 300, -500));
//cam.setFrustumFar(1000);
flyCam.setMoveSpeed(10);
Material mat = assetManager.loadMaterial("Textures/Terrain/Rocky/Rocky.j3m");
Spatial scene = assetManager.loadModel("Models/Terrain/Terrain.mesh.xml");
TangentBinormalGenerator.generate(((Geometry) ((Node) scene).getChild(0)).getMesh());
scene.setMaterial(mat);
scene.setShadowMode(ShadowMode.CastAndReceive);
scene.setLocalScale(400);
scene.setLocalTranslation(0, -10, -120);
rootNode.attachChild(scene);
// load sky
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false));
DirectionalLight sun = new DirectionalLight();
Vector3f lightDir = new Vector3f(-0.12f, -0.3729129f, 0.74847335f);
sun.setDirection(lightDir);
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
int numSamples = getContext().getSettings().getSamples();
if (numSamples > 0) {
fpp.setNumSamples(numSamples);
}
Vector3f lightPos = lightDir.multLocal(-3000);
LightScatteringFilter filter = new LightScatteringFilter(lightPos);
LightScatteringUI ui = new LightScatteringUI(inputManager, filter);
fpp.addFilter(filter);
viewPort.addProcessor(fpp);
}
use of com.jme3.material.Material in project jmonkeyengine by jMonkeyEngine.
the class TestOgreComplexAnim method simpleInitApp.
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(10f);
cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
rootNode.addLight(dl);
Node model = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
control = model.getControl(AnimControl.class);
AnimChannel feet = control.createChannel();
AnimChannel leftHand = control.createChannel();
AnimChannel rightHand = control.createChannel();
// feet will dodge
feet.addFromRootBone("hip.right");
feet.addFromRootBone("hip.left");
feet.setAnim("Dodge");
feet.setSpeed(2);
feet.setLoopMode(LoopMode.Cycle);
// will blend over 15 seconds to stand
feet.setAnim("Walk", 15);
feet.setSpeed(0.25f);
feet.setLoopMode(LoopMode.Cycle);
// left hand will pull
leftHand.addFromRootBone("uparm.right");
leftHand.setAnim("pull");
leftHand.setSpeed(.5f);
// will blend over 15 seconds to stand
leftHand.setAnim("stand", 15);
// right hand will push
rightHand.addBone("spinehigh");
rightHand.addFromRootBone("uparm.left");
rightHand.setAnim("push");
SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton());
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", ColorRGBA.Green);
mat.getAdditionalRenderState().setDepthTest(false);
skeletonDebug.setMaterial(mat);
model.attachChild(skeletonDebug);
rootNode.attachChild(model);
}
use of com.jme3.material.Material in project jmonkeyengine by jMonkeyEngine.
the class TestSkeletonControlRefresh method setupFloor.
public void setupFloor() {
Quad q = new Quad(20, 20);
q.scaleTextureCoordinates(Vector2f.UNIT_XY.mult(10));
Geometry geom = new Geometry("floor", q);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.White);
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.move(0, -0.3f, 0);
geom.setShadowMode(RenderQueue.ShadowMode.Receive);
rootNode.attachChild(geom);
}
use of com.jme3.material.Material in project jmonkeyengine by jMonkeyEngine.
the class TestBillboard method simpleInitApp.
public void simpleInitApp() {
flyCam.setMoveSpeed(10);
Quad q = new Quad(2, 2);
Geometry g = new Geometry("Quad", q);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
g.setMaterial(mat);
Quad q2 = new Quad(1, 1);
Geometry g3 = new Geometry("Quad2", q2);
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat2.setColor("Color", ColorRGBA.Yellow);
g3.setMaterial(mat2);
g3.setLocalTranslation(.5f, .5f, .01f);
Box b = new Box(.25f, .5f, .25f);
Geometry g2 = new Geometry("Box", b);
g2.setLocalTranslation(0, 0, 3);
g2.setMaterial(mat);
Node bb = new Node("billboard");
BillboardControl control = new BillboardControl();
bb.addControl(control);
bb.attachChild(g);
bb.attachChild(g3);
n = new Node("parent");
n.attachChild(g2);
n.attachChild(bb);
rootNode.attachChild(n);
n2 = new Node("parentParent");
n2.setLocalTranslation(Vector3f.UNIT_X.mult(5));
n2.attachChild(n);
rootNode.attachChild(n2);
// rootNode.attachChild(bb);
// rootNode.attachChild(g2);
}
use of com.jme3.material.Material in project jmonkeyengine by jMonkeyEngine.
the class TestBox method simpleInitApp.
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
Aggregations