use of com.jme3.scene.Geometry in project jmonkeyengine by jMonkeyEngine.
the class TestEverything method setupRobotGuy.
// public void setupTerrain(){
// Material mat = manager.loadMaterial("Textures/Terrain/Rock/Rock.j3m");
// mat.getTextureParam("DiffuseMap").getValue().setWrap(WrapMode.Repeat);
// mat.getTextureParam("NormalMap").getValue().setWrap(WrapMode.Repeat);
// try{
// Geomap map = GeomapLoader.fromImage(TestEverything.class.getResource("/textures/heightmap.png"));
// Mesh m = map.createMesh(new Vector3f(0.35f, 0.0005f, 0.35f), new Vector2f(10, 10), true);
// Logger.getLogger(TangentBinormalGenerator.class.getName()).setLevel(Level.SEVERE);
// TangentBinormalGenerator.generate(m);
// Geometry t = new Geometry("Terrain", m);
// t.setLocalTranslation(85, -15, 0);
// t.setMaterial(mat);
// t.updateModelBound();
// t.setShadowMode(ShadowMode.Receive);
// rootNode.attachChild(t);
// }catch (IOException ex){
// ex.printStackTrace();
// }
//
// }
public void setupRobotGuy() {
Node model = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
Material mat = assetManager.loadMaterial("Models/Oto/Oto.j3m");
model.getChild(0).setMaterial(mat);
// model.setAnimation("Walk");
model.setLocalTranslation(30, 10.5f, 30);
model.setLocalScale(2);
model.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(model);
}
use of com.jme3.scene.Geometry in project jmonkeyengine by jMonkeyEngine.
the class CubeField method gameReset.
/**
* Used to reset cubeField
*/
private void gameReset() {
Score = 0;
lowCap = 10;
colorInt = 0;
highCap = 40;
difficulty = highCap;
for (Geometry cube : cubeField) {
cube.removeFromParent();
}
cubeField.clear();
if (fcube != null) {
fcube.removeFromParent();
}
fcube = createFirstCube();
obstacleColors.clear();
obstacleColors.add(ColorRGBA.Orange);
obstacleColors.add(ColorRGBA.Red);
obstacleColors.add(ColorRGBA.Yellow);
renderer.setBackgroundColor(ColorRGBA.White);
speed = lowCap / 400f;
coreTime = 20.0f;
coreTime2 = 10.0f;
diffHelp = lowCap;
player.setLocalTranslation(0, 0, 0);
}
use of com.jme3.scene.Geometry 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.scene.Geometry in project jmonkeyengine by jMonkeyEngine.
the class TestQ3 method simpleInitApp.
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
flyCam.setMoveSpeed(100);
setupKeys();
this.cam.setFrustumFar(2000);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White.clone().multLocal(2));
dl.setDirection(new Vector3f(-1, -1, -1).normalize());
rootNode.addLight(dl);
AmbientLight am = new AmbientLight();
am.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(am);
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/quake3level.zip", HttpZipLocator.class);
} else {
assetManager.registerLocator("quake3level.zip", ZipLocator.class);
}
// create the geometry and attach it
MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
gameLevel = (Node) assetManager.loadAsset(key);
gameLevel.setLocalScale(0.1f);
// add a physics control, it will generate a MeshCollisionShape based on the gameLevel
gameLevel.addControl(new RigidBodyControl(0));
player = new PhysicsCharacter(new SphereCollisionShape(5), .01f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(60, 10, -60));
rootNode.attachChild(gameLevel);
getPhysicsSpace().addAll(gameLevel);
getPhysicsSpace().add(player);
}
use of com.jme3.scene.Geometry 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);
}
Aggregations