com.jme3.scene.shape.Box.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中com.jme3.scene.shape.Box.<init>()方法的一些代码示例,展示了Box.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Box.<init>()方法的具体详情如下:
包路径:com.jme3.scene.shape.Box
类名称:Box
方法名:<init>

Box.<init>介绍

[英]Empty constructor for serialization only. Do not use.
[中]空构造函数仅用于序列化。不要使用。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Creates a clone of this box.
 * <p>
 * The cloned box will have '_clone' appended to its name, but all other
 * properties will be the same as this box.
 */
@Override
public Box clone() {
  return new Box(center.clone(), xExtent, yExtent, zExtent);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void initialize(){
  super.initialize();
  System.out.println("Initialize");
  // create a box
  boxGeom = new Geometry("Box", new Box(2, 2, 2));
  // load some default material
  boxGeom.setMaterial(assetManager.loadMaterial("Interface/Logo/Logo.j3m"));
  // attach box to display in primary viewport
  viewPort.attachScene(boxGeom);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void simpleInitApp() {
  /** this blue box is our player character */
  Box b = new Box(1, 1, 1);
  player = new Geometry("blue cube", b);
  Material mat = new Material(assetManager,
   "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", ColorRGBA.Blue);
  player.setMaterial(mat);
  rootNode.attachChild(player);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public Geometry createHDRBox(){
  Box boxMesh = new Box(1, 1, 1);
  Geometry box = new Geometry("Box", boxMesh);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setTexture("ColorMap", assetManager.loadTexture("Textures/HdrTest/Memorial.hdr"));
  box.setMaterial(mat);
  return box;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/** A floor to show that the "shot" can go through several objects. */
protected Geometry makeFloor() {
 Box box = new Box(15, .2f, 15);
 Geometry floor = new Geometry("the Floor", box);
 floor.setLocalTranslation(0, -4, -5);
 Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 mat1.setColor("Color", ColorRGBA.Gray);
 floor.setMaterial(mat1);
 return floor;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public void simpleInitApp() {
    Box b = new Box(1, 1, 1); // create cube shape
    Geometry geom = new Geometry("Box", b);  // create cube geometry from the shape
    Material mat = new Material(assetManager,
     "Common/MatDefs/Misc/Unshaded.j3md");  // create a simple material
    mat.setColor("Color", ColorRGBA.Blue);   // set color of material to blue
    geom.setMaterial(mat);                   // set the cube's material
    rootNode.attachChild(geom);              // make the cube appear in the scene
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@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);
  System.out.println("Attaching test state.");
  stateManager.attach(new TestState());        
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@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);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/** A cube object for target practice */
protected Geometry makeCube(String name, float x, float y, float z) {
  Box box = new Box(1, 1, 1);
  Geometry cube = new Geometry(name, box);
  cube.setLocalTranslation(x, y, z);
  Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat1.setColor("Color", ColorRGBA.randomColor());
  cube.setMaterial(mat1);
  return cube;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@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);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/** A cube object for target practice */
protected Geometry makeCube(String name, float x, float y, float z) {
 Box box = new Box(1, 1, 1);
 Geometry cube = new Geometry(name, box);
 cube.setLocalTranslation(x, y, z);
 Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 mat1.setColor("Color", ColorRGBA.randomColor());
 cube.setMaterial(mat1);
 return cube;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

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;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void simpleInitApp() {
  Box b = new Box(1, 1, 1);
 player = new Geometry("Player", b);
 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 mat.setColor("Color", ColorRGBA.Blue);
 player.setMaterial(mat);
 rootNode.attachChild(player);
 initKeys(); // load my custom keybinding
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public void simpleInitApp() {
    flyCam.setDragToRotate(true);

    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);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private Geometry createFirstCube() {
  Vector3f loc = player.getLocalTranslation();
  loc.addLocal(4, 0, 0);
  Box b = new Box(1, 1, 1);
  Geometry geom = new Geometry("Box", b);
  geom.setLocalTranslation(loc);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", ColorRGBA.Blue);
  geom.setMaterial(mat);
  return geom;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void setupFloor() {
  Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m");
  Box floor = new Box(50, 1f, 50);
  TangentBinormalGenerator.generate(floor);
  floor.scaleTextureCoordinates(new Vector2f(5, 5));
  Geometry floorGeom = new Geometry("Floor", floor);
  floorGeom.setMaterial(mat);
  floorGeom.setShadowMode(ShadowMode.Receive);
  rootNode.attachChild(floorGeom);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void setupFloor(){
  Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m");
  Box floor = new Box(50, 1f, 50);
  TangentBinormalGenerator.generate(floor);
  floor.scaleTextureCoordinates(new Vector2f(5, 5));
  Geometry floorGeom = new Geometry("Floor", floor);
  floorGeom.setMaterial(mat);
  floorGeom.setShadowMode(ShadowMode.Receive);
  rootNode.attachChild(floorGeom);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void initFloor() {
  Box floorBox = new Box(10f, 0.1f, 5f);
  floorBox.scaleTextureCoordinates(new Vector2f(3, 6));
  Geometry floor = new Geometry("floor", floorBox);
  floor.setMaterial(mat3);
  floor.setShadowMode(ShadowMode.Receive);
  floor.setLocalTranslation(0, 0, 0);
  floor.addControl(new RigidBodyControl(0));
  this.rootNode.attachChild(floor);
  this.getPhysicsSpace().add(floor);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void initFloor() {
  Box floorBox = new Box(10f, 0.1f, 5f);
  floorBox.scaleTextureCoordinates(new Vector2f(3, 6));
  Geometry floor = new Geometry("floor", floorBox);
  floor.setMaterial(mat3);
  floor.setShadowMode(ShadowMode.Receive);
  floor.setLocalTranslation(0, 0, 0);
  floor.addControl(new RigidBodyControl(0));
  this.rootNode.attachChild(floor);
  this.getPhysicsSpace().add(floor);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void initFloor() {
  Box floorBox = new Box(10f, 0.1f, 5f);
  floorBox.scaleTextureCoordinates(new Vector2f(3, 6));
  Geometry floor = new Geometry("floor", floorBox);
  floor.setMaterial(mat3);
  floor.setShadowMode(ShadowMode.Receive);
  floor.setLocalTranslation(0, -0.1f, 0);
  floor.addControl(new RigidBodyControl(new BoxCollisionShape(new Vector3f(10f, 0.1f, 5f)), 0));
  this.rootNode.attachChild(floor);
  this.getPhysicsSpace().add(floor);
}

相关文章