本文整理匯總了Java中com.badlogic.gdx.graphics.PerspectiveCamera.lookAt方法的典型用法代碼示例。如果您正苦於以下問題:Java PerspectiveCamera.lookAt方法的具體用法?Java PerspectiveCamera.lookAt怎麽用?Java PerspectiveCamera.lookAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.PerspectiveCamera
的用法示例。
在下文中一共展示了PerspectiveCamera.lookAt方法的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: Renderer
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public Renderer(VuforiaRenderer arRenderer) {
lights = new Environment();
lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));
camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 1.0F;
camera.far = 1000.0F;
//set camera into "Vuforia - style" direction
camera.position.set(new Vector3(0,0,0));
camera.lookAt(new Vector3(0,0,1));
this.vuforiaRenderer = arRenderer;
modelBatch = new ModelBatch();
}
示例7: 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();
}
示例8: Scene
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public Scene() {
environment = new MundusEnvironment();
currentSelection = null;
terrains = new Array<TerrainAsset>();
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 1, -3);
cam.lookAt(0, 1, -1);
cam.near = 0.2f;
cam.far = 10000;
DirectionalLight dirLight = new DirectionalLight();
dirLight.color.set(1, 1, 1, 1);
dirLight.intensity = 1f;
dirLight.direction.set(0, -1f, 0);
dirLight.direction.nor();
environment.add(dirLight);
environment.getAmbientLight().intensity = 0.3f;
sceneGraph = new SceneGraph(this);
}
示例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 () {
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)));
}
示例11: 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));
}
示例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: setupScene
import com.badlogic.gdx.graphics.PerspectiveCamera; //導入方法依賴的package包/類
public void setupScene () {
plane = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(
Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE));
plane.setVertices(new float[] {-10, -1, 10, 0, 1, 0, 10, -1, 10, 0, 1, 0, 10, -1, -10, 0, 1, 0, -10, -1, -10, 0, 1, 0});
plane.setIndices(new short[] {3, 2, 1, 1, 0, 3});
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 5, 10);
cam.lookAt(0, 0, 0);
cam.update();
controller = new PerspectiveCamController(cam);
projector = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
projector.position.set(2, 3, 2);
projector.lookAt(0, 0, 0);
projector.normalizeUp();
projector.update();
}
示例14: 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);
}
示例15: 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();
}