Implementing a “move to instance” function
As the first change for the “move to instance” functionality, we will add a small set of coordinate arrows appearing at the origin of the drawn model to identify the currently selected instance. We will also add a button to center the currently selected instance. Let’s start with the implementation of the coordinate arrows.
Adding coordinate arrows
Since we will use lines instead of triangles to draw coordinate arrows at the center of the selected instance, we need some extra data structures, objects and shaders. To store the vertex and color data, we add two new structs to the declarations in the file OGLRenderData.h
in the opengl
folder:
struct OGLLineVertex {
glm::vec3 position = glm::vec3(0.0f);
glm::vec3 color = glm::vec3(0.0f);
};
struct OGLLineMesh {
std::vector<OGLLineVertex> vertices{};
};
For Vulkan, the new structs are named VkLineVertex
and VkLineMesh
, residing in...