use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class PlaceholderAssets method getPlaceholderModel.
public static Spatial getPlaceholderModel(AssetManager assetManager) {
// What should be the size? Nobody knows
// the user's expected scale...
Box box = new Box(1, 1, 1);
Geometry geom = new Geometry("placeholder", box);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture tex = assetManager.loadTexture("Common/Textures/MissingModel.png");
tex.setWrap(Texture.WrapMode.Repeat);
mat.setTexture("ColorMap", tex);
geom.setMaterial(mat);
return geom;
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class SkyFactory method createSky.
/**
* Create a sky using the given cubemap or spheremap texture.
*
* @param assetManager from which to load materials
* @param textureName the path to the texture asset to use
* @param envMapType see {@link EnvMapType}
* @return a new spatial representing the sky, ready to be attached to the
* scene graph
*/
public static Spatial createSky(AssetManager assetManager, String textureName, EnvMapType envMapType) {
TextureKey key = new TextureKey(textureName, true);
key.setGenerateMips(false);
if (envMapType == EnvMapType.CubeMap) {
key.setTextureTypeHint(Texture.Type.CubeMap);
}
Texture tex = assetManager.loadTexture(key);
return createSky(assetManager, tex, envMapType);
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestAdvanced method createSky.
private void createSky() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
use of com.jme3.scene.Spatial 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));
}
use of com.jme3.scene.Spatial in project jmonkeyengine by jMonkeyEngine.
the class TestUserData method simpleInitApp.
public void simpleInitApp() {
Node scene = (Node) assetManager.loadModel("Scenes/DotScene/DotScene.scene");
System.out.println("Scene: " + scene);
Spatial testNode = scene.getChild("TestNode");
System.out.println("TestNode: " + testNode);
for (String key : testNode.getUserDataKeys()) {
System.out.println("Property " + key + " = " + testNode.getUserData(key));
}
}
Aggregations