Kaynağa Gözat

Add another triangle for occlusion

master
Brian Ho 5 yıl önce
ebeveyn
işleme
68997382e3
3 değiştirilmiş dosya ile 24 ekleme ve 7 silme
  1. 1
    1
      occlusion.cc
  2. 3
    1
      occlusion.frag
  3. 20
    5
      occlusion.vert

+ 1
- 1
occlusion.cc Dosyayı Görüntüle

@@ -556,7 +556,7 @@ void Draw(VkDevice device, VkQueue queue, VkRenderPass render_pass, VkPipeline p
vkCmdBeginRenderPass(command_buffer, &render_pass_begin_info, VK_SUBPASS_CONTENTS_INLINE);

vkCmdBindPipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
vkCmdDraw(command_buffer, 3, 1, 0, 0);
vkCmdDraw(command_buffer, 6, 1, 0, 0);
vkCmdEndRenderPass(command_buffer);
EndQuery(command_buffer, query_pool);
}

+ 3
- 1
occlusion.frag Dosyayı Görüntüle

@@ -1,7 +1,9 @@
#version 450

layout(location = 0) in vec3 fragColor;

layout(location = 0) out vec4 outColor;

void main() {
outColor = vec4(1.0, 0.0, 0.0, 1.0);
outColor = vec4(fragColor, 1.0);
}

+ 20
- 5
occlusion.vert Dosyayı Görüntüle

@@ -1,11 +1,26 @@
#version 450

vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
layout(location = 0) out vec3 fragColor;

vec3 positions[6] = vec3[](
vec3(0.5, -0.5, 1.0),
vec3(0.5, 0.5, 1.0),
vec3(-0.5, 0.5, 1.0),
vec3(-0.5, -0.5, 0.0),
vec3(0.5, 0.5, 0.0),
vec3(-0.5, 0.5, 0.0)
);

vec3 colors[6] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(1.0, 0.0, 0.0),
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 1.0, 0.0)
);

void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
gl_Position = vec4(positions[gl_VertexIndex], 1.0);
fragColor = colors[gl_VertexIndex];
}

Loading…
İptal
Kaydet