Search in sources :

Example 1 with IntModelBatch

use of gaiasky.util.gdx.IntModelBatch in project gaiasky by langurmonkey.

the class SpacecraftGui method initialize.

public void initialize(AssetManager assetManager, SpriteBatch sb) {
    this.sb = sb;
    // User interface
    ScreenViewport vp = new ScreenViewport();
    vp.setUnitsPerPixel(unitsPerPixel);
    ui = new Stage(vp, sb);
    indicatorw = 480f;
    indicatorh = 480f;
    indicatorx = -32f;
    indicatory = -20f;
    // init gui camera
    aiCam = new PerspectiveCamera(30, indicatorw * Settings.settings.program.ui.scale, indicatorh * Settings.settings.program.ui.scale);
    aiCam.near = (float) (1e5 * Constants.KM_TO_U);
    aiCam.far = (float) (1e8 * Constants.KM_TO_U);
    aiCam.up.set(0, 1, 0);
    aiCam.direction.set(0, 0, 1);
    aiCam.position.set(0, 0, 0);
    // Init AI
    dlight = new DirectionalLight();
    dlight.color.set(1f, 1f, 1f, 1f);
    dlight.setDirection(-1f, .05f, .5f);
    env = new Environment();
    env.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f), new ColorAttribute(ColorAttribute.Specular, .5f, .5f, .5f, 1f));
    env.add(dlight);
    db = new DecalBatch(4, new CameraGroupStrategy(aiCam));
    mb = new IntModelBatch();
    assetManager.load(Settings.settings.data.dataFile("tex/base/attitudeindicator.png"), Texture.class);
    assetManager.load("img/ai-pointer.png", Texture.class);
    assetManager.load("img/ai-vel.png", Texture.class);
    assetManager.load("img/ai-antivel.png", Texture.class);
    EventManager.instance.subscribe(this, gaiasky.event.Event.SPACECRAFT_LOADED);
}
Also used : DecalBatch(com.badlogic.gdx.graphics.g3d.decals.DecalBatch) DirectionalLight(com.badlogic.gdx.graphics.g3d.environment.DirectionalLight) Environment(gaiasky.util.gdx.shader.Environment) CameraGroupStrategy(gaiasky.util.gdx.g3d.decals.CameraGroupStrategy) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) PerspectiveCamera(com.badlogic.gdx.graphics.PerspectiveCamera) ColorAttribute(gaiasky.util.gdx.shader.attribute.ColorAttribute) IntModelBatch(gaiasky.util.gdx.IntModelBatch)

Aggregations

PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)1 DecalBatch (com.badlogic.gdx.graphics.g3d.decals.DecalBatch)1 DirectionalLight (com.badlogic.gdx.graphics.g3d.environment.DirectionalLight)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 IntModelBatch (gaiasky.util.gdx.IntModelBatch)1 CameraGroupStrategy (gaiasky.util.gdx.g3d.decals.CameraGroupStrategy)1 Environment (gaiasky.util.gdx.shader.Environment)1 ColorAttribute (gaiasky.util.gdx.shader.attribute.ColorAttribute)1