Commit a0f5455a authored by Johannes Braun's avatar Johannes Braun
Browse files

Alter existing line instead of creating a new one.

parent 27d47ca9
......@@ -47,7 +47,7 @@ namespace glare
//Create a skybox from cube map.
m_skybox = std::make_shared<core::Skybox>(core::Skybox::collectFilesFrom(core::asset("/textures/ryfjallet/")));
initializeScene(core::asset("/meshes/scenery/cube.dae"), 1.f);
initializeScene(core::asset("/meshes/scenery/bunny.dae"), 1.f);
initializeRenderRequirements();
initializeAdvanced();
initializeGUI();
......
......@@ -51,7 +51,6 @@ namespace glare
const advanced::LocalBVH &line_bvh = static_cast<const advanced::LocalBVH&>(collector.datastructure());
core::ClockMS clock;
Line line;
size_t index = 0;
......@@ -71,30 +70,27 @@ namespace glare
//For all start patches...
for (begin.index_horizontal = 0; begin.index_horizontal < face_widths[unsigned(begin.face) % 3]; ++begin.index_horizontal)
for (begin.index_vertical = 0; begin.index_vertical < face_heights[unsigned(begin.face) % 3]; ++begin.index_vertical)
for (begin.index_vertical = 0; begin.index_vertical < face_heights[unsigned(begin.face) % 3]; ++begin.index_vertical)
{
//... and all end patches...
for (end.index_horizontal = 0; end.index_horizontal < face_widths[unsigned(end.face) % 3]; ++end.index_horizontal)
for (end.index_vertical = 0; end.index_vertical < face_heights[unsigned(end.face) % 3]; ++end.index_vertical)
{
//... and all end patches...
for (end.index_horizontal = 0; end.index_horizontal < face_widths[unsigned(end.face) % 3]; ++end.index_horizontal)
for (end.index_vertical = 0; end.index_vertical < face_heights[unsigned(end.face) % 3]; ++end.index_vertical)
{
//... do a center line check.
glm::vec4 center_begin(patchCenter(begin), 1);
glm::vec4 center_end(patchCenter(end), 1);
math::Ray ray;
ray.direction = glm::normalize(center_end - center_begin).xyz;
ray.origin = center_begin.xyz;
//... do a center line check.
glm::vec4 center_begin(patchCenter(begin), 1);
glm::vec4 center_end(patchCenter(end), 1);
line.nearest.barycentric = glm::vec2(-1);
line.farthest.barycentric = glm::vec2(-1);
math::Ray ray;
ray.direction = glm::normalize(center_end - center_begin).xyz;
ray.origin = center_begin.xyz;
line_bvh.nearestAndFarthestIntersection(ray, line.nearest, line.farthest);
Line &line = m_lines[lineIndex(begin, end)];
//Direct index determination instead of incremental.
m_lines[lineIndex(begin, end)] = line;
}
line.nearest.barycentric = glm::vec2(-1);
line.farthest.barycentric = glm::vec2(-1);
line_bvh.nearestAndFarthestIntersection(ray, line.nearest, line.farthest);
}
}
}
m_line_buffer.setData(m_lines, gl::BufferUsage::eDynamicRead);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment