From 56cd6521cb1e5ea9a1546551e918f622f02e37c4 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 28 May 2019 15:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84shader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- res/shader/FlatColor3D.vert | 18 ++++++++++++++++++ res/shader/OnlyPosition3D.vert | 12 ++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 res/shader/FlatColor3D.vert diff --git a/res/shader/FlatColor3D.vert b/res/shader/FlatColor3D.vert new file mode 100644 index 00000000..33d624dc --- /dev/null +++ b/res/shader/FlatColor3D.vert @@ -0,0 +1,18 @@ +#version 450 core + +layout(location = 0) in vec3 Vertex; +layout(location = 1) in vec3 Color; + +layout(binding = 0) uniform WorldConfig +{ + mat4 mvp; +} world; + +layout(location = 0) out vec4 FragmentColor; + +void main() +{ + FragmentColor=vec4(Color,1.0); + + gl_Position=vec4(Vertex,1.0)*world.mvp; +} diff --git a/res/shader/OnlyPosition3D.vert b/res/shader/OnlyPosition3D.vert index 1e24f3ed..d0946938 100644 --- a/res/shader/OnlyPosition3D.vert +++ b/res/shader/OnlyPosition3D.vert @@ -1,17 +1,25 @@ -#version 450 core +#version 450 core layout(location = 0) in vec3 Vertex; +layout(location = 1) in vec3 Normal; layout(binding = 0) uniform WorldConfig { mat4 mvp; } world; +layout(push_constant) uniform SkyLightConsts { + vec4 sun_color; + vec4 sun_direction; +} skylight; + layout(location = 0) out vec4 FragmentColor; +layout(location = 1) out vec3 FragmentNormal; void main() { - FragmentColor=vec4(1.0); + FragmentColor=vec4(Color,1.0); + FragmentNormal=Normal; gl_Position=vec4(Vertex,1.0)*world.mvp; }