本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.CameraInputController类的典型用法代码示例。如果您正苦于以下问题:Java CameraInputController类的具体用法?Java CameraInputController怎么用?Java CameraInputController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CameraInputController类属于com.badlogic.gdx.graphics.g3d.utils包,在下文中一共展示了CameraInputController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例2: ScreenExtensions
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
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);
}
示例3: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例4: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例5: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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)));
}
示例6: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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));
}
示例7: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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)));
}
示例8: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例9: translateCamera
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
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();
}
示例10: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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)));
}
示例11: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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));
}
示例12: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例13: show
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}
示例14: show
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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();
// }
}
示例15: create
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController; //导入依赖的package包/类
@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);
}