games.rednblack.editor.renderer.systems.render.logic.LightDrawableLogic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-libgdx Show documentation
Show all versions of runtime-libgdx Show documentation
HyperLap2D libGDX runtime to render exported scenes
The newest version!
package games.rednblack.editor.renderer.systems.render.logic;
import com.artemis.ComponentMapper;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import games.rednblack.editor.renderer.components.ParentNodeComponent;
import games.rednblack.editor.renderer.components.TintComponent;
import games.rednblack.editor.renderer.components.light.LightObjectComponent;
public class LightDrawableLogic implements DrawableLogic {
protected ComponentMapper lightComponentMapper;
protected ComponentMapper tintComponentMapper;
protected ComponentMapper parentNodeComponentComponentMapper;
private final Color tmpColor = new Color();
@Override
public void draw(Batch batch, int entity, float parentAlpha, RenderingType renderingType) {
LightObjectComponent lightObjectComponent = lightComponentMapper.get(entity);
TintComponent tint = tintComponentMapper.get(entity);
tmpColor.set(tint.color);
tmpColor.a *= tintComponentMapper.get(parentNodeComponentComponentMapper.get(entity).parentEntity).color.a;
if (lightObjectComponent.lightObject != null)
lightObjectComponent.lightObject.setColor(tmpColor);
}
@Override
public void beginPipeline() {
}
@Override
public void endPipeline() {
}
}