Search in sources :

Example 1 with RelativisticEffectsManager

use of gaiasky.util.gravwaves.RelativisticEffectsManager in project gaiasky by langurmonkey.

the class RelativisticEffectsComponent method updateGravitationalWavesMaterial.

public void updateGravitationalWavesMaterial(Material material) {
    if (material.get(Vector4Attribute.Hterms) == null) {
        setUpGravitationalWavesMaterial(material);
    }
    RelativisticEffectsManager rem = RelativisticEffectsManager.getInstance();
    // hterms
    ((Vector4Attribute) material.get(Vector4Attribute.Hterms)).value = rem.hterms;
    // gw
    ((Vector3Attribute) material.get(Vector3Attribute.Gw)).value.set(rem.gw);
    // gwmat3
    ((Matrix3Attribute) material.get(Matrix3Attribute.Gwmat3)).value.set(rem.gwmat3);
    // ts
    ((FloatAttribute) material.get(FloatAttribute.Ts)).value = rem.gwtime;
    // omgw
    ((FloatAttribute) material.get(FloatAttribute.Omgw)).value = rem.omgw;
}
Also used : RelativisticEffectsManager(gaiasky.util.gravwaves.RelativisticEffectsManager)

Example 2 with RelativisticEffectsManager

use of gaiasky.util.gravwaves.RelativisticEffectsManager in project gaiasky by langurmonkey.

the class AbstractRenderSystem method addRelativisticUniforms.

protected void addRelativisticUniforms(ExtShaderProgram shaderProgram, ICamera camera) {
    if (settings.runtime.relativisticAberration) {
        RelativisticEffectsManager rem = RelativisticEffectsManager.getInstance();
        shaderProgram.setUniformf("u_velDir", rem.velDir);
        shaderProgram.setUniformf("u_vc", rem.vc);
    }
}
Also used : RelativisticEffectsManager(gaiasky.util.gravwaves.RelativisticEffectsManager)

Example 3 with RelativisticEffectsManager

use of gaiasky.util.gravwaves.RelativisticEffectsManager in project gaiasky by langurmonkey.

the class AbstractRenderSystem method addGravWaveUniforms.

protected void addGravWaveUniforms(ExtShaderProgram shaderProgram) {
    if (settings.runtime.gravitationalWaves) {
        RelativisticEffectsManager rem = RelativisticEffectsManager.getInstance();
        // Time in seconds - use simulation time
        shaderProgram.setUniformf("u_ts", rem.gwtime);
        // Wave frequency
        shaderProgram.setUniformf("u_omgw", rem.omgw);
        // Coordinates of wave (cartesian)
        shaderProgram.setUniformf("u_gw", rem.gw);
        // Transformation matrix
        shaderProgram.setUniformMatrix("u_gwmat3", rem.gwmat3);
        // H terms - hpluscos, hplussin, htimescos, htimessin
        shaderProgram.setUniform4fv("u_hterms", rem.hterms, 0, 4);
    }
}
Also used : RelativisticEffectsManager(gaiasky.util.gravwaves.RelativisticEffectsManager)

Example 4 with RelativisticEffectsManager

use of gaiasky.util.gravwaves.RelativisticEffectsManager in project gaiasky by langurmonkey.

the class NaturalCamera method render.

@Override
public void render(int rw, int rh) {
    boolean modeStereo = Settings.settings.program.modeStereo.active;
    boolean modeStereoVR = modeStereo && Settings.settings.program.modeStereo.isStereoVR();
    boolean modeCubemap = Settings.settings.program.modeCubemap.active;
    boolean modeFisheye = Settings.settings.postprocess.fisheye;
    boolean modeVR = Settings.settings.runtime.openVr;
    if (modeStereoVR) {
        // No pointer guides or cross-hairs
        return;
    }
    // Pointer guides
    if (Settings.settings.program.pointer.guides.active && !modeStereo && !modeFisheye && !modeCubemap && !modeVR) {
        int mouseX = Gdx.input.getX();
        int mouseY = rh - Gdx.input.getY();
        shapeRenderer.begin(ShapeType.Line);
        Gdx.gl.glEnable(GL30.GL_BLEND);
        Gdx.gl.glLineWidth(Settings.settings.program.pointer.guides.width);
        float[] pc = Settings.settings.program.pointer.guides.color;
        shapeRenderer.setColor(pc[0], pc[1], pc[2], pc[3]);
        shapeRenderer.line(0, mouseY, rw, mouseY);
        shapeRenderer.line(mouseX, 0, mouseX, rh);
        shapeRenderer.end();
    }
    spriteBatch.begin();
    boolean decal = modeCubemap || modeStereo || modeFisheye || modeVR;
    float chScale = 1f;
    if (modeCubemap) {
        chScale = 4f;
    } else if (modeFisheye) {
        chScale = 2f;
    }
    // Mark home in ORANGE
    if (Settings.settings.scene.crosshair.home) {
        if (home == null && GaiaSky.instance.sceneGraph != null)
            home = GaiaSky.instance.sceneGraph.findFocus(Settings.settings.scene.homeObject);
        if (home != null) {
            drawCrosshair(spriteBatch, home, decal, false, spriteHome, crosshairArrow, chScale, rw, rh, 1f, 0.7f, 0.1f, 1f);
        }
    }
    // Mark closest object in BLUE
    if (Settings.settings.scene.crosshair.closest && closest != null) {
        drawCrosshair(spriteBatch, closest, decal, false, spriteClosest, crosshairArrow, chScale, rw, rh, 0.3f, 0.5f, 1f, 1f);
    }
    // Mark the focus in GREEN
    if (Settings.settings.scene.crosshair.focus && getMode().isFocus()) {
        // Green, focus mode
        drawCrosshair(spriteBatch, focus, decal, true, spriteFocus, crosshairArrow, chScale, rw, rh, 0.2f, 1f, 0.4f, 1f);
    }
    // Gravitational waves crosshair
    if (Settings.settings.runtime.gravitationalWaves) {
        RelativisticEffectsManager gw = RelativisticEffectsManager.getInstance();
        float chw = gravWaveCrosshair.getWidth();
        float chh = gravWaveCrosshair.getHeight();
        float chw2 = chw / 2;
        float chh2 = chh / 2;
        aux1.set(gw.gw).nor().scl(1e12).add(posinv);
        GlobalResources.applyRelativisticAberration(aux1, this);
        // GravitationalWavesManager.instance().gravitationalWavePos(aux1);
        boolean inside = projectToScreen(aux1, auxf1, rw, rh, chw, chh, chw2, chh2);
        if (inside) {
            // Cyan
            spriteBatch.setColor(0, 1, 1, 1);
            spriteBatch.draw(gravWaveCrosshair, auxf1.x - chw2, auxf1.y - chh2, chw, chh);
        }
    }
    spriteBatch.end();
}
Also used : RelativisticEffectsManager(gaiasky.util.gravwaves.RelativisticEffectsManager)

Example 5 with RelativisticEffectsManager

use of gaiasky.util.gravwaves.RelativisticEffectsManager in project gaiasky by langurmonkey.

the class RelativisticEffectsComponent method updateRelativisticEffectsMaterial.

public void updateRelativisticEffectsMaterial(Material material, ICamera camera, float vc) {
    if (material.get(FloatAttribute.Vc) == null) {
        setUpRelativisticEffectsMaterial(material);
    }
    RelativisticEffectsManager rem = RelativisticEffectsManager.getInstance();
    if (vc != -1) {
        // v/c
        ((FloatAttribute) material.get(FloatAttribute.Vc)).value = vc;
    } else {
        // v/c
        ((FloatAttribute) material.get(FloatAttribute.Vc)).value = rem.vc;
    }
    // Velocity direction
    ((Vector3Attribute) material.get(Vector3Attribute.VelDir)).value.set(rem.velDir);
}
Also used : RelativisticEffectsManager(gaiasky.util.gravwaves.RelativisticEffectsManager)

Aggregations

RelativisticEffectsManager (gaiasky.util.gravwaves.RelativisticEffectsManager)5