Search in sources :

Example 1 with ILineRenderable

use of gaiasky.render.ILineRenderable in project gaiasky by langurmonkey.

the class LineQuadRenderSystem method renderStud.

@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
    this.camera = camera;
    // Reset
    meshIdx = 1;
    currExt = (MeshDataExt) meshes.get(0);
    curr = currExt;
    renderables.forEach(r -> {
        ILineRenderable renderable = (ILineRenderable) r;
        renderable.render(this, camera, getAlpha(renderable));
    });
    // Sort phase
    provisionalLines.sort(sorter);
    for (double[] l : provisionalLines) addLinePostproc(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7], l[8], l[9], l[10], l[11], l[13]);
    for (Line l : provLines) addLinePostproc(l);
    ExtShaderProgram shaderProgram = getShaderProgram();
    shaderProgram.begin();
    shaderProgram.setUniformMatrix("u_projView", camera.getCamera().combined);
    // Rel, grav, z-buffer
    addEffectsUniforms(shaderProgram, camera);
    for (int i = 0; i < meshIdx; i++) {
        MeshDataExt md = (MeshDataExt) meshes.get(i);
        md.mesh.setVertices(md.vertices, 0, md.vertexIdx);
        md.mesh.setIndices(md.indices, 0, md.indexIdx);
        md.mesh.render(shaderProgram, GL20.GL_TRIANGLES);
        md.clear();
    }
    shaderProgram.end();
    // Reset mesh index and current
    int n = provisionalLines.size;
    for (int i = 0; i < n; i++) doublePool.free(provisionalLines.get(i));
    provisionalLines.clear();
    provLines.clear();
}
Also used : ILineRenderable(gaiasky.render.ILineRenderable) ExtShaderProgram(gaiasky.util.gdx.shader.ExtShaderProgram)

Example 2 with ILineRenderable

use of gaiasky.render.ILineRenderable in project gaiasky by langurmonkey.

the class LineRenderSystem method renderStud.

@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
    shaderProgram = getShaderProgram();
    shaderProgram.begin();
    shaderProgram.setUniformMatrix("u_projView", camera.getCamera().combined);
    shaderProgram.setUniformf("u_alpha", 1f);
    // Rel, grav, z-buffer
    addEffectsUniforms(shaderProgram, camera);
    this.camera = camera;
    renderables.forEach(r -> {
        ILineRenderable renderable = (ILineRenderable) r;
        renderable.render(this, camera, getAlpha(renderable));
        Gdx.gl.glLineWidth(renderable.getLineWidth() * 1.5f * Settings.settings.scene.lineWidth);
        for (int md = 0; md < meshIdx; md++) {
            MeshData meshDouble = meshes.get(md);
            meshDouble.mesh.setVertices(meshDouble.vertices, 0, meshDouble.vertexIdx);
            meshDouble.mesh.render(shaderProgram, renderable.getGlPrimitive());
            meshDouble.clear();
        }
    });
    shaderProgram.end();
    // Reset indices
    meshIdx = 1;
    curr = meshes.get(0);
}
Also used : ILineRenderable(gaiasky.render.ILineRenderable)

Aggregations

ILineRenderable (gaiasky.render.ILineRenderable)2 ExtShaderProgram (gaiasky.util.gdx.shader.ExtShaderProgram)1