放弃画3d

This commit is contained in:
xsl
2025-09-18 11:39:31 +08:00
parent 6a5b5d9d5d
commit 2026c41a23
+32 -14
View File
@@ -23,7 +23,7 @@
TextureLoading::TextureLoading()
{
zoom = -2.5f;
zoom = -1.f;
rotation = { 0.0f, 15.0f, 0.0f };
title = "Texture loading";
this_instance = this;
@@ -99,7 +99,7 @@ std::vector<uint8_t> generateSimpleTestImage(int width, int height, int* outRowS
if (x < width / 3)
{
// 红色区域
imageData[pixelOffset] = 255; // R
imageData[pixelOffset] = 2; // R
imageData[pixelOffset + 1] = 0; // G
imageData[pixelOffset + 2] = 0; // B
}
@@ -107,7 +107,7 @@ std::vector<uint8_t> generateSimpleTestImage(int width, int height, int* outRowS
{
// 绿色区域
imageData[pixelOffset] = 0; // R
imageData[pixelOffset + 1] = 255; // G
imageData[pixelOffset + 1] = 2; // G
imageData[pixelOffset + 2] = 0; // B
}
else
@@ -115,7 +115,7 @@ std::vector<uint8_t> generateSimpleTestImage(int width, int height, int* outRowS
// 蓝色区域
imageData[pixelOffset] = 0; // R
imageData[pixelOffset + 1] = 0; // G
imageData[pixelOffset + 2] = 255; // B
imageData[pixelOffset + 2] = 2; // B
}
imageData[pixelOffset + 3] = 255; // A (完全不透明)
@@ -511,9 +511,9 @@ void TextureLoading::build_command_buffers()
vkCmdDrawIndexed(draw_cmd_buffers[i], index_count, 1, 0, 0, 0);
//draw_point_cloud(draw_cmd_buffers[i]);
draw_point_cloud(draw_cmd_buffers[i]);
draw_ui(draw_cmd_buffers[i]);
//draw_ui(draw_cmd_buffers[i]);
vkCmdEndRenderPass(draw_cmd_buffers[i]);
@@ -546,12 +546,18 @@ void TextureLoading::draw()
void TextureLoading::generate_quad()
{
// Setup vertices for a single uv-mapped quad made from two triangles
//std::vector<TextureLoadingVertexStructure> vertices =
//{
// {{1.0f, 1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
// {{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
// {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}},
// {{1.0f, -1.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}} };
std::vector<TextureLoadingVertexStructure> vertices =
{
{{1.0f, 1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
{{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
{{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}},
{{1.0f, -1.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}} };
{{0.3f, 0.3f, 0.0f}, {1.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
{{-0.3f, 0.3f, 0.0f}, {0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}},
{{-0.3f, -0.3f, 0.0f}, {0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}},
{{0.3f, -0.3f, 0.0f}, {1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}} };
// Setup indices
std::vector<uint32_t> indices = { 0, 1, 2, 2, 3, 0 };
@@ -943,8 +949,20 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options)
prepare_point_pipeline();
setup_point_descriptor_set();
float z = 0.1;
//build_command_buffers();
float simPoint[] = {
1.0, 1.0, z,
-1.0, 1.0, z,
-1.0, -1.0, z,
1.0, -1.0, z,
0.8, 0.8, z,
-0.8, 0.8, z,
-0.8, -0.8, z,
0.8, -0.8, z,
};
build_command_buffers();
update_point_vertex_buffer(simPoint, 8);
prepared = true;
//start();
@@ -1450,9 +1468,9 @@ void TextureLoading::prepare_point_pipeline()
// 深度和模板测试 (通常对点云启用深度测试)
VkPipelineDepthStencilStateCreateInfo depth_stencil_state{ VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
depth_stencil_state.depthTestEnable = VK_TRUE;
depth_stencil_state.depthWriteEnable = VK_TRUE;
depth_stencil_state.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL; // 或 VK_COMPARE_OP_LESS
depth_stencil_state.depthTestEnable = VK_FALSE;
depth_stencil_state.depthWriteEnable = VK_FALSE;
depth_stencil_state.depthCompareOp = VK_COMPARE_OP_ALWAYS; // 或 VK_COMPARE_OP_LESS
depth_stencil_state.depthBoundsTestEnable = VK_FALSE;
depth_stencil_state.stencilTestEnable = VK_FALSE;