Search in sources :

Example 21 with SceneGraphNode

use of gaiasky.scenegraph.SceneGraphNode in project gaiasky by langurmonkey.

the class AbstractOctreeWrapper method updateLocal.

public void updateLocal(ITimeFrameProvider time, ICamera camera) {
    super.updateLocal(time, camera);
    // Fade node visibility applies here
    if (this.isVisible()) {
        // Update octants
        if (!copy) {
            // Compute observed octants and fill roulette list
            OctreeNode.nOctantsObserved = 0;
            OctreeNode.nObjectsObserved = 0;
            root.update(translation, camera, roulette, opacity);
            if (OctreeNode.nObjectsObserved != lastNumberObjects) {
                // Need to update the points in renderer
                EventManager.publish(Event.STAR_POINT_UPDATE_FLAG, this, true);
                lastNumberObjects = OctreeNode.nObjectsObserved;
            }
            // Call the update method of all entities in the roulette list. This
            // is implemented in the subclass.
            updateOctreeObjects(time, translation, camera);
            addToRenderLists(camera, root);
            // Reset mask
            roulette.clear();
            // Update focus, just in case
            IFocus focus = camera.getFocus();
            if (focus != null) {
                SceneGraphNode star = focus.getFirstStarAncestor();
                OctreeNode parent = parenthood.get(star);
                if (parent != null && !parent.isObserved()) {
                    star.update(time, star.parent.translation, camera);
                }
            }
        } else {
            // Just update children
            for (SceneGraphNode node : children) {
                node.update(time, translation, camera);
            }
        }
    }
}
Also used : SceneGraphNode(gaiasky.scenegraph.SceneGraphNode) OctreeNode(gaiasky.util.tree.OctreeNode) IFocus(gaiasky.scenegraph.IFocus)

Example 22 with SceneGraphNode

use of gaiasky.scenegraph.SceneGraphNode in project gaiasky by langurmonkey.

the class AbstractOctreeWrapper method highlight.

@Override
public void highlight(boolean hl, int cmi, IAttribute cma, double cmmin, double cmmax, boolean allVisible) {
    super.highlight(hl, cmi, cma, cmmin, cmmax, allVisible);
    Array<SceneGraphNode> l = new Array<>();
    getChildrenByType(StarGroup.class, l);
    for (SceneGraphNode n : l) {
        ((StarGroup) n).highlight(hl, cmi, cma, cmmin, cmmax, allVisible);
    }
}
Also used : Array(com.badlogic.gdx.utils.Array) StarGroup(gaiasky.scenegraph.StarGroup) SceneGraphNode(gaiasky.scenegraph.SceneGraphNode)

Example 23 with SceneGraphNode

use of gaiasky.scenegraph.SceneGraphNode in project gaiasky by langurmonkey.

the class AbstractOctreeWrapper method highlight.

@Override
public void highlight(boolean hl, float[] color, boolean allVisible) {
    super.highlight(hl, color, allVisible);
    Array<SceneGraphNode> l = new Array<>();
    getChildrenByType(StarGroup.class, l);
    for (SceneGraphNode n : l) {
        ((StarGroup) n).highlight(hl, color, allVisible);
    }
}
Also used : Array(com.badlogic.gdx.utils.Array) StarGroup(gaiasky.scenegraph.StarGroup) SceneGraphNode(gaiasky.scenegraph.SceneGraphNode)

Example 24 with SceneGraphNode

use of gaiasky.scenegraph.SceneGraphNode in project gaiasky by langurmonkey.

the class OctreeWrapper method updateOctreeObjects.

@Override
protected void updateOctreeObjects(ITimeFrameProvider time, Vector3b parentTransform, ICamera camera) {
    int size = roulette.size();
    for (int i = 0; i < size; i++) {
        SceneGraphNode sgn = roulette.get(i);
        sgn.update(time, parentTransform, camera, this.opacity * sgn.octant.opacity);
    }
}
Also used : SceneGraphNode(gaiasky.scenegraph.SceneGraphNode)

Example 25 with SceneGraphNode

use of gaiasky.scenegraph.SceneGraphNode in project gaiasky by langurmonkey.

the class AbstractOrbitCoordinates method doneLoading.

@Override
public void doneLoading(Object... params) {
    if (params.length == 0) {
        logger.error(new RuntimeException("OrbitLintCoordinates need the scene graph"));
    } else {
        if (orbitname != null && !orbitname.isEmpty()) {
            SceneGraphNode sgn = ((ISceneGraph) params[0]).getNode(orbitname);
            orbit = (Orbit) sgn;
            if (params[1] instanceof CelestialBody)
                orbit.setBody((CelestialBody) params[1]);
        }
    }
}
Also used : ISceneGraph(gaiasky.scenegraph.ISceneGraph) SceneGraphNode(gaiasky.scenegraph.SceneGraphNode) CelestialBody(gaiasky.scenegraph.CelestialBody)

Aggregations

SceneGraphNode (gaiasky.scenegraph.SceneGraphNode)25 Array (com.badlogic.gdx.utils.Array)7 IFocus (gaiasky.scenegraph.IFocus)6 StarGroup (gaiasky.scenegraph.StarGroup)5 ParticleGroup (gaiasky.scenegraph.ParticleGroup)4 ArrayList (java.util.ArrayList)4 Actor (com.badlogic.gdx.scenes.scene2d.Actor)3 ChangeEvent (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent)3 FadeNode (gaiasky.scenegraph.FadeNode)3 ISceneGraph (gaiasky.scenegraph.ISceneGraph)3 IOException (java.io.IOException)3 FileHandle (com.badlogic.gdx.files.FileHandle)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 NaturalCamera (gaiasky.scenegraph.camera.NaturalCamera)2 AbstractOctreeWrapper (gaiasky.scenegraph.octreewrapper.AbstractOctreeWrapper)2 IParticleRecord (gaiasky.scenegraph.particle.IParticleRecord)2 CatalogInfo (gaiasky.util.CatalogInfo)2 OwnLabel (gaiasky.util.scene2d.OwnLabel)2 Lwjgl3Graphics (com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1