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


Java BulletAppState.setThreadingType方法代码示例

本文整理汇总了Java中com.jme3.bullet.BulletAppState.setThreadingType方法的典型用法代码示例。如果您正苦于以下问题:Java BulletAppState.setThreadingType方法的具体用法?Java BulletAppState.setThreadingType怎么用?Java BulletAppState.setThreadingType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.bullet.BulletAppState的用法示例。


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

示例1: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
    stateManager.attach(bulletAppState);
    setupKeys();
    prepareBullet();
    prepareEffect();
    createLight();
    createSky();
    createTerrain();
    createWall();
    createCharacter();
    setupChaseCamera();
    setupAnimationController();
    setupFilter();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:TestWalkingChar.java

示例2: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
    public void simpleInitApp() {
        bulletAppState = new BulletAppState();
        bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
        stateManager.attach(bulletAppState);
//        bulletAppState.getPhysicsSpace().enableDebug(assetManager);
        bulletAppState.getPhysicsSpace().setAccuracy(1f/30f);
        rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

        PssmShadowRenderer pssmr = new PssmShadowRenderer(assetManager, 2048, 3);
        pssmr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
        pssmr.setLambda(0.55f);
        pssmr.setShadowIntensity(0.6f);
        pssmr.setCompareMode(CompareMode.Hardware);
        pssmr.setFilterMode(FilterMode.Bilinear);
        viewPort.addProcessor(pssmr);

        setupKeys();
        createTerrain();
        buildPlayer();

        DirectionalLight dl = new DirectionalLight();
        dl.setColor(new ColorRGBA(1.0f, 0.94f, 0.8f, 1f).multLocal(1.3f));
        dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
        rootNode.addLight(dl);

        Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
        DirectionalLight dl2 = new DirectionalLight();
        dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
        dl2.setDirection(lightDir2);
        rootNode.addLight(dl2);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:TestHoveringTank.java

示例3: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
    stateManager.attach(bulletAppState);

    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);
    brick = new Box(Vector3f.ZERO, bLength, bHeight, bWidth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));

    initMaterial();
    initWall();
    initFloor();
    initCrossHairs();
    this.cam.setLocation(new Vector3f(0, 6f, 6f));
    cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
    cam.setFrustumFar(15);
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    inputManager.addMapping("gc", new KeyTrigger(KeyInput.KEY_X));
    inputManager.addListener(actionListener, "gc");

    rootNode.setShadowMode(ShadowMode.Off);
    bsr = new BasicShadowRenderer(assetManager, 256);
    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    viewPort.addProcessor(bsr);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:TestBrickWall.java

示例4: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
    public void simpleInitApp() {
        bulletAppState = new BulletAppState();
        bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
        stateManager.attach(bulletAppState);
        bullet = new Sphere(32, 32, 0.4f, true, false);
        bullet.setTextureMode(TextureMode.Projected);
        bulletCollisionShape = new SphereCollisionShape(0.4f);

        brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth);
        brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
//        bulletAppState.getPhysicsSpace().enableDebug(assetManager);
        initMaterial();
        initTower();
        initFloor();
        initCrossHairs();
        this.cam.setLocation(new Vector3f(0, 25f, 8f));
        cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
        cam.setFrustumFar(80);
        inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
        inputManager.addListener(actionListener, "shoot");
        rootNode.setShadowMode(ShadowMode.Off);
        bsr = new PssmShadowRenderer(assetManager, 2048, 3);
        bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
        bsr.setLambda(0.55f);
        bsr.setShadowIntensity(0.6f);
        bsr.setCompareMode(CompareMode.Hardware);
        bsr.setFilterMode(FilterMode.Bilinear);
        viewPort.addProcessor(bsr);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:TestBrickTower.java

示例5: initApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
public static void initApp(SimpleApplication simpleapp) {
	loadTestData(simpleapp.getAssetManager());
	
	simpleapp.getFlyByCamera().setMoveSpeed(200f);
	simpleapp.setPauseOnLostFocus(false);		
	BulletAppState bullet=new BulletAppState();
	bullet.setThreadingType(ThreadingType.PARALLEL);

	simpleapp.getStateManager().attach(bullet);
}
 
开发者ID:riccardobl,项目名称:jme3-bullet-vhacd,代码行数:11,代码来源:Commons.java

示例6: initEntity

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void initEntity() {
    bulletAppState = new BulletAppState();
    
    BroadphaseType bt = getBroadphaseType(broadphaseType);
    if (bt != null) {
        bulletAppState.setBroadphaseType(bt);
    }
    // ThreadingType.PARALLEL可能只有在多个PhysicsSpace时才有意义
    // 注:setThreadingType必须放在attach(bulletAppState)之前
    ThreadingType tt = getThreadingType(threadingType);
    if (tt != null) {
        bulletAppState.setThreadingType(tt);
    }
    
    LuoYing.getApp().getStateManager().attach(bulletAppState);
    
    bulletAppState.setSpeed(speed);
    if (worldMax != null) {
        bulletAppState.setWorldMax(worldMax);
    }
    if (worldMin != null) {
        bulletAppState.setWorldMin(worldMin);
    }
    bulletAppState.setDebugEnabled(debug);
    // 注:这些设置要放在attach到stateManager之后
    bulletAppState.getPhysicsSpace().setGravity(gravity);
    bulletAppState.getPhysicsSpace().setAccuracy(accuracy);
    bulletAppState.getPhysicsSpace().setMaxSubSteps(maxSubSteps);
    bulletAppState.getPhysicsSpace().setSolverNumIterations(solverNumIterations);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:32,代码来源:PhysicsEntity.java

示例7: buildBullet

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
public static BulletAppState buildBullet(SimpleApplication app,boolean debug){
	BulletAppState bullet=new BulletAppState();
	bullet.setThreadingType(ThreadingType.SEQUENTIAL);
	bullet.setDebugEnabled(debug);
	 app.getStateManager().attach(bullet);
	return bullet;
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:8,代码来源:TestHelpers.java

示例8: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
 //   bulletAppState.setEnabled(false);
    stateManager.attach(bulletAppState);
    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);

    brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
    //bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    initMaterial();
    initTower();
    initFloor();
    initCrossHairs();
    this.cam.setLocation(new Vector3f(0, 25f, 8f));
    cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
    cam.setFrustumFar(80);
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    rootNode.setShadowMode(ShadowMode.Off);
    bsr = new PssmShadowRenderer(assetManager, 1024, 2);
    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    bsr.setLambda(0.55f);
    bsr.setShadowIntensity(0.6f);
    bsr.setCompareMode(CompareMode.Hardware);
    bsr.setFilterMode(FilterMode.PCF4);
    viewPort.addProcessor(bsr);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:32,代码来源:TestBrickTower.java

示例9: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    timer = new NanoTimer();
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
 //   bulletAppState.setEnabled(false);
    stateManager.attach(bulletAppState);
    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);

    brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
    //bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    initMaterial();
    initTower();
    initFloor();
    initCrossHairs();
    this.cam.setLocation(new Vector3f(0, 25f, 8f));
    cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
    cam.setFrustumFar(80);
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    rootNode.setShadowMode(ShadowMode.Off);
    
    batchNode.batch();
    batchNode.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(batchNode);
    
    
    bsr = new PssmShadowRenderer(assetManager, 1024, 2);
    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    bsr.setLambda(0.55f);
    bsr.setShadowIntensity(0.6f);
    bsr.setCompareMode(CompareMode.Hardware);
    bsr.setFilterMode(FilterMode.PCF4);
    viewPort.addProcessor(bsr);   
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:39,代码来源:TestBatchNodeTower.java

示例10: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    MessageUtils.registerDataClasses();
    MessageUtils.registerMessages();

    Serializer.registerClass(ReplayHeader.class);
    Serializer.registerClass(ReplayCmdData.class);
    Serializer.registerClass(ReplayData.class);

    Globals.assets = getAssetManager();
    Globals.app = this;
    world = new World();
    game = new ServerGame();
    physics = new BulletAppState();
    physics.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
    flyCam.setEnabled(false);

    int port = Settings.get().General().getPort();
    if (port <= 0 || port > 65535) {
        System.out.println("Port must be between 0 and 65535");
        System.exit(1);
    }

    try {
        server = new UdpServer("Arkhados", 42, new MyUdpKernel(port));
        server.start();
    } catch (IOException ex) {
        System.exit(1);
    }

    receiver = new DefaultReceiver();
    server.addMessageListener(receiver, OneTrueMessage.class);

    sender = new RecordingServerSender(server);
    AbstractBuff.setSender(sender);

    receiver.registerCommandHandler(sender);

    listenerManager = new ServerNetListener(this, server);
    sync = new Sync(this);

    ServerInput input = ServerInput.get();

    receiver.registerCommandHandler(listenerManager);
    receiver.registerCommandHandler(input);
    receiver.registerCommandHandler(sync);

    stateManager.attach(sender);
    stateManager.attach(receiver);
    stateManager.attach(sync);
    stateManager.attach(world);
    stateManager.attach(game);
    stateManager.attach(physics);

    sender.setWorld(world);
    // Accuracy should be > 45 or projectiles might "disappear" before
    // exploding. This is because of FogOfWar
    physics.getPhysicsSpace().setAccuracy(1f
            / Settings.get().General().getPhysicsTicksPerSecond());                
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:61,代码来源:ServerMain.java

示例11: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    File replayDir = new File("replays");
    if (!replayDir.exists()) {
        replayDir.mkdir();
    }

    threadPoolExecutor = new ScheduledThreadPoolExecutor(4);

    Globals.assets = getAssetManager();
    Globals.app = this;
    setDisplayStatView(false);
    ClientSettings.initialize(this);
    ClientSettings.setAppSettings(settings);
    inputSettings = new InputSettings(inputManager);
    BulletAppState bulletState = new BulletAppState();
    bulletState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);

    inputManager.setCursorVisible(true);

    hud = new ClientHud(cam, guiNode, guiFont);

    ClientFog fog = new ClientFog();
    stateManager.attach(fog);

    stateManager.attach(hud);
    stateManager.attach(bulletState);
    bulletState.getPhysicsSpace().setAccuracy(1f / 30f);
    startNifty();

    MusicManager musicManager  = new MusicManager(this, getInputManager());
    musicManager.setMusicCategory("Menu");
    musicManager.setPlaying(true);
    stateManager.attach(musicManager);

    MessageUtils.registerDataClasses();
    MessageUtils.registerMessages();

    Serializer.registerClass(ReplayHeader.class);
    Serializer.registerClass(ReplayCmdData.class);
    Serializer.registerClass(ReplayData.class);                
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:43,代码来源:ClientMain.java

示例12: Scene

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
public Scene(AppStateManager stateManager, SimpleApplication app) {
        this.app = (Game) app;
        this.assetManager = this.app.getAssetManager();
        this.inputManager = this.app.getInputManager();
        this.cam = this.app.getCamera();

        //build the physic world
        bullet = new BulletAppState();
        bullet.setThreadingType(BulletAppState.ThreadingType.PARALLEL);

        stateManager.attach(bullet);

//        bullet.getPhysicsSpace().enableDebug(assetManager);

        init();

        setUpLight();

        setUpRock();

        setUpMainChar();

        setUpCammera();

        setUpSound();
    }
 
开发者ID:damhonglinh,项目名称:Fruity-Bang,代码行数:27,代码来源:Scene.java

示例13: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
	assetManager.registerLocator("assets/",FileLocator.class);
	executor = new ScheduledThreadPoolExecutor(3);
	gameplayManager = new GameplayManager(this);
	bulletAppState = new BulletAppState();
	bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
	gameplayManager.setupKeys();
	stateManager.attach(bulletAppState);
	bulletAppState.getPhysicsSpace().enableDebug(assetManager);
	// ne pas lancer avant le moteur physique
	worldFactory = new WorldFactory(this);
	
	stateManager.attach(worldFactory);
	flyCam.setEnabled(true);
	flyCam.setMoveSpeed(500);
	
	buildWorld();
	Vector3f vect = new Vector3f();
	vect.x = -3200;//-50;//-3000;
	vect.y = 10;
	vect.z = 100;
	cam.setLocation(vect);
	cam.setFrustumFar(100000);
	MainPlayer hero = new MainPlayer(this, "Hero",  new Vector3f(vect));
	hero.createMesh();
	buildPlayer();
	
	//Ambient Light
	AmbientLight al = new AmbientLight();
	al.setColor(ColorRGBA.White.mult(0.7f));
	rootNode.addLight(al);
	
	DirectionalLight s = new DirectionalLight();
	sunNode = new Node("sunNode");
	sun = new Node("sun");
	rootNode.attachChild(sunNode);
	sunNode.attachChild(sun);
	//sunNode.setLocalTranslation(0f, 1.0f, 1.0f);
	sun.setLocalTranslation(1.0f, 0f, 0f);
	rootNode.addLight(s);
	DirectionalLightControl lc = new DirectionalLightControl(s);
	sun.addControl(lc);
	sunControl = new SunControl(0.01f);
	sunNode.addControl(sunControl);
	
	planetRenderState = new PlanetRenderState(3000f, s);
	stateManager.attach(planetRenderState);
}
 
开发者ID:Daepso,项目名称:minerim,代码行数:50,代码来源:GameLoop.java

示例14: simpleInitApp

import com.jme3.bullet.BulletAppState; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
   // bulletAppState.setEnabled(false);
    stateManager.attach(bulletAppState);
    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);

    brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
  //  bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    initMaterial();
    initTower();
    initFloor();
    initCrossHairs();

    List<BatchedGeometry> bgs = batch.batch(geoms);
    for (BatchedGeometry bg : bgs) {
        RigidBodyControl rb = new RigidBodyControl(1.5f);
        rb.setCollisionShape(new BoxCollisionShape(new Vector3f(brick.getXExtent(), brick.getYExtent(), brick.getZExtent())));
        rb.setFriction(1.6f);
        bg.addControl(rb);
        this.getPhysicsSpace().add(bg);
    }

    batch.setMaterial(mat);
    batch.setShadowMode(ShadowMode.CastAndReceive);

    this.cam.setLocation(new Vector3f(0, 25f, 8f));
    cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
    cam.setFrustumFar(80);
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    rootNode.setShadowMode(ShadowMode.Off);
    bsr = new PssmShadowRenderer(assetManager, 1024, 2);
    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    bsr.setLambda(0.50f);
    bsr.setShadowIntensity(0.6f);
    bsr.setCompareMode(CompareMode.Hardware);
    bsr.setFilterMode(FilterMode.PCF4);
    viewPort.addProcessor(bsr);
    flyCam.setMoveSpeed(50);
    rootNode.attachChild(batch);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:47,代码来源:TestBatchedTower.java


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