use of com.chrisali.javaflightsim.lwjgl.particles.Particle in project j6dof-flight-sim by chris-ali.
the class ParticleRenderer method render.
public void render(Map<ParticleTexture, List<Particle>> particles, Camera camera) {
Matrix4f viewMatrix = RenderingUtilities.createViewMatrix(camera);
prepare();
shader.loadSkyColor(MasterRenderer.getSkyColor().x, MasterRenderer.getSkyColor().y, MasterRenderer.getSkyColor().z);
shader.loadFog(MasterRenderer.getFogDensity(), MasterRenderer.getFogGradient());
for (ParticleTexture texture : particles.keySet()) {
bindTexture(texture);
List<Particle> particleList = particles.get(texture);
pointer = 0;
float[] vboData = new float[particleList.size() * INSTANCE_DATA_LENGTH];
for (Particle particle : particles.get(texture)) {
// Subtracts out the camera roll to prevent clouds/particles rolling with the camera
updateModelViewMatrix(particle.getPosition(), particle.getRotation() - camera.getRoll(), particle.getScale(), viewMatrix, vboData);
updateTextureCoordinateInfo(particle, vboData);
}
loader.updateVBO(vbo, vboData, buffer);
GL31.glDrawArraysInstanced(GL11.GL_TRIANGLE_STRIP, 0, quad.getVertexCount(), particleList.size());
}
finishRendering();
}
Aggregations