use of org.terasology.engine.rendering.cameras.PerspectiveCamera in project Terasology by MovingBlocks.
the class SpriteParticleRenderer method renderAlphaBlend.
@Override
public void renderAlphaBlend() {
if (!opengl33) {
return;
}
PerspectiveCamera camera = (PerspectiveCamera) worldRenderer.getActiveCamera();
Vector3f cameraPosition = camera.getPosition();
Matrix4f viewProjection = new Matrix4f(camera.getViewProjectionMatrix()).translate(-cameraPosition.x, -cameraPosition.y, -cameraPosition.z);
Material material = Assets.getMaterial(PARTICLE_MATERIAL_URI).get();
material.enable();
material.setFloat3("camera_position", cameraPosition.x, cameraPosition.y, cameraPosition.z);
material.setMatrix4("view_projection", viewProjection.get(matrixBuffer));
particleSystemManager.getParticleEmittersByDataComponent(ParticleDataSpriteComponent.class).forEach(particleSystem -> drawParticles(material, particleSystem));
}
Aggregations