本文整理匯總了Java中com.badlogic.gdx.graphics.PerspectiveCamera.update方法的典型用法代碼示例。如果您正苦於以下問題:Java PerspectiveCamera.update方法的具體用法?Java PerspectiveCamera.update怎麽用?Java PerspectiveCamera.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.PerspectiveCamera
的用法示例。
在下文中一共展示了PerspectiveCamera.update方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GameScreen
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public GameScreen(){
spriteBatch = new SpriteBatch(); // buffer ok
texture = new Texture(Gdx.files.internal("bg/gameBG.jpg"));
viewMatrix = new Matrix4(); // matriz de visualização
tranMatrix = new Matrix4(); // matriz de escala
// camera
camera = new PerspectiveCamera(67.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 0.1f;
camera.far = 1000f;
camera.position.set(0, 5, 10);
camera.lookAt(0, 5, 0);
camera.update();
// ambiente
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1,1,1,1));
// renderizador
modelBatch = new ModelBatch();
p1 = new Player(1);
p2 = new Player(2);
}
示例2: show
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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);
}
示例3: ScreenExtensions
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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);
}
示例4: ScreenCombat
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public ScreenCombat(GameManager gameManager) {
this.gameManager = gameManager;
managerAssets = ManagerAssets.getInstance();
cam = new OrthographicCamera();
UpdateDisplayCombat.getInstance().setScreenCombat(this);
camera = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(0, 0, 350);//initial 180
camera.lookAt(0, 0, 0);
camera.far = 2500;
camera.near = 1;
camera.update();
centerPlayer = new Integer[7];
for(int i=0;i<7;i++){
centerPlayer[i]=-1;
}
}
示例5: ScreenCrafting
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public ScreenCrafting(GameManager game) {
this.gameManager = game;
informationProfile = InformationProfile.getInstance();
managerAssets = ManagerAssets.getInstance();
queue = QueueBuildCraft.getInstance();
intances = new Array<ModelInstance>();
camera = new PerspectiveCamera(45,WIDTH,HEIGHT);
camera.position.set(0,0,1020);
camera.lookAt(0, 0, 0);
camera.near = 1;
camera.far = 1500;
camera.update();
nameRes.add("SCRAP");
nameRes.add("BRICK");
nameRes.add("CELL");
arrayDecal = new Array<Decal>();
}
示例6: read
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
@Override
public PerspectiveCamera read (Kryo kryo, Input input, Class<PerspectiveCamera> type) {
PerspectiveCamera camera = new PerspectiveCamera();
Vector3 position = kryo.readObject(input, Vector3.class);
Vector3 direction = kryo.readObject(input, Vector3.class);
Vector3 up = kryo.readObject(input, Vector3.class);
camera.position.set(position);
camera.direction.set(direction);
camera.up.set(up);
camera.near = input.readFloat();
camera.far = input.readFloat();
camera.viewportWidth = input.readFloat();
camera.viewportHeight = input.readFloat();
camera.fieldOfView = input.readFloat();
camera.update();
return camera;
}
示例7: VRCamera
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
/** Конструктор */
VRCamera(float fov, float parallax, float near, float far) {
this.parallax = parallax;
leftCam = new PerspectiveCamera(fov, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight());
leftCam.near = near;
leftCam.far = far;
leftCam.update();
rightCam = new PerspectiveCamera(fov, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight());
rightCam.near = near;
rightCam.far = far;
rightCam.update();
position = new Vector3(0, 0, 0);
direction = new Vector3(0, 0, 1);
up = new Vector3(0, 1, 0);
upDirCross = new Vector3().set(direction).crs(up).nor();
}
示例8: setupOGL
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
private void setupOGL() {
camera = new PerspectiveCamera(90, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(10f, 150f, 10f);
camera.lookAt(0, 0, 0);
camera.near = 0.1f;
camera.far = 450f;
camera.update();
hudCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
guiBatch = new SpriteBatch();
guiBatch.setProjectionMatrix(hudCamera.combined);
if(android) {
setupTouchControls();
}
Gdx.input.setInputProcessor(new RadixInputHandler(this));
if(settingsManager.getVisualSettings().getNonContinuous().getValue()) {
Gdx.graphics.setContinuousRendering(false);
}
sceneTheme = new SceneTheme();
sceneTheme.init();
}
示例9: create
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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);
}
示例10: create
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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));
}
示例11: create
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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)));
}
示例12: create
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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)));
}
示例13: create
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的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);
}
示例14: ScreenRaider
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public ScreenRaider(GameManager gameManager) {
this.gameManager = gameManager;
managerAssets = ManagerAssets.getInstance();
camera = new PerspectiveCamera(67,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
camera.position.set(0, 20, 80);
camera.near = 1;
camera.far = 2200;
camera.lookAt(0, -10, 0);
camera.update();
}
示例15: ScreenRooms
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public ScreenRooms(GameManager gameManager) {
this.gameManager = gameManager;
manager = ManagerAssets.getInstance();
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();
cam = new OrthographicCamera();
renderer = new ImmediateModeRenderer20(false, true, 1);
}