#version 450

layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inColor;

layout(location = 0) out vec3 fragColor;

layout(binding = 0) uniform UniformBufferObject {
    mat4 proj;
    mat4 model;
    mat4 view;
} ubo;

layout(push_constant) uniform PushConstants {
    float myValue;
} pushConstants;

void main() {
    // 预计算MVP矩阵以减少乘法次数
    //mat4 mvp = ubo.proj * ubo.view * ubo.model;
    //vec3 pos = vec3(2.0, inPosition.y, inPosition.z);
    //gl_Position = mvp * vec4(inPosition, 1.0);

    vec2 position = vec2(inPosition.xy*2 -1);
    //gl_Position = vec4(inPosition.xy*2 -1, 0.5, 1.0);
    position = position * pushConstants.myValue;
    gl_Position = vec4(position, 0.5, 1.0);

    fragColor = inColor;
    gl_PointSize = 2.0;
}