save code
This commit is contained in:
@@ -573,7 +573,7 @@ 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_point_cloud_line(draw_cmd_buffers[i]);
|
||||
|
||||
//draw_ui(draw_cmd_buffers[i]);
|
||||
@@ -1336,7 +1336,7 @@ void TextureLoading::prepare_pipeline_point_line()
|
||||
|
||||
// 输入装配 (绘制点列表)
|
||||
VkPipelineInputAssemblyStateCreateInfo input_assembly_state{ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
|
||||
input_assembly_state.topology = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;// VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
input_assembly_state.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
input_assembly_state.primitiveRestartEnable = VK_FALSE;
|
||||
|
||||
// 光栅化
|
||||
@@ -1383,8 +1383,8 @@ void TextureLoading::prepare_pipeline_point_line()
|
||||
std::array<VkPipelineShaderStageCreateInfo, 2> shader_stages;
|
||||
//shader_stages[0] = load_shader("texture_loading", "point_line.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||
//shader_stages[1] = load_shader("texture_loading", "point_line.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||
shader_stages[0] = load_shader("texture_loading", "point_line_solid.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||
shader_stages[1] = load_shader("texture_loading", "point_line_solid.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||
shader_stages[0] = load_shader("texture_loading", "point_line.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||
shader_stages[1] = load_shader("texture_loading", "point_line.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||
|
||||
// 创建图形管线
|
||||
VkGraphicsPipelineCreateInfo pipeline_create_info{ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO };
|
||||
@@ -2000,7 +2000,8 @@ void add_point(float* src, float* dest, int index)
|
||||
void TextureLoading::demo1(float* pos)
|
||||
{
|
||||
point_index = 0;
|
||||
std::vector<int> pointIndex= { 233,232,231,230,229,118,36,49,209,217,188,233};
|
||||
//std::vector<int> pointIndex= { 233,232,231,230,229,118,36,49,209,217,188,233};
|
||||
std::vector<int> pointIndex = { 389,368,383,353,342,467,263,466,388,387,386,385,384,398,463,464,465,351,6,122,245,244,243,173,157,158,159,160,161,246,33,247,113,124,156,139,162,21,54,103,67,109,10,338,297,332,284,251,389 };
|
||||
float points[100 * 3];
|
||||
for (int i = 0; i < pointIndex.size(); ++i)
|
||||
{
|
||||
@@ -2059,14 +2060,13 @@ void TextureLoading::update_point_vertex_buffer_line(float* pos, int count, floa
|
||||
return; // 没有点数据,无需更新
|
||||
}
|
||||
|
||||
point_count_line = count;
|
||||
|
||||
glm::vec3 color = { r,g,b };
|
||||
|
||||
// 1. 准备顶点数据
|
||||
std::vector<LineVertex> vertices;
|
||||
|
||||
for (int i = 0; i < point_count_line - 1; ++i)
|
||||
for (int i = 0; i < count - 1; ++i)
|
||||
{
|
||||
|
||||
const glm::vec3& start = {pos[i*3], pos[i * 3+1], pos[i * 3+2] };
|
||||
@@ -2089,6 +2089,8 @@ void TextureLoading::update_point_vertex_buffer_line(float* pos, int count, floa
|
||||
});
|
||||
}
|
||||
|
||||
point_count_line = vertices.size();
|
||||
|
||||
// 2. 更新或创建顶点缓冲区
|
||||
VkDeviceSize buffer_size = sizeof(LineVertex) * point_count_line;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user