use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestRagdollCharacter method initWall.
public void initWall(float bLength, float bWidth, float bHeight) {
Box brick = new Box(bLength, bHeight, bWidth);
brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
mat2.setTexture("ColorMap", tex);
float startpt = bLength / 4;
float height = -5;
for (int j = 0; j < 15; j++) {
for (int i = 0; i < 4; i++) {
Vector3f ori = new Vector3f(i * bLength * 2 + startpt, bHeight + height, -10);
Geometry reBoxg = new Geometry("brick", brick);
reBoxg.setMaterial(mat2);
reBoxg.setLocalTranslation(ori);
//for geometry with sphere mesh the physics system automatically uses a sphere collision shape
reBoxg.addControl(new RigidBodyControl(1.5f));
reBoxg.setShadowMode(ShadowMode.CastAndReceive);
reBoxg.getControl(RigidBodyControl.class).setFriction(0.6f);
this.rootNode.attachChild(reBoxg);
this.getPhysicsSpace().add(reBoxg);
}
startpt = -startpt;
height += 2 * bHeight;
}
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestRagdollCharacter method simpleInitApp.
public void simpleInitApp() {
setupKeys();
bulletAppState = new BulletAppState();
bulletAppState.setEnabled(true);
stateManager.attach(bulletAppState);
// bulletAppState.getPhysicsSpace().enableDebug(assetManager);
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
initWall(2, 1, 1);
setupLight();
cam.setLocation(new Vector3f(-8, 0, -4));
cam.lookAt(new Vector3f(4, 0, -7), Vector3f.UNIT_Y);
model = (Node) assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
model.lookAt(new Vector3f(0, 0, -1), Vector3f.UNIT_Y);
model.setLocalTranslation(4, 0, -7f);
ragdoll = new KinematicRagdollControl(0.5f);
model.addControl(ragdoll);
getPhysicsSpace().add(ragdoll);
speed = 1.3f;
rootNode.attachChild(model);
AnimControl control = model.getControl(AnimControl.class);
animChannel = control.createChannel();
animChannel.setAnim("IdleTop");
control.addListener(this);
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestOrtho method simpleInitApp.
public void simpleInitApp() {
Picture p = new Picture("Picture");
// make it appear behind stats view
p.move(0, 0, -1);
p.setPosition(0, 0);
p.setWidth(settings.getWidth());
p.setHeight(settings.getHeight());
p.setImage(assetManager, "Interface/Logo/Monkey.png", false);
// attach geometry to orthoNode
guiNode.attachChild(p);
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestSoftwareMouse method simpleInitApp.
@Override
public void simpleInitApp() {
flyCam.setEnabled(false);
// inputManager.setCursorVisible(false);
Texture tex = assetManager.loadTexture("Interface/Logo/Cursor.png");
cursor = new Picture("cursor");
cursor.setTexture(assetManager, (Texture2D) tex, true);
cursor.setWidth(64);
cursor.setHeight(64);
guiNode.attachChild(cursor);
inputManager.addRawInputListener(inputListener);
// Image img = tex.getImage();
// ByteBuffer data = img.getData(0);
// IntBuffer image = BufferUtils.createIntBuffer(64 * 64);
// for (int y = 0; y < 64; y++){
// for (int x = 0; x < 64; x++){
// int rgba = data.getInt();
// image.put(rgba);
// }
// }
// image.clear();
//
// try {
// Cursor cur = new Cursor(64, 64, 2, 62, 1, image, null);
// Mouse.setNativeCursor(cur);
// } catch (LWJGLException ex) {
// Logger.getLogger(TestSoftwareMouse.class.getName()).log(Level.SEVERE, null, ex);
// }
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class HelloAudio method initAudio.
/** We create two audio nodes. */
private void initAudio() {
/* gun shot sound is to be triggered by a mouse click. */
audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false);
audio_gun.setPositional(false);
audio_gun.setLooping(false);
audio_gun.setVolume(2);
rootNode.attachChild(audio_gun);
/* nature sound - keeps playing in a loop. */
audio_nature = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", true);
// activate continuous playing
audio_nature.setLooping(true);
audio_nature.setPositional(true);
audio_nature.setVolume(3);
rootNode.attachChild(audio_nature);
// play continuously!
audio_nature.play();
}
Aggregations