當前位置: 首頁>>代碼示例>>Java>>正文


Java PerspectiveCamera類代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.PerspectiveCamera的典型用法代碼示例。如果您正苦於以下問題:Java PerspectiveCamera類的具體用法?Java PerspectiveCamera怎麽用?Java PerspectiveCamera使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PerspectiveCamera類屬於com.badlogic.gdx.graphics包,在下文中一共展示了PerspectiveCamera類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:18,代碼來源:ScreenExtensions.java

示例2: 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);
	
	
	
}
 
開發者ID:fmassetto,項目名稱:StreetCampusFighter,代碼行數:27,代碼來源:GameScreen.java

示例3: VRCamera

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public VRCamera(int width, int height, int viewportWidth, int viewportHeight) {
    leftCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    rightCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    leftBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    rightBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    leftTexture = new TextureRegion();
    rightTexture = new TextureRegion();
    batch = new SpriteBatch();
    this.width = width;
    this.height = height;
    this.viewportWidth = viewportWidth;
    this.viewportHeight = viewportHeight;
    tmpVector3 = new Vector3();
    position = new Vector3(250, 20, 250);
    positionLeft = new Vector3(249.5f, 20, 250);
    positionRight = new Vector3(250.5f, 20, 250);
    direction = new Vector3();
    up = new Vector3(0, 1, 0);
    eyeDistance = 0.5f;
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:21,代碼來源:VRCamera.java

示例4: 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);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:20,代碼來源:ScreenBricks.java

示例5: 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;
    }
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:17,代碼來源:ScreenCombat.java

示例6: 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>();
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:18,代碼來源:ScreenCrafting.java

示例7: touchEnklave

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public boolean touchEnklave(PerspectiveCamera camera,int screenX,int screenY){
        coordonate = null;
        instanceModel.calculateBoundingBox(box).mul(instanceModel.transform);
        box.getCenter(position);
        box.getDimensions(dimensions);
        Ray ray = camera.getPickRay(screenX,screenY);
//        instanceModel.transform.getTranslation(position);
//        position.add(box.getCenter(new Vector3()));
//        Gdx.app.log("res"+ray.toString(),"position"+position);
        if(Intersector.intersectRayBoundsFast(ray,box)){ // position, box.getDimensions(new Vector3()).len(), null)) {
            coordonate = new SpaceCoordonate();
            coordonate.x = Math.abs(Math.abs(position.x) - Math.abs(camera.position.x)) / (Gdx.graphics.getHeight() * 0.026f);
            coordonate.y = Math.abs(Math.abs(position.y) - Math.abs(camera.position.y)) / (Gdx.graphics.getHeight() * 0.026f);
            coordonate.z = -(Math.abs((Gdx.graphics.getHeight() * 0.033f) - Math.abs(camera.position.z)) / (Gdx.graphics.getHeight() * 0.026f));
            if (box.getCenterX() < camera.position.x) {
                coordonate.x = -coordonate.x;
            }
            if (box.getCenterY() < camera.position.y) {
                coordonate.y = -coordonate.y;
            }
            return true;
        }
        return false;
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:25,代碼來源:Enklave3D.java

示例8: 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;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:18,代碼來源:PerspectiveCameraSerializer.java

示例9: 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();
    }
 
開發者ID:daemontus,項目名稱:VuforiaLibGDX,代碼行數:17,代碼來源:Renderer.java

示例10: 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();
}
 
開發者ID:SinuXVR,項目名稱:GdxVR-Sample-1,代碼行數:17,代碼來源:VRCamera.java

示例11: BoxThree

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public BoxThree(PerspectiveCamera cam, boolean[][][] collision) {
    super(cam,collision);

    for(float x = 2f; x < 5f; ++x){
        for(float z = 2f; z < 5f; ++z){
            for(float y = 10f; y < 13f; ++y){
                ModelInstance p = new ModelInstance(white,x,y,z);
                ModelInstance s = new ModelInstance(gray,x,y,z);
                ModelInstance f = new ModelInstance(wire,x,y,z);

                parts.add(p);
                shadow.add(s);
                frame.add(f);
            }
        }
    }


    traceShadow();
}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:21,代碼來源:BoxThree.java

示例12: GameModel

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public GameModel(PerspectiveCamera cam, boolean [][][] collision){
    //setup the model instances
    parts = new Array<ModelInstance>();
    frame = new Array<ModelInstance>();
    shadow = new Array<ModelInstance>();

    //setup environment
    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));

    //setup collision matrix
    matrix = collision;

    //setup camera
    camera = cam;



}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:21,代碼來源:GameModel.java

示例13: Column

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public Column(PerspectiveCamera cam, boolean[][][] collision) {
    super(cam, collision);
    x = X.FRONT;
    y = Y.UP;

    for(float y = 10f; y < 12f; ++y){
        ModelInstance p = new ModelInstance(white,2f,y,2f);
        ModelInstance s = new ModelInstance(gray,2f,y,2f);
        ModelInstance f = new ModelInstance(wire,2f,y,2f);

        parts.add(p);
        shadow.add(s);
        frame.add(f);
    }

    traceShadow();
}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:18,代碼來源:Column.java

示例14: BoxTwo

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public BoxTwo(PerspectiveCamera cam, boolean[][][] collision) {
    super(cam, collision);

    for(float x = 2f; x < 4f; ++x){
        for(float z = 2f; z < 4f; ++z){
            for(float y = 10f; y < 12f; ++y){
                ModelInstance p = new ModelInstance(white,x,y,z);
                ModelInstance s = new ModelInstance(gray,x,y,z);
                ModelInstance f = new ModelInstance(wire,x,y,z);

                parts.add(p);
                shadow.add(s);
                frame.add(f);
            }
        }
    }


    traceShadow();
}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:21,代碼來源:BoxTwo.java

示例15: ColumnTwo

import com.badlogic.gdx.graphics.PerspectiveCamera; //導入依賴的package包/類
public ColumnTwo(PerspectiveCamera cam, boolean[][][] collision) {
    super(cam, collision);
    x = X.FRONT;
    y = Y.UP;

    for(float y = 10f; y < 13f; ++y){
        ModelInstance p = new ModelInstance(white,2f,y,2f);
        ModelInstance s = new ModelInstance(gray,2f,y,2f);
        ModelInstance f = new ModelInstance(wire,2f,y,2f);

        parts.add(p);
        shadow.add(s);
        frame.add(f);
    }

    traceShadow();
}
 
開發者ID:msk610,項目名稱:Chemtris,代碼行數:18,代碼來源:ColumnTwo.java


注:本文中的com.badlogic.gdx.graphics.PerspectiveCamera類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。