use of ilargia.egdx.logicbricks.component.scene.CDirectionalLight in project Entitas-Java by Rubentxu.
the class SceneEntity method replaceCDirectionalLight.
public SceneEntity replaceCDirectionalLight(int raysNum, Color color, float direcction) {
CDirectionalLight component = (CDirectionalLight) recoverComponent(SceneComponentsLookup.CDirectionalLight);
if (component == null) {
component = new CDirectionalLight(raysNum, color, direcction);
} else {
component.raysNum = raysNum;
component.color = color;
component.direcction = direcction;
component.light = null;
}
replaceComponent(SceneComponentsLookup.CDirectionalLight, component);
return this;
}
use of ilargia.egdx.logicbricks.component.scene.CDirectionalLight in project Entitas-Java by Rubentxu.
the class SceneManagerGDX method initialize.
@Override
public void initialize() {
if (engine.getManager(PhysicsManagerGDX.class) == null)
throw new EntitasException("SceneManagerGDX", "SceneManagerGDX needs load PhysicsManagerGDX on the engine");
physics = engine.getManager(PhysicsManagerGDX.class);
rayHandler = new RayHandler(physics.getPhysics());
PreferencesManagerGDX preferences = engine.getManager(PreferencesManagerGDX.class);
rayHandler.setAmbientLight(preferences.AMBIENT_LIGHT);
rayHandler.setBlur(preferences.BLUR);
rayHandler.setCulling(preferences.CULLING);
rayHandler.setGammaCorrection(preferences.GAMMA_CORRECTION);
rayHandler.setBlurNum(preferences.BLUR_NUM);
rayHandler.setShadows(preferences.SHADOWS);
rayHandler.useDiffuseLight(preferences.USE_DIFFUSE_LIGHT);
//rayHandler.update();
AssetsManagerGDX assetsManager = engine.getManager(AssetsManagerGDX.class);
for (EntityFactory factory : entityFactories.values()) {
factory.loadAssets(engine);
}
assetsManager.finishLoading();
addLightFactory(PointLight.class, (SceneManager sceneManager, IComponent c) -> {
CPointLight component = (CPointLight) c;
return new PointLight(rayHandler, component.raysNum, component.color, component.distance, component.position.x, component.position.y);
});
addLightFactory(DirectionalLight.class, (SceneManager sceneManager, IComponent c) -> {
LogManagerGDX.debug("SceneManager", "create directional ligth");
CDirectionalLight component = (CDirectionalLight) c;
return new DirectionalLight(rayHandler, component.raysNum, component.color, component.direcction);
});
addLightFactory(ChainLight.class, (SceneManager sceneManager, IComponent c) -> {
LogManagerGDX.debug("SceneManager", "create ChainLight");
CChainLight component = (CChainLight) c;
return new ChainLight(rayHandler, component.raysNum, component.color, component.distance, component.rayDirecction, component.chain);
});
addLightFactory(ConeLight.class, (SceneManager sceneManager, IComponent c) -> {
LogManagerGDX.debug("SceneManager", "create ConeLight");
CConeLight component = (CConeLight) c;
return new ConeLight(rayHandler, component.raysNum, component.color, component.distance, component.position.x, component.position.y, component.directionDegree, component.coneDegree);
});
}
use of ilargia.egdx.logicbricks.component.scene.CDirectionalLight in project Entitas-Java by Rubentxu.
the class SceneEntity method addCDirectionalLight.
public SceneEntity addCDirectionalLight(int raysNum, Color color, float direcction) {
CDirectionalLight component = (CDirectionalLight) recoverComponent(SceneComponentsLookup.CDirectionalLight);
if (component == null) {
component = new CDirectionalLight(raysNum, color, direcction);
} else {
component.raysNum = raysNum;
component.color = color;
component.direcction = direcction;
component.light = null;
}
addComponent(SceneComponentsLookup.CDirectionalLight, component);
return this;
}
Aggregations