use of gaiasky.util.gdx.shader.ExtShaderProgram in project gaiasky by langurmonkey.
the class PointCloudRenderSystem method renderStud.
@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
if (renderables.size > 0) {
ExtShaderProgram shaderProgram = getShaderProgram();
shaderProgram.begin();
// Pre-render
preRenderObjects(shaderProgram, camera);
// Render
renderables.forEach((r) -> renderObject(shaderProgram, r));
// Post-render
postRenderObjects(shaderProgram, camera);
shaderProgram.end();
}
}
use of gaiasky.util.gdx.shader.ExtShaderProgram in project gaiasky by langurmonkey.
the class PointRenderSystem method renderStud.
@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
this.camera = camera;
ExtShaderProgram shaderProgram = getShaderProgram();
shaderProgram.begin();
shaderProgram.setUniformMatrix("u_projView", camera.getCamera().combined);
addEffectsUniforms(shaderProgram, camera);
renderables.forEach(r -> {
IPointRenderable renderable = (IPointRenderable) r;
renderable.render(this, camera, getAlpha(renderable));
renderable.blend();
renderable.depth();
for (int md = 0; md < meshIdx; md++) {
MeshData meshd = meshes.get(md);
meshd.mesh.setVertices(meshd.vertices, 0, meshd.vertexIdx);
meshd.mesh.render(shaderProgram, glType);
meshd.clear();
}
});
shaderProgram.end();
// Reset indices
meshIdx = 1;
curr = meshes.get(0);
}
use of gaiasky.util.gdx.shader.ExtShaderProgram in project gaiasky by langurmonkey.
the class BillboardSpriteRenderSystem method renderStud.
@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
if ((ctIndex < 0 || alphas[ctIndex] != 0)) {
renderables.sort(comp);
ExtShaderProgram shaderProgram = getShaderProgram();
shaderProgram.begin();
// Global uniforms
shaderProgram.setUniformMatrix("u_projView", camera.getCamera().combined);
shaderProgram.setUniformf("u_time", (float) t);
// Rel, grav, z-buffer
addEffectsUniforms(shaderProgram, camera);
// Render each sprite
renderables.forEach(r -> {
IQuadRenderable s = (IQuadRenderable) r;
s.render(shaderProgram, getAlpha(s), mesh, camera);
});
shaderProgram.end();
}
}
use of gaiasky.util.gdx.shader.ExtShaderProgram in project gaiasky by langurmonkey.
the class BillboardStarRenderSystem method renderStud.
@Override
public void renderStud(Array<IRenderable> renderables, ICamera camera, double t) {
if ((ctIndex < 0 || alphas[ctIndex] != 0)) {
renderables.sort(comp);
ExtShaderProgram shaderProgram = getShaderProgram();
shaderProgram.begin();
if (texture0 != null) {
texture0.bind(0);
shaderProgram.setUniformi("u_texture0", 0);
}
// General uniforms
shaderProgram.setUniformMatrix("u_projView", camera.getCamera().combined);
// Rel, grav, z-buffer
addEffectsUniforms(shaderProgram, camera);
// Global uniforms
shaderProgram.setUniformf("u_time", (float) t);
renderables.forEach(r -> {
IQuadRenderable s = (IQuadRenderable) r;
s.render(shaderProgram, getAlpha(s), mesh, camera);
});
shaderProgram.end();
}
}
use of gaiasky.util.gdx.shader.ExtShaderProgram 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();
}
Aggregations