Search in sources :

Example 1 with CDirectionalLight

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;
}
Also used : CDirectionalLight(ilargia.egdx.logicbricks.component.scene.CDirectionalLight)

Example 2 with CDirectionalLight

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);
    });
}
Also used : CConeLight(ilargia.egdx.logicbricks.component.scene.CConeLight) SceneManager(ilargia.egdx.api.managers.SceneManager) IComponent(ilargia.entitas.api.IComponent) CChainLight(ilargia.egdx.logicbricks.component.scene.CChainLight) CChainLight(ilargia.egdx.logicbricks.component.scene.CChainLight) CDirectionalLight(ilargia.egdx.logicbricks.component.scene.CDirectionalLight) CConeLight(ilargia.egdx.logicbricks.component.scene.CConeLight) EntitasException(ilargia.entitas.api.entitas.EntitasException) CPointLight(ilargia.egdx.logicbricks.component.scene.CPointLight) CPointLight(ilargia.egdx.logicbricks.component.scene.CPointLight) EntityFactory(ilargia.egdx.api.factories.EntityFactory) CDirectionalLight(ilargia.egdx.logicbricks.component.scene.CDirectionalLight)

Example 3 with CDirectionalLight

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;
}
Also used : CDirectionalLight(ilargia.egdx.logicbricks.component.scene.CDirectionalLight)

Aggregations

CDirectionalLight (ilargia.egdx.logicbricks.component.scene.CDirectionalLight)3 EntityFactory (ilargia.egdx.api.factories.EntityFactory)1 SceneManager (ilargia.egdx.api.managers.SceneManager)1 CChainLight (ilargia.egdx.logicbricks.component.scene.CChainLight)1 CConeLight (ilargia.egdx.logicbricks.component.scene.CConeLight)1 CPointLight (ilargia.egdx.logicbricks.component.scene.CPointLight)1 IComponent (ilargia.entitas.api.IComponent)1 EntitasException (ilargia.entitas.api.entitas.EntitasException)1