Skip to content

Instantly share code, notes, and snippets.

@bynmz
Created March 29, 2024 07:23
Show Gist options
  • Save bynmz/4b52af0f38d3adb532433aded186b32e to your computer and use it in GitHub Desktop.
Save bynmz/4b52af0f38d3adb532433aded186b32e to your computer and use it in GitHub Desktop.
#version 450
layout(location = 0) in vec3 position;
layout(location = 0) out vec4 outPos;
struct PointLight {
vec4 position; // ignore w
vec4 color; // w is intensity
};
layout(set = 0, binding = 0) uniform GlobalUbo {
mat4 projection;
mat4 view;
mat4 invView;
vec4 ambientLightColor; // w is intensity
PointLight pointLights[10];
int numLights;
} ubo;
layout(set = 1, binding = 0) uniform GameObjectBufferData {
mat4 modelMatrix;
} gameObject;
void main() {
vec4 positionWorld = gameObject.modelMatrix * vec4(position.x, position.y, position.z, 1.0);
outPos = ubo.projection * ubo.view * positionWorld;
gl_Position = outPos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment