use of com.badlogic.gdx.tests.utils.PerspectiveCamController in project libgdx by libgdx.
the class MipMapTest method create.
@Override
public void create() {
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(0, 1.5f, 1.5f);
camera.lookAt(0, 0, 0);
camera.update();
controller = new PerspectiveCamController(camera);
mesh = new Mesh(true, 4, 4, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE));
mesh.setVertices(new float[] { -1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, -1, 1, 0, -1, 0, -1, 0, 0 });
mesh.setIndices(new short[] { 0, 1, 2, 3 });
shader = new ShaderProgram(Gdx.files.internal("data/shaders/flattex-vert.glsl").readString(), Gdx.files.internal("data/shaders/flattex-frag.glsl").readString());
if (!shader.isCompiled())
throw new GdxRuntimeException("shader error: " + shader.getLog());
textureHW = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
MipMapGenerator.setUseHardwareMipMap(false);
textureSW = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
currTexture = textureHW;
createUI();
multiplexer = new InputMultiplexer();
Gdx.input.setInputProcessor(multiplexer);
multiplexer.addProcessor(ui);
multiplexer.addProcessor(controller);
}
use of com.badlogic.gdx.tests.utils.PerspectiveCamController in project libgdx by libgdx.
the class ShapeRendererTest method create.
public void create() {
renderer = new ShapeRenderer();
cam = new PerspectiveCamera(47, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 0, 2);
cam.near = 0.1f;
controller = new PerspectiveCamController(cam);
Gdx.input.setInputProcessor(controller);
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}
use of com.badlogic.gdx.tests.utils.PerspectiveCamController in project libgdx by libgdx.
the class ProjectiveTextureTest method setupScene.
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();
}
use of com.badlogic.gdx.tests.utils.PerspectiveCamController in project libgdx by libgdx.
the class SimpleDecalTest method create.
public void create() {
float width = Gdx.graphics.getWidth();
float height = Gdx.graphics.getHeight();
camera = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 1;
camera.far = 300;
camera.position.set(0, 0, 5);
controller = new PerspectiveCamController(camera);
Gdx.input.setInputProcessor(controller);
batch = new DecalBatch(new CameraGroupStrategy(camera));
TextureRegion[] textures = { new TextureRegion(new Texture(Gdx.files.internal("data/egg.png"))), new TextureRegion(new Texture(Gdx.files.internal("data/wheel.png"))), new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg"))) };
Decal decal = Decal.newDecal(1, 1, textures[1]);
decal.setPosition(0, 0, 0);
decals.add(decal);
decal = Decal.newDecal(1, 1, textures[0], true);
decal.setPosition(0.5f, 0.5f, 1);
decals.add(decal);
decal = Decal.newDecal(1, 1, textures[0], true);
decal.setPosition(1, 1, -1);
decals.add(decal);
decal = Decal.newDecal(1, 1, textures[2]);
decal.setPosition(1.5f, 1.5f, -2);
decals.add(decal);
decal = Decal.newDecal(1, 1, textures[1]);
decal.setPosition(2, 2, -1.5f);
decals.add(decal);
}
Aggregations