#version 330 core
in float distance, pitch, yaw;
in float reflectivity;

uniform float dis_unit;
uniform float point_size;

uniform mat4 mvp;

out float intensity;

void main(void)
{
    const float angle_factor = 2 * 3.1415926535897932384626433832795 / 36000.0;
    float dist = distance * dis_unit;
    float phi = pitch * angle_factor;
    float z = dist * sin(phi);
    float r = dist * cos(phi);
    float theta = yaw * angle_factor;
    float x = r * sin(theta);
    float y = r * cos(theta);
    
    gl_Position = mvp * vec4(x,y,z, 1.0);
    intensity = reflectivity / 256.0;
    gl_PointSize = point_size;
}