private void renderFor(World world, float deltaTime) { for (Entity entity : world.entities.values()) { entity.updatePosition(deltaTime); if (entity instanceof RenderableProvider) modelBatch.render(((RenderableProvider) entity)); } }
/** * Add BaseRenderable to queue * @param renderableProvider */ public void add(final RenderableProvider renderableProvider) { if (camera == null) throw new GdxRuntimeException("Call begin() first."); final int offset = renderables.size; renderableProvider.getRenderables(renderables, renderablePool); for (int i = offset; i < renderables.size; i++) { Renderable renderable = renderables.get(i); renderable.mesh.setAutoBind(false); } }
public WorldRenderingSystem(Level level) { super(); this.terrain = level.terrainEngine; this.batch = level.batch; this.colorShaderProvider = level.colorShaderProvider; this.depthShaderProvider = level.depthShaderProvider; this.env = level.env; this.mainCamera = level.camera; this.skybox = level.env.skybox; this.octree = level.octree; this.finalBucket = new Array<RenderableProvider>(); frustrumOctreeQuery.setKlass(PositionComponent.class); }
@Override public Array<RenderableProvider> getRenderableProviders() { return renderableProviders; }
public void addDirectInstance(RenderableProvider inst) { this.directModelProviders.add(inst); }
public List<RenderableProvider> renderableProviders() { List<RenderableProvider> providers = new ArrayList<>(); providers.addAll(renderables()); providers.addAll(directModelProviders); return providers; }
public void renderIntoBatch() { modelBatch.begin(renderer.camera()); List<RenderableProvider> providers = renderer.renderableProviders(); providers.forEach(modelBatch::render); modelBatch.end(); }
public void addAll(Array<RenderableProvider> bucket) { for (int i = 0; i < bucket.size; i++) { add(bucket.get(i)); } }
Array<RenderableProvider> getRenderableProviders();