Search in sources :

Example 1 with Vector3Attribute

use of gaiasky.util.gdx.shader.attribute.Vector3Attribute in project gaiasky by langurmonkey.

the class RelativisticEffectsComponent method setUpRelativisticEffectsMaterial.

public void setUpRelativisticEffectsMaterial(Material mat) {
    mat.set(new FloatAttribute(FloatAttribute.Vc, 0f));
    mat.set(new Vector3Attribute(Vector3Attribute.VelDir, new Vector3()));
}
Also used : Vector3Attribute(gaiasky.util.gdx.shader.attribute.Vector3Attribute) Vector3(com.badlogic.gdx.math.Vector3) FloatAttribute(gaiasky.util.gdx.shader.attribute.FloatAttribute)

Example 2 with Vector3Attribute

use of gaiasky.util.gdx.shader.attribute.Vector3Attribute in project gaiasky by langurmonkey.

the class VelocityBufferComponent method setUpVelocityBufferMaterial.

public void setUpVelocityBufferMaterial(Material mat) {
    mat.set(new Matrix4Attribute(Matrix4Attribute.PrevProjView, new Matrix4()));
    mat.set(new Vector3Attribute(Vector3Attribute.DCamPos, new Vector3()));
}
Also used : Vector3Attribute(gaiasky.util.gdx.shader.attribute.Vector3Attribute) Matrix4Attribute(gaiasky.util.gdx.shader.attribute.Matrix4Attribute) Vector3(com.badlogic.gdx.math.Vector3) Matrix4(com.badlogic.gdx.math.Matrix4)

Example 3 with Vector3Attribute

use of gaiasky.util.gdx.shader.attribute.Vector3Attribute in project gaiasky by langurmonkey.

the class AtmosphereComponent method setUpAtmosphericScatteringMaterial.

/**
 * Sets up the atmospheric scattering parameters to the given material
 *
 * @param mat The material to set up.
 */
public void setUpAtmosphericScatteringMaterial(Material mat) {
    float camHeight = 1f;
    float m_Kr4PI = m_Kr * 4.0f * (float) Math.PI;
    float m_Km4PI = m_Km * 4.0f * (float) Math.PI;
    // Sun brightness (almost) constant
    float m_ESun = m_eSun;
    // The Mie phase asymmetry factor
    float m_g = 0.97f;
    m_fInnerRadius = planetSize / 2f;
    m_fOuterRadius = this.size;
    m_fAtmosphereHeight = m_fOuterRadius - m_fInnerRadius;
    float m_fScaleDepth = .20f;
    float m_fScale = 1.0f / (m_fAtmosphereHeight);
    float m_fScaleOverScaleDepth = m_fScale / m_fScaleDepth;
    int m_nSamples = 11;
    double[] m_fWavelength = wavelengths;
    float[] m_fWavelength4 = new float[3];
    m_fWavelength4[0] = (float) Math.pow(m_fWavelength[0], 4.0);
    m_fWavelength4[1] = (float) Math.pow(m_fWavelength[1], 4.0);
    m_fWavelength4[2] = (float) Math.pow(m_fWavelength[2], 4.0);
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.Alpha, 1f));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.ColorOpacity, 1f));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.CameraHeight, camHeight));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.OuterRadius, m_fOuterRadius));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.InnerRadius, m_fInnerRadius));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.KrESun, m_Kr * m_ESun));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.KmESun, m_Km * m_ESun));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.Kr4PI, m_Kr4PI));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.Km4PI, m_Km4PI));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.Scale, m_fScale));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.ScaleDepth, m_fScaleDepth));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.ScaleOverScaleDepth, m_fScaleOverScaleDepth));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.nSamples, m_nSamples));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.FogDensity, fogDensity));
    mat.set(new Vector3Attribute(Vector3Attribute.FogColor, fogColor));
    mat.set(new AtmosphereAttribute(AtmosphereAttribute.G, m_g));
    mat.set(new Vector3Attribute(Vector3Attribute.PlanetPos, new Vector3()));
    mat.set(new Vector3Attribute(Vector3Attribute.CameraPos, new Vector3()));
    mat.set(new Vector3Attribute(Vector3Attribute.LightPos, new Vector3()));
    mat.set(new Vector3Attribute(Vector3Attribute.InvWavelength, new Vector3(1.0f / m_fWavelength4[0], 1.0f / m_fWavelength4[1], 1.0f / m_fWavelength4[2])));
}
Also used : Vector3Attribute(gaiasky.util.gdx.shader.attribute.Vector3Attribute) Vector3(com.badlogic.gdx.math.Vector3) AtmosphereAttribute(gaiasky.util.gdx.shader.attribute.AtmosphereAttribute)

Example 4 with Vector3Attribute

use of gaiasky.util.gdx.shader.attribute.Vector3Attribute in project gaiasky by langurmonkey.

the class VelocityBufferComponent method updateVelocityBufferMaterial.

public void updateVelocityBufferMaterial(Material material, ICamera cam) {
    if (material.get(Matrix4Attribute.PrevProjView) == null) {
        setUpVelocityBufferMaterial(material);
    }
    // Previous projection view matrix
    ((Matrix4Attribute) material.get(Matrix4Attribute.PrevProjView)).value.set(cam.getPreviousProjView());
    // Camera position difference
    Vector3 dCamPos = ((Vector3Attribute) material.get(Vector3Attribute.DCamPos)).value;
    Vector3b dp = cam.getPreviousPos();
    Vector3b p = cam.getPos();
    dCamPos.set(dp.x.subtract(p.x).floatValue(), dp.y.subtract(p.y).floatValue(), dp.z.subtract(p.z).floatValue());
}
Also used : Vector3Attribute(gaiasky.util.gdx.shader.attribute.Vector3Attribute) Vector3b(gaiasky.util.math.Vector3b) Vector3(com.badlogic.gdx.math.Vector3)

Aggregations

Vector3 (com.badlogic.gdx.math.Vector3)4 Vector3Attribute (gaiasky.util.gdx.shader.attribute.Vector3Attribute)4 Matrix4 (com.badlogic.gdx.math.Matrix4)1 AtmosphereAttribute (gaiasky.util.gdx.shader.attribute.AtmosphereAttribute)1 FloatAttribute (gaiasky.util.gdx.shader.attribute.FloatAttribute)1 Matrix4Attribute (gaiasky.util.gdx.shader.attribute.Matrix4Attribute)1 Vector3b (gaiasky.util.math.Vector3b)1