use of de.gg.entity.Building in project ProjektGG by eskalon.
the class GameMapScreen method onInit.
@Override
protected void onInit() {
titleImage = assetManager.get(TITLE_IMAGE_PATH);
sceneRenderer = new SceneRenderer(game.getGameCamera().getCamera(), game.getCurrentSession().getCity());
Model scene = assetManager.get(TEST_SCENE_PATH);
for (int i = 0; i < scene.nodes.size; i++) {
String id = scene.nodes.get(i).id;
RenderData instance = new RenderData(scene, id, true);
if (id.equals("space")) {
game.getCurrentSession().getCity().setSkybox(instance);
continue;
}
game.getCurrentSession().getCity().getBuildings().add(new Building(i, instance));
/*
* if (id.equals("ship")) ship = instance; else if
* (id.startsWith("block")) blocks.add(instance); else if
* (id.startsWith("invader")) invaders.add(instance);
*/
}
ModelBuilder modelBuilder = new ModelBuilder();
Model model = modelBuilder.createSphere(2f, 2f, 2f, 20, 20, new Material(), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
NodePart blockPart = model.nodes.get(0).parts.get(0);
renderable = new Renderable();
blockPart.setRenderable(renderable);
renderable.environment = sceneRenderer.environment;
renderable.worldTransform.idt();
renderContext = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
shader = new TestShader(game.getAssetManager());
shader.init();
// this.renderContext = new RenderContext(
// new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
// this.shader.init();
this.cameraController = new CameraInputController(game.getGameCamera().getCamera());
}
use of de.gg.entity.Building in project ProjektGG by eskalon.
the class BuildingRenderer method render.
public int render(ModelBatch modelBatch, Environment environment, List<Building> buildings) {
visibleObjectCount = 0;
for (final Building building : buildings) {
if (isRenderObjectVisible(camera, building.getRenderData())) {
modelBatch.render(building.getRenderData(), environment);
visibleObjectCount++;
}
}
return visibleObjectCount;
}
Aggregations