Search in sources :

Example 41 with IParticleRecord

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

the class ParticleGroup method getCandidateViewAngleApparent.

@Override
public double getCandidateViewAngleApparent() {
    if (candidateFocusIndex >= 0) {
        IParticleRecord candidate = pointData.get(candidateFocusIndex);
        Vector3d aux = candidate.pos(D31.get());
        ICamera camera = GaiaSky.instance.getICamera();
        return (float) ((size * .5e2f / aux.sub(camera.getPos()).len()) / camera.getFovFactor());
    } else {
        return -1;
    }
}
Also used : IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord) ICamera(gaiasky.scenegraph.camera.ICamera)

Example 42 with IParticleRecord

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

the class ParticleGroup method generateIndex.

/**
 * Generates the index (maps name to array index)
 * and computes the geometric center of this group
 *
 * @param pointData The data
 *
 * @return An map{string,int} mapping names to indices
 */
public Map<String, Integer> generateIndex(List<IParticleRecord> pointData) {
    Map<String, Integer> index = new HashMap<>((int) (pointData.size() * 1.25));
    int n = pointData.size();
    for (int i = 0; i < n; i++) {
        IParticleRecord pb = pointData.get(i);
        if (pb.names() != null) {
            final int idx = i;
            Arrays.stream(pb.names()).forEach(name -> index.put(name.toLowerCase(), idx));
        }
    }
    return index;
}
Also used : IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord)

Example 43 with IParticleRecord

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

the class SceneGraph method removeFromHipMap.

private void removeFromHipMap(SceneGraphNode node) {
    if (node instanceof AbstractOctreeWrapper) {
        AbstractOctreeWrapper aow = (AbstractOctreeWrapper) node;
        Set<SceneGraphNode> set = aow.parenthood.keySet();
        for (SceneGraphNode ape : set) removeFromHipMap(ape);
    } else {
        synchronized (hipMap) {
            if (node instanceof CelestialBody) {
                CelestialBody s = (CelestialBody) node;
                if (s instanceof Star && ((Star) s).hip >= 0) {
                    hipMap.remove(((Star) s).hip);
                }
            } else if (node instanceof StarGroup) {
                StarGroup sg = (StarGroup) node;
                List<IParticleRecord> arr = sg.data();
                if (arr != null) {
                    for (IParticleRecord pb : arr) {
                        if (pb != null && pb.hip() >= 0)
                            hipMap.remove(pb.hip());
                    }
                }
            }
        }
    }
}
Also used : IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord) AbstractOctreeWrapper(gaiasky.scenegraph.octreewrapper.AbstractOctreeWrapper)

Example 44 with IParticleRecord

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

the class StarGroup method getCandidateViewAngleApparent.

@Override
public double getCandidateViewAngleApparent() {
    if (candidateFocusIndex >= 0) {
        IParticleRecord candidate = pointData.get(candidateFocusIndex);
        Vector3d aux = candidate.pos(D31.get());
        ICamera camera = GaiaSky.instance.getICamera();
        double va = (float) ((candidate.radius() / aux.sub(camera.getPos()).len()) / camera.getFovFactor());
        return va * Settings.settings.scene.star.brightness;
    } else {
        return -1;
    }
}
Also used : Vector3d(gaiasky.util.math.Vector3d) IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord) ICamera(gaiasky.scenegraph.camera.ICamera)

Example 45 with IParticleRecord

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

the class StarGroup method updateFocus.

/**
 * Updates the parameters of the focus, if the focus is active in this group
 *
 * @param camera The current camera
 */
public void updateFocus(ICamera camera) {
    IParticleRecord focus = pointData.get(focusIndex);
    Vector3d aux = this.fetchPosition(focus, cPosD, D31.get(), currDeltaYears);
    this.focusPosition.set(aux).add(camera.getPos());
    this.focusDistToCamera = aux.len();
    this.focusSize = getFocusSize();
    this.focusViewAngle = (float) ((getRadius() / this.focusDistToCamera) / camera.getFovFactor());
    this.focusViewAngleApparent = this.focusViewAngle * Settings.settings.scene.star.brightness;
}
Also used : Vector3d(gaiasky.util.math.Vector3d) IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord)

Aggregations

IParticleRecord (gaiasky.scenegraph.particle.IParticleRecord)48 Vector3d (gaiasky.util.math.Vector3d)10 StarGroup (gaiasky.scenegraph.StarGroup)8 ArrayList (java.util.ArrayList)6 Array (com.badlogic.gdx.utils.Array)5 Vector3 (com.badlogic.gdx.math.Vector3)4 ParticleGroup (gaiasky.scenegraph.ParticleGroup)4 OctreeNode (gaiasky.util.tree.OctreeNode)4 FileHandle (com.badlogic.gdx.files.FileHandle)3 ParticleRecord (gaiasky.scenegraph.particle.ParticleRecord)3 Coordinates (gaiasky.util.coord.Coordinates)3 Matrix4 (com.badlogic.gdx.math.Matrix4)2 LongMap (com.badlogic.gdx.utils.LongMap)2 Method (com.badlogic.gdx.utils.reflect.Method)2 ReflectionException (com.badlogic.gdx.utils.reflect.ReflectionException)2 IStarGroupDataProvider (gaiasky.data.group.IStarGroupDataProvider)2 SceneGraphNode (gaiasky.scenegraph.SceneGraphNode)2 ICamera (gaiasky.scenegraph.camera.ICamera)2 AbstractOctreeWrapper (gaiasky.scenegraph.octreewrapper.AbstractOctreeWrapper)2 BillboardDataset (gaiasky.scenegraph.particle.BillboardDataset)2