当前位置: 首页>>代码示例>>Java>>正文


Java Box类代码示例

本文整理汇总了Java中com.jme3.scene.shape.Box的典型用法代码示例。如果您正苦于以下问题:Java Box类的具体用法?Java Box怎么用?Java Box使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Box类属于com.jme3.scene.shape包,在下文中一共展示了Box类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseMaterialEditor3DState

import com.jme3.scene.shape.Box; //导入依赖的package包/类
public BaseMaterialEditor3DState(@NotNull final T fileEditor) {
    super(fileEditor);
    this.testBox = new Geometry("Box", new Box(2, 2, 2));
    this.testSphere = new Geometry("Sphere", new Sphere(30, 30, 2));
    this.testQuad = new Geometry("Quad", new Quad(4, 4));
    this.testQuad.setLocalTranslation(QUAD_OFFSET);
    this.lightEnabled = MaterialFileEditor.DEFAULT_LIGHT_ENABLED;

    TangentGenerator.useMikktspaceGenerator(testBox);
    TangentGenerator.useMikktspaceGenerator(testSphere);
    TangentGenerator.useMikktspaceGenerator(testQuad);

    final DirectionalLight light = notNull(getLightForCamera());
    light.setDirection(LIGHT_DIRECTION);

    final EditorCamera editorCamera = notNull(getEditorCamera());
    editorCamera.setDefaultHorizontalRotation(H_ROTATION);
    editorCamera.setDefaultVerticalRotation(V_ROTATION);

    getModelNode().attachChild(getNodeForCamera());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:BaseMaterialEditor3DState.java

示例2: JMEFilePreviewManager

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private JMEFilePreviewManager() {
    this.imageView = new ImageView();
    this.testBox = new Geometry("Box", new Box(2, 2, 2));
    this.modelNode = new Node("Model Node");

    final ExecutorManager executorManager = ExecutorManager.getInstance();
    executorManager.addFXTask(() -> {

        final JFXApplication application = JFXApplication.getInstance();
        final EditorFXScene scene = application.getScene();
        final StackPane container = scene.getHideLayer();

        FXUtils.addToPane(imageView, container);

        TangentGenerator.useMikktspaceGenerator(testBox);

        final JMEThreadExecutor executor = JMEThreadExecutor.getInstance();
        executor.addToExecute(this::prepareScene);
    });
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:JMEFilePreviewManager.java

示例3: createGeometry

import com.jme3.scene.shape.Box; //导入依赖的package包/类
protected @NotNull Geometry createGeometry(@NotNull final ScenePresentable.PresentationType presentationType) {

        final Material material = new Material(EDITOR.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
        material.setColor("Color", ColorRGBA.Yellow);
        material.getAdditionalRenderState().setWireframe(true);

        Geometry geometry;

        switch (presentationType) {
            case SPHERE: {
                geometry = new Geometry("Sphere", new Sphere(8, 8, 1));
                break;
            }
            default: {
                geometry = new Geometry("Box", new Box(1, 1, 1));
            }
        }

        geometry.setMaterial(material);
        return geometry;
    }
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:AbstractSceneEditor3DState.java

示例4: simpleInitApp

import com.jme3.scene.shape.Box; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    Application a;
    flyCam = new ExtendedFlyByCam(cam);
    flyCam.setDragToRotate(true);
    flyCam.setMoveSpeed(50);        
    flyCam.registerWithInput(getInputManager());   

    Box b = new Box(5, 5, 5);
    Geometry geom = new Geometry("Box", b);

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setWireframe(true);
    geom.setMaterial(mat);
    
    Alarm al = new Alarm(this);

    stateManager.attach(new ModifierKeysAppState());
    rootNode.attachChild(geom);
    final MouseManager mouseManager = new MouseManager(rootNode, al);
    mouseManager.addListener(this);        
    stateManager.attach(mouseManager);


}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:27,代码来源:TestMouseManager.java

示例5: simpleInitApp

import com.jme3.scene.shape.Box; //导入依赖的package包/类
@Override
public void simpleInitApp() {
  flyCam.setMoveSpeed(40);
  
  /** just a blue box floating in space */
  Box box1 = new Box(Vector3f.ZERO, 1, 1, 1);
  player = new Geometry("Player", box1);
  Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat1.setColor("Color", ColorRGBA.Blue);
  player.setMaterial(mat1);
  rootNode.attachChild(player);

  /** custom init methods, see below */
  initKeys();
  initAudio();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:HelloAudio.java

示例6: simpleInitApp

import com.jme3.scene.shape.Box; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    cam.setLocation(new Vector3f(3, 3, 3));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

    //setup main scene
    Geometry quad = new Geometry("box", new Box(Vector3f.ZERO, 1,1,1));

    Texture offTex = setupOffscreenView();

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", offTex);
    quad.setMaterial(mat);
    rootNode.attachChild(quad);
    inputManager.addMapping(TOGGLE_UPDATE, new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addListener(this, TOGGLE_UPDATE);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:TestRenderToTexture.java

示例7: attachRandomGeometry

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private void attachRandomGeometry(Node node, Material mat) {
    Box box = new Box(0.25f, 0.25f, 0.25f);
    Torus torus = new Torus(16, 16, 0.2f, 0.8f);
    Geometry[] boxes = new Geometry[]{
        new Geometry("box1", box),
        new Geometry("box2", box),
        new Geometry("box3", box),
        new Geometry("torus1", torus),
        new Geometry("torus2", torus),
        new Geometry("torus3", torus)
    };
    for (int i = 0; i < boxes.length; i++) {
        Geometry geometry = boxes[i];
        geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
        geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI));
        geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
        geometry.setMaterial(mat);
        node.attachChild(geometry);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:TestCollisionShapeFactory.java

示例8: createWall

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private void createWall() {
    float xOff = -144;
    float zOff = -40;
    float startpt = bLength / 4 - xOff;
    float height = 6.1f;
    brick = new Box(Vector3f.ZERO, bLength, bHeight, bWidth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
    for (int j = 0; j < 15; j++) {
        for (int i = 0; i < 4; i++) {
            Vector3f vt = new Vector3f(i * bLength * 2 + startpt, bHeight + height, zOff);
            addBrick(vt);
        }
        startpt = -startpt;
        height += 1.01f * bHeight;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:TestWalkingChar.java

示例9: setupFloor

import com.jme3.scene.shape.Box; //导入依赖的package包/类
public void setupFloor() {
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    TextureKey key = new TextureKey("Interface/Logo/Monkey.jpg", true);
    key.setGenerateMips(true);
    Texture tex = assetManager.loadTexture(key);
    tex.setMinFilter(Texture.MinFilter.Trilinear);
    mat.setTexture("ColorMap", tex);

    Box floor = new Box(Vector3f.ZERO, 100, 1f, 100);
    Geometry floorGeom = new Geometry("Floor", floor);
    floorGeom.setMaterial(mat);
    floorGeom.setLocalTranslation(new Vector3f(0f, -3, 0f));

    floorGeom.addControl(new RigidBodyControl(new MeshCollisionShape(floorGeom.getMesh()), 0));
    rootNode.attachChild(floorGeom);
    getPhysicsSpace().add(floorGeom);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:TestAttachDriver.java

示例10: simpleInitApp

import com.jme3.scene.shape.Box; //导入依赖的package包/类
public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 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);

        NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
                                                          inputManager,
                                                          audioRenderer,
                                                          guiViewPort);
        nifty = niftyDisplay.getNifty();

        URL url = Thread.currentThread().getContextClassLoader().getResource("jme3test/niftygui/hellojme.xml");
        
        nifty.fromXml("Interface/Nifty/HelloJme.xml", "start", this);

        // attach the nifty display to the gui view port as a processor
        guiViewPort.addProcessor(niftyDisplay);

        // disable the fly cam
//        flyCam.setEnabled(false);
        flyCam.setDragToRotate(true);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:TestNiftyGui.java

示例11: createBox

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private void createBox() {
        //creating a transluscent box
        box = new Geometry("box", new Box(new Vector3f(0, 0, 0), 50, 50, 50));
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f));
        mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        //mat.getAdditionalRenderState().setDepthWrite(false);
        //mat.getAdditionalRenderState().setDepthTest(false);
        box.setMaterial(mat);
        box.setQueueBucket(Bucket.Translucent);


        //creating a post view port
//        ViewPort post=renderManager.createPostView("transpPost", cam);
//        post.setClearFlags(false, true, true);


        box.setLocalTranslation(-600, 0, 300);

        //attaching the box to the post viewport
        //Don't forget to updateGeometricState() the box in the simpleUpdate
        //  post.attachScene(box);

        rootNode.attachChild(box);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:TestPostWater.java

示例12: initScene

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private void initScene() {
    //init cam location
    cam.setLocation(new Vector3f(0, 10, 10));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
    //init scene
    sceneNode = new Node("Scene");
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    geom.setMaterial(mat);
    sceneNode.attachChild(geom);

    // load sky
    sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
    rootNode.attachChild(sceneNode);

    //add lightPos Geometry
    Sphere lite=new Sphere(8, 8, 3.0f);
    lightSphere=new Geometry("lightsphere", lite);
    lightSphere.setMaterial(mat);
    lightSphere.setLocalTranslation(lightPos);
    rootNode.attachChild(lightSphere);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:TestSimpleWater.java

示例13: createPlayer

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private Node createPlayer() {
    Dome b = new Dome(Vector3f.ZERO, 10, 100, 1);
    Geometry playerMesh = new Geometry("Box", b);

    playerMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    playerMaterial.setColor("Color", ColorRGBA.Red);
    playerMesh.setMaterial(playerMaterial);
    playerMesh.setName("player");

    Box floor = new Box(Vector3f.ZERO.add(playerMesh.getLocalTranslation().getX(),
            playerMesh.getLocalTranslation().getY() - 1, 0), 100, 0, 100);
    Geometry floorMesh = new Geometry("Box", floor);

    floorMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    floorMaterial.setColor("Color", ColorRGBA.LightGray);
    floorMesh.setMaterial(floorMaterial);
    floorMesh.setName("floor");

    Node playerNode = new Node();
    playerNode.attachChild(playerMesh);
    playerNode.attachChild(floorMesh);

    return playerNode;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:CubeField.java

示例14: attachDebugNode

import com.jme3.scene.shape.Box; //导入依赖的package包/类
private void attachDebugNode(Node root) {
    if (debugNode == null) {
        debugNode = new Node();
        Material m = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
        for (Iterator<Vector3f> it = spline.getControlPoints().iterator(); it.hasNext();) {
            Vector3f cp = it.next();
            Geometry geo = new Geometry("box", new Box(cp, 0.3f, 0.3f, 0.3f));
            geo.setMaterial(m);
            debugNode.attachChild(geo);

        }
        switch (spline.getType()) {
            case CatmullRom:
                debugNode.attachChild(CreateCatmullRomPath());
                break;
            case Linear:
                debugNode.attachChild(CreateLinearPath());
                break;
            default:
                debugNode.attachChild(CreateLinearPath());
                break;
        }

        root.attachChild(debugNode);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:MotionPath.java

示例15: initialize

import com.jme3.scene.shape.Box; //导入依赖的package包/类
@Override
		public void initialize(AppStateManager stateManager, Application app) {
			super.initialize(stateManager, app);

	        // Create a new cam for the gui
	        Camera particlesCam = new Camera(settings.getWidth(), settings.getHeight());
//	        particlesCam.setParallelProjection(true);
	        ViewPort particlesViewPort = renderManager.createPostView("Particles Default", getCamera());
//	        particlesViewPort.setClearFlags(false, false, false);
	        particlesNode = new Node("Particles Node");
//	        particlesNode.setQueueBucket(Bucket.Gui);
//	        particlesNode.setCullHint(CullHint.Never);
	        particlesViewPort.attachScene(particlesNode);



			Box b = new Box(1, 1, 1);
			Geometry geom = new Geometry("Box", b);

			Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
			mat.setColor("Color", ColorRGBA.Red);
			geom.setMaterial(mat);
			particlesNode.attachChild(geom);
		}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:25,代码来源:EffectsExample.java


注:本文中的com.jme3.scene.shape.Box类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。