Search in sources :

Example 1 with BillboardDataset

use of gaiasky.scenegraph.particle.BillboardDataset in project gaiasky by langurmonkey.

the class MilkyWay method reloadData.

private boolean reloadData() {
    try {
        PointDataProvider provider = new PointDataProvider();
        boolean reload = false;
        for (BillboardDataset dataset : datasets) {
            boolean reloadNeeded = dataset.initialize(provider, reload);
            reload = reload || reloadNeeded;
        }
        return reload;
    } catch (Exception e) {
        Logger.getLogger(this.getClass()).error(e);
    }
    return false;
}
Also used : PointDataProvider(gaiasky.data.group.PointDataProvider) BillboardDataset(gaiasky.scenegraph.particle.BillboardDataset) ReflectionException(com.badlogic.gdx.utils.reflect.ReflectionException)

Example 2 with BillboardDataset

use of gaiasky.scenegraph.particle.BillboardDataset in project gaiasky by langurmonkey.

the class GalaxydataComponent method generateDataset.

private BillboardDataset generateDataset(PointDataProvider provider, String file, ParticleType type, double size, double intensity, int[] layers, double[] maxSizes) {
    BillboardDataset bd = new BillboardDataset();
    bd.file = file;
    bd.type = type;
    bd.size = (float) size;
    bd.intensity = (float) intensity;
    bd.setLayers(layers);
    bd.setMaxsizes(maxSizes);
    bd.initialize(provider, false);
    return bd;
}
Also used : BillboardDataset(gaiasky.scenegraph.particle.BillboardDataset)

Example 3 with BillboardDataset

use of gaiasky.scenegraph.particle.BillboardDataset in project gaiasky by langurmonkey.

the class BillboardGroup method reloadData.

private boolean reloadData() {
    try {
        PointDataProvider provider = new PointDataProvider();
        boolean reload = false;
        for (BillboardDataset dataset : datasets) {
            boolean reloadNeeded = dataset.initialize(provider, reload);
            reload = reload || reloadNeeded;
        }
        return reload;
    } catch (Exception e) {
        Logger.getLogger(this.getClass()).error(e);
    }
    return false;
}
Also used : PointDataProvider(gaiasky.data.group.PointDataProvider) BillboardDataset(gaiasky.scenegraph.particle.BillboardDataset) ReflectionException(com.badlogic.gdx.utils.reflect.ReflectionException)

Example 4 with BillboardDataset

use of gaiasky.scenegraph.particle.BillboardDataset in project gaiasky by langurmonkey.

the class BillboardGroup method transformData.

private void transformData() {
    // Set static coordinates to position
    coordinates.getEquatorialCartesianCoordinates(null, pos);
    // Initialise transform
    if (transformName != null) {
        Class<Coordinates> c = Coordinates.class;
        try {
            Method m = ClassReflection.getMethod(c, transformName);
            Matrix4d trf = (Matrix4d) m.invoke(null);
            coordinateSystem = trf.putIn(new Matrix4());
        } catch (ReflectionException e) {
            Logger.getLogger(this.getClass()).error("Error getting/invoking method Coordinates." + transformName + "()");
        }
    } else {
    // Equatorial, nothing
    }
    // Model
    Vector3 aux = new Vector3();
    Vector3 pos3 = pos.toVector3();
    // Transform all
    for (BillboardDataset bd : datasets) {
        List<IParticleRecord> a = bd.data;
        if (a != null) {
            for (int i = 0; i < a.size(); i++) {
                IParticleRecord pr = a.get(i);
                aux.set((float) pr.x(), (float) pr.z(), (float) pr.y());
                aux.scl(size).rotate(-90, 0, 1, 0).mul(coordinateSystem).add(pos3);
                pr.setPos(aux.x, aux.y, aux.z);
            }
        }
    }
}
Also used : ReflectionException(com.badlogic.gdx.utils.reflect.ReflectionException) BillboardDataset(gaiasky.scenegraph.particle.BillboardDataset) Coordinates(gaiasky.util.coord.Coordinates) IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord) Vector3(com.badlogic.gdx.math.Vector3) Method(com.badlogic.gdx.utils.reflect.Method) Matrix4(com.badlogic.gdx.math.Matrix4)

Example 5 with BillboardDataset

use of gaiasky.scenegraph.particle.BillboardDataset in project gaiasky by langurmonkey.

the class GalaxydataComponent method transformToDatasets.

public BillboardDataset[] transformToDatasets() {
    try {
        BillboardDataset[] datasets = new BillboardDataset[5];
        PointDataProvider provider = new PointDataProvider();
        if (starsource != null) {
            datasets[0] = generateDataset(provider, starsource, ParticleType.STAR, 2.0, 8.0, new int[] { 0, 1 }, new double[] { 0.1, 0.1, 0.1, 0.1 });
        }
        if (bulgesource != null) {
            datasets[1] = generateDataset(provider, bulgesource, ParticleType.BULGE, 30.0, 10.0, new int[] { 0, 1 }, new double[] { 0.1, 0.1, 0.1, 0.15 });
        }
        if (dustsource != null) {
            datasets[2] = generateDataset(provider, dustsource, ParticleType.DUST, 300.0, 2.0, new int[] { 3, 5, 6 }, new double[] { 13.0, 13.0, 20.0, 30.0 });
            datasets[2].depthMask = true;
            datasets[2].blending = BlendMode.ALPHA;
        }
        if (hiisource != null) {
            datasets[3] = generateDataset(provider, hiisource, ParticleType.HII, 100.0, 0.5, new int[] { 2, 3, 4, 5, 6, 7 }, new double[] { 1.5, 1.5, 2.0, 8.0 });
        }
        if (gassource != null) {
            datasets[4] = generateDataset(provider, gassource, ParticleType.GAS, 40.0, 0.5, new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }, new double[] { 2.0, 2.3, 8.0, 10.0 });
        }
        return datasets;
    } catch (Exception e) {
        Logger.getLogger(this.getClass()).error(e);
    }
    return null;
}
Also used : PointDataProvider(gaiasky.data.group.PointDataProvider) BillboardDataset(gaiasky.scenegraph.particle.BillboardDataset)

Aggregations

BillboardDataset (gaiasky.scenegraph.particle.BillboardDataset)6 ReflectionException (com.badlogic.gdx.utils.reflect.ReflectionException)4 PointDataProvider (gaiasky.data.group.PointDataProvider)3 Matrix4 (com.badlogic.gdx.math.Matrix4)2 Vector3 (com.badlogic.gdx.math.Vector3)2 Method (com.badlogic.gdx.utils.reflect.Method)2 IParticleRecord (gaiasky.scenegraph.particle.IParticleRecord)2 Coordinates (gaiasky.util.coord.Coordinates)2