use of com.badlogic.gdx.graphics.g3d.loader.ObjLoader in project libgdx by libgdx.
the class EdgeDetectionTest method create.
public void create() {
ShaderProgram.pedantic = false;
/*
* shader = new ShaderProgram(Gdx.files.internal("data/shaders/default.vert").readString(), Gdx.files.internal(
* "data/shaders/depthtocolor.frag").readString()); if (!shader.isCompiled()) { Gdx.app.log("EdgeDetectionTest",
* "couldn't compile scene shader: " + shader.getLog()); }
*/
batchShader = new ShaderProgram(Gdx.files.internal("data/shaders/batch.vert").readString(), Gdx.files.internal("data/shaders/convolution.frag").readString());
if (!batchShader.isCompiled()) {
Gdx.app.log("EdgeDetectionTest", "couldn't compile post-processing shader: " + batchShader.getLog());
}
ObjLoader objLoader = new ObjLoader();
scene = objLoader.loadModel(Gdx.files.internal("data/scene.obj"));
sceneInstance = new ModelInstance(scene);
modelBatch = new ModelBatch();
fbo = new FrameBuffer(Format.RGB565, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 0, 10);
cam.lookAt(0, 0, 0);
cam.far = 30;
batch = new SpriteBatch();
batch.setShader(batchShader);
fboRegion = new TextureRegion(fbo.getColorBufferTexture());
fboRegion.flip(false, true);
logger = new FPSLogger();
calculateOffsets();
}
use of com.badlogic.gdx.graphics.g3d.loader.ObjLoader in project libgdx by libgdx.
the class FrameBufferCubemapTest method create.
@Override
public void create() {
super.create();
camFb = new PerspectiveCamera(90, 800, 800);
camFb.position.set(10f, 10f, 10f);
camFb.lookAt(0, 0, 0);
camFb.near = 0.1f;
camFb.far = 1000f;
camFb.update();
fb = new FrameBufferCubemap(Format.RGBA8888, 800, 800, true);
cubemap = fb.getColorBufferTexture();
ObjLoader objLoader = new ObjLoader();
cubeMesh = objLoader.loadModel(Gdx.files.internal("data/cube.obj"));
cubeInstance = new ModelInstance(cubeMesh);
cubeBatch = new ModelBatch(Gdx.files.internal("data/shaders/cubemap-vert.glsl"), Gdx.files.internal("data/shaders/cubemap-frag.glsl"));
cubeInstance.materials.get(0).set(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap));
camCube = new PerspectiveCamera(67, Gdx.graphics.getWidth() * 0.5f, Gdx.graphics.getHeight() * 0.5f);
camCube.position.set(0f, 2f, 2f);
camCube.lookAt(0, 0, 0);
camCube.near = 1f;
camCube.far = 300f;
camCube.update();
}
use of com.badlogic.gdx.graphics.g3d.loader.ObjLoader in project libgdx by libgdx.
the class ProjectTest method create.
@Override
public void create() {
ObjLoader objLoader = new ObjLoader();
sphere = objLoader.loadModel(Gdx.files.internal("data/sphere.obj"));
sphere.materials.get(0).set(new ColorAttribute(ColorAttribute.Diffuse, Color.WHITE));
cam = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.far = 200;
Random rand = new Random();
for (int i = 0; i < instances.length; i++) {
instances[i] = new ModelInstance(sphere, rand.nextFloat() * 100 - rand.nextFloat() * 100, rand.nextFloat() * 100 - rand.nextFloat() * 100, rand.nextFloat() * -100 - 3);
}
batch = new SpriteBatch();
font = new BitmapFont();
logo = new TextureRegion(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
modelBatch = new ModelBatch();
}
use of com.badlogic.gdx.graphics.g3d.loader.ObjLoader in project libgdx by libgdx.
the class FramebufferToTextureTest method create.
@Override
public void create() {
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), true);
texture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
ObjLoader objLoader = new ObjLoader();
mesh = objLoader.loadModel(Gdx.files.internal("data/cube.obj"));
mesh.materials.get(0).set(new TextureAttribute(TextureAttribute.Diffuse, texture));
modelInstance = new ModelInstance(mesh);
modelBatch = new ModelBatch();
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(3, 3, 3);
cam.direction.set(-1, -1, -1);
batch = new SpriteBatch();
font = new BitmapFont();
}
Aggregations