Java 类com.badlogic.gdx.graphics.g3d.utils.CameraInputController 实例源码

项目:enklave    文件:ScreenBricks.java   
@Override
public void show() {
    stage = new Stage(new StretchViewport(Width,Height));
    stage.addActor(tabContinue);
    PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera2.position.set(0, -Width * 0.075f, Width * 0.135f);
    camera2.lookAt(0, 0, 0);
    camera2.far = Width*0.3f;
    camera2.near = 1;
    camera2.update();
    controller = new CameraInputController(camera2);
    CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2);
    batch = new DecalBatch(cameraGroupStrategy);
    modelBatch = new ModelBatch();
    InputMultiplexer in = new InputMultiplexer();
    in.addProcessor(stage);
    in.addProcessor(controller);
    Gdx.input.setInputProcessor(in);
}
项目:enklave    文件:ScreenExtensions.java   
public ScreenExtensions(GameManager gameManager) {
    this.gameManager = gameManager;
    manager = ManagerAssets.getInstance();
    addExtensions = this;
    camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(0, 0, Gdx.graphics.getHeight() * 0.183f);//initial 180
    camera.lookAt(0, 0, 0);
    camera.far = 2500;
    camera.near = 1;
    camera.update();
    controller = new CameraInputController(camera);
    cam = new OrthographicCamera();
    batchsprite = new SpriteBatch();

    renderer = new ImmediateModeRenderer20(false, true, 1);
    gd = new GestureDetector(this);
}
项目:eamaster    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:libgdxcn    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:libgdxcn    文件:ShaderTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch(new BaseShaderProvider() {
        @Override
        protected Shader createShader (Renderable renderable) {
            return new TestShader();
        }
    });

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    camController = new CameraInputController(cam);
    Gdx.input.setInputProcessor(camController);

    Material material = new Material(new TestAttribute(1f));
    ModelBuilder builder = new ModelBuilder();
    model = builder.createCone(5, 5, 5, 20, material, Usage.Position);
    instance = new ModelInstance(model);
    testAttribute = (TestAttribute)instance.materials.get(0).get(TestAttribute.ID);
}
项目:libgdxcn    文件:FogTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    environment.set(new ColorAttribute(ColorAttribute.Fog, 0.13f, 0.13f, 0.13f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(30f, 10f, 30f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 45f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
        | Usage.Normal);
    instance = new ModelInstance(model);

    Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
项目:libgdxcn    文件:BaseG3dTest.java   
@Override
public void create () {
    if (assets == null) assets = new AssetManager();

    modelBatch = new ModelBatch();

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 1000f;
    cam.update();

    createAxes();

    Gdx.input.setInputProcessor(inputController = new CameraInputController(cam));
}
项目:libgdxcn    文件:Basic3DTest.java   
@Override
    public void create () {
        modelBatch = new ModelBatch(new DefaultShaderProvider());
// modelBatch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 0.1f;
        cam.far = 300f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
            | Usage.Normal);
        instance = new ModelInstance(model);

// model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db"));
// instance = new ModelInstance(model);

        Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
    }
项目:amatsukaze    文件:Basic3D.java   
@Override
public void create() {
    modelBatch = new ModelBatch();

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 1f;
    cam.far = 300f;
    cam.update();

    camController = new CameraInputController(cam);
    Gdx.input.setInputProcessor(camController);

    ModelBuilder modelBuilder = new ModelBuilder();
       model = modelBuilder.createBox(5f, 5f, 5f, 
           new Material(ColorAttribute.createDiffuse(Color.GREEN)),
           Usage.Position | Usage.Normal);
       instance = new ModelInstance(model);
}
项目:amatsukaze    文件:ShaderTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch(new BaseShaderProvider() {
        @Override
        protected Shader createShader (Renderable renderable) {
            return new TestShader();
        }
    });

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    camController = new CameraInputController(cam);
    Gdx.input.setInputProcessor(camController);

    Material material = new Material(new TestAttribute(1f));
    ModelBuilder builder = new ModelBuilder();
    model = builder.createCone(5, 5, 5, 20, material, Usage.Position);
    instance = new ModelInstance(model);
    testAttribute = (TestAttribute)instance.materials.get(0).get(TestAttribute.ID);
}
项目:amatsukaze    文件:FogTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
    environment.set(new ColorAttribute(ColorAttribute.Fog, 0.13f, 0.13f, 0.13f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(30f, 10f, 30f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 45f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
        | Usage.Normal);
    instance = new ModelInstance(model);

    Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
项目:amatsukaze    文件:BaseG3dTest.java   
@Override
public void create () {
    if (assets == null) assets = new AssetManager();

    modelBatch = new ModelBatch();

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 1000f;
    cam.update();

    createAxes();

    Gdx.input.setInputProcessor(inputController = new CameraInputController(cam));
}
项目:amatsukaze    文件:Basic3DTest.java   
@Override
    public void create () {
        modelBatch = new ModelBatch(new DefaultShaderProvider());
// modelBatch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 0.1f;
        cam.far = 300f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
            | Usage.Normal);
        instance = new ModelInstance(model);

// model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db"));
// instance = new ModelInstance(model);

        Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
    }
项目:enklave    文件:Enklave3D.java   
public void translateCamera(CameraInputController controller){
    controller.camera.position.x += (float) coordonate.x;
    controller.camera.position.y += (float) coordonate.y;
    controller.camera.position.z += (float) coordonate.z;
    controller.camera.lookAt(position.x, position.y, 0);
    controller.camera.update();
}
项目:enklave    文件:RaiderMap.java   
public void translateCamera(CameraInputController controller){
    controller.camera.position.x += (float) coordonate.x;
    controller.camera.position.y += (float) coordonate.y;
    controller.camera.position.z += (float) coordonate.z;
    controller.camera.lookAt(position.x, position.y, 0);
    controller.camera.update();
}
项目:libgdxcn    文件:TextureRegion3DTest.java   
@Override
public void create () {
    Gdx.gl.glClearColor(0.2f, 0.3f, 1.0f, 0.f);

    atlas = new TextureAtlas(Gdx.files.internal("data/testpack"));
    regions = atlas.getRegions();

    modelBatch = new ModelBatch(new DefaultShaderProvider());

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    final Material material = new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f), new TextureAttribute(TextureAttribute.Diffuse));
    model = modelBuilder.createBox(5f, 5f, 5f, material, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
    instance = new ModelInstance(model);
    attribute = instance.materials.get(0).get(TextureAttribute.class, TextureAttribute.Diffuse);

    Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
项目:libgdxcn    文件:ShadowMappingTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f, 0.8f, -1f, -.8f,
        -.2f));
    environment.shadowMap = shadowLight;

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(0f, 7f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 1f;
    cam.far = 50f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder mpb = modelBuilder.part("parts", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.Color,
        new Material(ColorAttribute.createDiffuse(Color.WHITE)));
    mpb.setColor(1f, 1f, 1f, 1f);
    mpb.box(0, -1.5f, 0, 10, 1, 10);
    mpb.setColor(1f, 0f, 1f, 1f);
    mpb.sphere(2f, 2f, 2f, 10, 10);
    model = modelBuilder.end();
    instance = new ModelInstance(model);

    shadowBatch = new ModelBatch(new DepthShaderProvider());

    Gdx.input.setInputProcessor(camController = new CameraInputController(cam));
}
项目:amatsukaze    文件:MikuMikuGame.java   
@Override
public void create() {
    modelBatch = new ModelBatch();

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(10f, 10f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 1f;
    cam.far = 300f;
    cam.update();

    camController = new CameraInputController(cam);
    Gdx.input.setInputProcessor(camController);

    simpleModel = createSampleModel();
    instance = new ModelInstance(simpleModel);


    shader = new ShaderProgram(vertexShader, fragmentShader);
    texture = new Texture("eye2.bmp");


    //load mmmd data
    model = loadModel("test.pmd", "test.vmd");      
    mesh = createMikuMesh(model);
}
项目:amatsukaze    文件:ShadowMappingTest.java   
@Override
public void create () {
    modelBatch = new ModelBatch();
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f, 0.8f, -1f, -.8f,
        -.2f));
    environment.shadowMap = shadowLight;

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.position.set(0f, 7f, 10f);
    cam.lookAt(0, 0, 0);
    cam.near = 1f;
    cam.far = 50f;
    cam.update();

    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder mpb = modelBuilder.part("parts", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.Color,
        new Material(ColorAttribute.createDiffuse(Color.WHITE)));
    mpb.setColor(1f, 1f, 1f, 1f);
    mpb.box(0, -1.5f, 0, 10, 1, 10);
    mpb.setColor(1f, 0f, 1f, 1f);
    mpb.sphere(2f, 2f, 2f, 10, 10);
    model = modelBuilder.end();
    instance = new ModelInstance(model);

    shadowBatch = new ModelBatch(new DepthShaderProvider());

    Gdx.input.setInputProcessor(camController = new CameraInputController(cam));
}
项目:enklave    文件:ScreenEnklave.java   
@Override
public void show() {
    enklave3D = new Enklave3D(new Vector2(),InformationEnklave.getInstance().getFaction());
    enklave3D.FrontEnklave(InformationEnklave.getInstance().getFaction());
    this.enklave3D.setCoordraw(coordonatedraw);
    camera = new PerspectiveCamera(35, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(0, -222, 350);//initial 180
    camera.lookAt(0, 50, 0);
    camera.far = 2500;
    camera.near = 1;
    camera.update();
    this.cameraGroupStrategy = new CameraGroupStrategy(camera);
    CameraInputController controller = new CameraInputController(camera);
    batch = new DecalBatch(this.cameraGroupStrategy);
    stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())){
        @Override
        public boolean keyDown(int keyCode) {
            if(keyCode == Input.Keys.BACK){
                if (buttonCombat.getText().toString().contentEquals("ROOMS ")) {
                    buttonCombat.setText("COMBAT ");
                    buttonDeveloper.setText("    DEVELOPER");
                    deployBricks.setVisible(false);
                    informationEnklave.setVisible(true);
                    disaibleButton.setVisible(true);
                    if(disaibleButton1 !=null)
                        disaibleButton1.setVisible(true);
                } else {
                    manager.getAssertEnklaveScreen().setIsupdate(false);
                    gameManager.setScreen(gameManager.mapsScreen);
                }
            }
            return super.keyDown(keyCode);
        }
    };
    if(drawone){
        adddrawenklave();
        addToolInformation();
        addDeployBrick();
        addButtonsBottom();
        addMap();
        if (InformationProfile.getInstance().getDateUserGame().isInCombat()) {
            manager.loadAssetsCombat();
            new SubscribeCombat().makeRequest(InformationEnklave.getInstance().getId());
            gameManager.setScreen(new ScreenCircleLoading(gameManager, gameManager.screenCombat, manager.getAssetsCombat()));
        }
        drawone =false;
    }
    updatelabel();
    rangeEnklave = new RangeEnklave((float)location.getLatitude(),(float)location.getLongitude(),infoEnklave.getLatitude(),infoEnklave.getLongitude(),this,range);
    if (infoEnklave.getId() !=16066)rangeEnklave.start();
    else setvisibility(false);
    manager.getAssertEnklaveScreen().setIsupdate(false);
    labelName.setText(InformationEnklave.getInstance().getName());
    backButton.setChecked(false);
    progressBarEnergy.addGrouptoStage(stage);
    stage.addActor(backButton);
    addinfo(stage);
    int level = infoEnklave.getBricks()/9;
    if(QueueBuildCraft.getInstance().deployOn) {
        labelLevel.setText("LVL " + level + " (Bricks:" + (infoEnklave.getBricks()-1) + ")");
    }else{
        labelLevel.setText("LVL " + level + " (Bricks:" + infoEnklave.getBricks() + ")");
    }
    mmodelBatch = new ModelBatch();
    progressBarEnergy.FadeIn();
    controller.camera.lookAt(enklave3D.getDecalbrick(0).getCenterX(), enklave3D.getDecalbrick(0).getCenterY(), enklave3D.getDecalbrick(0).getCenterZ());
    Gdx.input.setCatchBackKey(true);
    InputMultiplexer inputmulti = new InputMultiplexer();
    inputmulti.addProcessor(stage);
    Gdx.input.setInputProcessor(inputmulti);
}
项目:enklave    文件:MapsScreen.java   
@Override
    public void show() {
        stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())){
            @Override
            public boolean keyDown(int keyCode) {
                if(keyCode == Input.Keys.BACK){
                    if(screenChat.isVisibleChat()){
                        screenChat.fadeout();
                    }else {
                        dia.show(stage);
                    }
                }
                return super.keyDown(keyCode);
            }
        };
        if(isdrawmap) {
            DrawMap();
            Gdx.app.log("combat"," "+!informationProfile.getDateUserGame().isInCombat());
            if(!informationProfile.getDateUserGame().isInCombat())
                progressBarEnergy.update();
            isdrawmap = false;
            screenChat.setGameManager(gameManager);
            if(informationProfile.getDateUserGame().isInCombat()){
                managerAssets.loadAssetsEnklaveScreen();
                new GetEnklaveDetails().makeRequest(InformationEnklave.getInstance().getId(), managerAssets);
                gameManager.screenEnklave.setEnklave3D(enklavesArray.getEnkl(InformationEnklave.getInstance().getId()));
                gameManager.setScreen(new ScreenCircleLoading(gameManager,gameManager.screenEnklave,managerAssets.getAssertEnklaveScreen()));
            }
        }
        buttonProfile();
        addToStage();
        controller = new CameraInputController(camera);
        modelBatch = new ModelBatch();
        camera.position.set(0, -100, 210);//initial 180
        camera.lookAt(0, 0, 0);
        camera.update();

        translateCamera = false;
        numberOfFingers = 0;
        Gdx.input.setCatchBackKey(true);
//        if(InformationEnklave.getInstance().getFaction() == 0){
//            enklavesArray = new DrawEnklaves();
//        }
    }
项目:LibGDX-PBR    文件:PBRTestAPP.java   
@Override
public void create () {
    pbrShader=new PBRShader();
    pbrShader.init();

    pbrSadherTexture=new PBRSadherTexture();
    pbrSadherTexture.init();

    materials.put("Generic", null);
    materials.put("Rough Rock", createMaterial("roughrockface4"));
    materials.put("Bricks", createMaterial("mybricks3"));
    materials.put("Rusted Iron", createMaterial("rustediron-streaks"));
    materials.put("Carved Stone", createMaterial("carvedlimestoneground1"));
    materials.put("Grass", createMaterial("grass1"));
    materials.put("Floor", createMaterial("cavefloor1"));

    matNames = new ArrayList<String>(materials.keySet());

    actMaterial=matNames.indexOf("Generic");

    modelBatch = new ModelBatch();
    spriteBatch=new SpriteBatch();

    float w=Gdx.graphics.getWidth();
    float h=Gdx.graphics.getHeight();
    float scale=w/1600;

    cam=new PerspectiveCamera(30,w, h);
    cam.position.set(12,14,0);
    cam.lookAt(0,2,0);
    cam.up.set(0,1,0);
    cam.update();
    camController = new CameraInputController(cam);

    font = new BitmapFont(Gdx.files.internal("font/my_font.fnt"),
            Gdx.files.internal("font/my_font.png"), false);

    skin = new Skin(Gdx.files.internal("skin/uiskin.json"));

    CreateStage(w, h, scale);

    G3dModelLoader loader = new G3dModelLoader(new UBJsonReader());
    obj=createRenderableFromMesh(loader.loadModel(Gdx.files.internal("Mesh/teapot.g3db")).meshParts.get(0).mesh,
            new Material(ColorAttribute.createDiffuse(Color.BLUE)), pbrShader, null);
    obj.worldTransform.scl(5);
}
项目:3DScanner.RaspberryPi    文件:PolygonViewer.java   
/**
     * Intiialisierung der Anwendung: Einrichten der libgdx Umgebung, starten
     * des Servers
     */
    @Override
    public void create() {
        // Erstellung einer Umgebung, um die Tiefe des Objektes sichtbar zu
        // machen.
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
        environment.add(new DirectionalLight().set(0.35f, 0.35f, 0.35f, 0.5f, -0.8f, 0.8f));
        // Erstellung der ModellBatch, zur welche sp�ter das zu rendernde Objekt
        // hinzugef�gt wird.
        modelBatch = new ModelBatch();
        // Kamera wird erstellt und ihre Eigenschaften werden festgelegt.
        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.near = 1f;
        cam.far = 300f;
        cam.update();
//      stage = new Stage();
//      BitmapFont font = new BitmapFont();
//      Skin skin = new Skin();
//      TextureAtlas buttonAtlas = new TextureAtlas(Gdx.files.internal("images/Button.pack"));
//      skin.addRegions(buttonAtlas);
//      TextButtonStyle textButtonStyle = new TextButtonStyle();
//      textButtonStyle.font = font;
//      textButtonStyle.up = skin.getDrawable("black");
//      textButtonStyle.down = skin.getDrawable("black");
//      textButtonStyle.checked = skin.getDrawable("black");
//      TextButton button = new TextButton("Refresh", textButtonStyle);
//      stage.addActor(button);
//      button.setBounds(0, 0, 50, 50);
//      button.addListener(new ChangeListener(){
//
//          @Override
//          public void changed(ChangeEvent event, Actor actor) {
//              model.dispose();
//              renderNewModell();
//              
//          }
//          
//      });
        // Farbe des Objektes wird festgelegt
        material = new Material(ColorAttribute.createDiffuse(Color.GREEN));
        // Der Modellbuilder hilft bei der Erstellung des Objektes
        modelBuilder = new ModelBuilder();
        // Kamera f�r den Nutzer steuerbar machen
        camController = new CameraInputController(cam);
        Gdx.input.setInputProcessor(camController);
        // setupModel(VerticesGenerationTest.testVerts2());
        setupServer();
    }
项目:eamaster    文件:WheelRenderer.java   
@Override
    public void create() {

        logger.info("Setting up camera");

        camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//        camera.position.set(40f, 30f, 40f);
        camera.position.set(45f, 29f, 73f);
//        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//        camera.position.set(4f, 3f, 4f);
        camera.lookAt(0, 2f, 0);
        camera.near = 1f;
        camera.far = 500f;
        camera.update();

        cameraInputController = new CameraInputController(camera);
        Gdx.input.setInputProcessor(cameraInputController);
//        Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));


        logger.info("Loading models");
        models = new HashMap<>();
        ModelBuilder builder = new ModelBuilder();
        models.put("box", builder.createBox(5f, 5f, 5f,
                new Material(ColorAttribute.createDiffuse(new Color(0.8f, 0f, 0f, 0f))),
                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal));

        G3dModelLoader loader = new G3dModelLoader(new JsonReader());
        models.put("hub", loader.loadModel(Gdx.files.internal("data/hubreal.g3dj")));
        models.put("rim", loader.loadModel(Gdx.files.internal("data/rimreal.g3dj")));
        models.put("spoke", loader.loadModel(Gdx.files.internal("data/spoke.g3dj")));


        logger.info("Let there be light");
        batch = new ModelBatch();

        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.6f, 0.6f, 0.6f, 1f));

        environment.add(new DirectionalLight().set(0.3f, 0.3f, 0.3f, -5f, -3f, -1f));
        environment.add(new DirectionalLight().set(0.2f, 0.2f, 0.2f, 5f, 8f, 0f));
        environment.add(new DirectionalLight().set(0.7f, 0.7f, 0.7f, -3f, -2f, -5f));


        logger.info("Initializing Bullet");
        Bullet.init();

        logger.info("Creating simulation");
        // create world & stuff?
        spokeAngles = new SpokeAngles();
//        spokeAngles.create2l2t();
//        spokeAngles.createCrowFoot();
//        spokeAngles.createNx(3);
//        spokeAngles.createPer3mutation(new int[]{3, 14, 5, 0, 7, 2, 9, 4, 11, 6, 13, 8, 15, 10, 1, 12}); // 3x as well!

//        spokeAngles.createPermutation(new int[]{14, 2, 3, 15, 7, 5, 6, 10, 4, 9, 8, 11, 12, 0, 1, 13});
//        spokeAngles.createPermutation(new int[]{2, 0, 1, 5, 3, 8, 10, 4, 12, 6, 11, 7, 9, 15, 13, 14});
//        spokeAngles.createPermutation(new int[]{0, 15, 3, 2, 4, 9, 6, 7, 8, 5, 10, 11, 12, 13, 14, 1});
        spokeAngles.createRandom();
//        spokeAngles.createBack();
//        spokeAngles.createSingel();
        simulation = new Simulation("sim1", models, spokeAngles, true);

        rayResultCallback = new ClosestRayResultCallback(new Vector3(), new Vector3());
        rayResultCallback.setCollisionFilterGroup(SimulationConstants.RAY_GROUP);

        logger.info("Setup complete");
    }
项目:NASAChallengeDebris    文件:MyGDXSattelite.java   
@Override
    public void create() {
        debrisInstance = new ArrayList<ModelInstance>();
        casketInstance = new ArrayList<ModelInstance>();
        debris = Main.getDebris();
        casket = debris.subList(0, 100);

        light = new DirectionalLight().set(222f, 222f, 222f, 300f, 300f, 300f);
        enviroment = new Environment();
        enviroment.set(new ColorAttribute(ColorAttribute.AmbientLight, 2.4f, 3.4f, 2.4f, 3f));
        enviroment.add(light);

        modelBatch = new ModelBatch();

        cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//        cam.rotate(90, 0, 0, 1);
        cam.position.set(50f, 50f,50f);
        cam.lookAt(0, 0, 0);
        cam.near = 1f;
        cam.far = 4000f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        ObjLoader loader = new ObjLoader();
        model = loader.loadModel(Gdx.files.internal("textures/Earth.obj"));
        //
//        model = modelBuilder.createSphere(128f, 128f, 128f, 20, 20,
//                new Material(ColorAttribute.AmbientAlias),
//                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates);
        instance = new ModelInstance(model);
        instance.transform.scale(128, 128, 128);
        instance.transform.rotate(1, 0, 0, 180);
        instance.transform.rotate(0, 0, 1, 90);

        space = loader.loadModel(Gdx.files.internal("textures/space/spacesphere.obj"));
        spaceInstance = new ModelInstance(space);
        spaceInstance.transform.scale(10,10,10);

        for (int i = 0; i < 100; i++) {
            debrisModel = loader.loadModel(Gdx.files.internal("textures/Nuka_Cola_Fridge.obj"));
            casketInstance.add(new ModelInstance(debrisModel));
        }

        for (Placemark pm : debris) {
            Random rand = new Random();
            debrisModel = modelBuilder.createSphere(3f, 3f, 3f, 4, 4,
                    new Material(ColorAttribute.createDiffuse(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), rand.nextFloat())),
                    VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates);
            ModelInstance mi = new ModelInstance(debrisModel);
            Coordinate coordinate = pm.getNextCoordinate(100f);
            mi.transform.translate((float) coordinate.x, (float) coordinate.y, (float) coordinate.z);
            debrisInstance.add(mi);
        }
        camController = new CameraInputController(cam);
        Gdx.input.setInputProcessor(camController);
    }