summaryrefslogtreecommitdiff
path: root/glsl/shader_sprite_3d.frag.glsl
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2023-10-09 14:46:09 -0300
committerFrederico Linhares <fred@linhares.blue>2023-10-09 15:58:14 -0300
commitba447583c74d44c6b07c5409918207157f921efe (patch)
tree56cd1c36a8e77540136c8871eb3b94f0adf37139 /glsl/shader_sprite_3d.frag.glsl
parent8fa221cb60c19638d4ad0833965fee605593eea3 (diff)
feat Render sprite in a 3D position
Diffstat (limited to 'glsl/shader_sprite_3d.frag.glsl')
-rw-r--r--glsl/shader_sprite_3d.frag.glsl42
1 files changed, 42 insertions, 0 deletions
diff --git a/glsl/shader_sprite_3d.frag.glsl b/glsl/shader_sprite_3d.frag.glsl
new file mode 100644
index 0000000..fe823f8
--- /dev/null
+++ b/glsl/shader_sprite_3d.frag.glsl
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022-2023 Frederico de Oliveira Linhares
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#version 450
+#extension GL_ARB_separate_shader_objects : enable
+
+struct DataTransferObject
+{
+ vec4 frag_color;
+ vec2 frag_texture_coord;
+};
+
+layout(location = 0) in DataTransferObject in_dto;
+
+layout(location = 0) out vec4 out_color;
+
+layout(set = 0, binding = 1) uniform UBOWorld
+{
+ vec3 directional_light_direction;
+ vec4 directional_light_color;
+} ubo_world;
+
+layout(set = 2, binding = 1) uniform sampler2D texture_sampler;
+
+void
+main()
+{
+ out_color = texture(texture_sampler, in_dto.frag_texture_coord);
+}