use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ultimate-java by pantinor.
the class CodexScreen method fillCircle.
private ModelInstance fillCircle(float radius, Vector3 c, float cz, Color color) {
Model model = null;
ModelBuilder mb = new ModelBuilder();
mb.begin();
MeshPartBuilder part = mb.part("circle", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal, new Material(ColorAttribute.createDiffuse(color)));
part.circle(radius, 32, c, new Vector3(0, 1, 0));
model = mb.end();
ModelInstance modelInstance = new ModelInstance(model);
modelInstance.transform.setToTranslation(0, cz, 0);
return modelInstance;
}
use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ultimate-java by pantinor.
the class CodexScreen method render.
@Override
public void render(float delta) {
camera.update();
Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT);
lightFactor += Gdx.graphics.getDeltaTime();
float lightSize = 7.75f + 0.25f * (float) Math.sin(lightFactor) + .2f * MathUtils.random();
fixedLight.set(nll2.x, nll2.y, nll2.z, 5.5f, 2, 5.5f, lightSize);
modelBatch.begin(camera);
for (ModelInstance i : floor) {
modelBatch.render(i, environment);
}
for (ModelInstance i : modelInstances) {
modelBatch.render(i, environment);
}
modelBatch.end();
stage.act();
stage.draw();
// modelBatch.render(axesInstance);
batch.begin();
logs.render(batch);
batch.end();
nextPiece();
}
use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ultimate-java by pantinor.
the class CodexScreen method dispose.
@Override
public void dispose() {
modelBatch.dispose();
batch.dispose();
stage.dispose();
for (ModelInstance mi : floor) {
mi.model.dispose();
}
for (ModelInstance mi : modelInstances) {
mi.model.dispose();
}
font.dispose();
}
use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ultimate-java by pantinor.
the class CodexScreen method getFigure.
private ModelInstance getFigure(float x, float y, float z, float rotation) {
ModelInstance instance = new ModelInstance(avatarModel, x, y, z);
instance.nodes.get(0).scale.set(.01f, .01f, .01f);
instance.transform.rotate(new Vector3(0, 1, 0), rotation);
instance.calculateTransforms();
return instance;
}
use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ultimate-java by pantinor.
the class CodexScreen method createCircle.
private ModelInstance createCircle(float radius, float thickness, Vector3 c, float cz, Color color) {
Model model = null;
ModelBuilder mb = new ModelBuilder();
mb.begin();
MeshPartBuilder part = mb.part("circle", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal, new Material(ColorAttribute.createDiffuse(color)));
part.ellipse(radius, radius, radius - thickness, radius - thickness, 32, c, new Vector3(0, 1, 0));
model = mb.end();
ModelInstance modelInstance = new ModelInstance(model);
modelInstance.transform.setToTranslation(0, cz, 0);
return modelInstance;
}
Aggregations