adding and integrating ImGuizmo
This commit is contained in:
@@ -173,6 +173,7 @@ class Application::Impl {
|
||||
const SceneView& view = sceneViewRegistry.peek(handle);
|
||||
bool toSwapchain = !view.target.isValid();
|
||||
if (!sceneRegistry.isAlive(view.scene) ||
|
||||
!sceneRegistry.get(view.scene).isVisible() ||
|
||||
(!toSwapchain && !renderTargetPool.isAlive(view.target))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,15 @@ Mesh::getAttributeDescriptions() {
|
||||
}
|
||||
|
||||
Mesh::Mesh(Device& device, const MeshData& data) : device{device} {
|
||||
if (!data.vertices.empty()) {
|
||||
this->bounds = {data.vertices.front().position,
|
||||
data.vertices.front().position};
|
||||
for (const MeshVertex& vertex : data.vertices) {
|
||||
this->bounds.min = glm::min(this->bounds.min, vertex.position);
|
||||
this->bounds.max = glm::max(this->bounds.max, vertex.position);
|
||||
}
|
||||
}
|
||||
|
||||
createVertexBuffers(data.vertices);
|
||||
createIndexBuffers(data.indices);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <sophia/aabb.hpp>
|
||||
#include <sophia/handles.hpp>
|
||||
#include <sophia/math.hpp>
|
||||
#include <sophia/mesh_data.hpp>
|
||||
@@ -26,6 +27,9 @@ class Mesh {
|
||||
Mesh(const Mesh&) = delete;
|
||||
Mesh& operator=(const Mesh&) = delete;
|
||||
|
||||
// Bounds of the vertices, in the mesh's own space.
|
||||
const AABB& getBounds() const { return this->bounds; }
|
||||
|
||||
void bind(vk::CommandBuffer commandBuffer) const;
|
||||
void draw(vk::CommandBuffer commandBuffer, u32 instanceCount = 1,
|
||||
u32 firstInstance = 0) const;
|
||||
@@ -36,6 +40,8 @@ class Mesh {
|
||||
|
||||
Device& device;
|
||||
|
||||
AABB bounds;
|
||||
|
||||
std::unique_ptr<Buffer> vertexBuffer;
|
||||
u32 vertexCount;
|
||||
|
||||
|
||||
@@ -86,6 +86,14 @@ glm::vec2 ResourceRegistryRef::getExtent(RenderTargetHandle handle) const {
|
||||
return {static_cast<float>(extent.width), static_cast<float>(extent.height)};
|
||||
}
|
||||
|
||||
AABB ResourceRegistryRef::getBounds(MeshHandle handle) const {
|
||||
return registry->meshPool.get(handle).getBounds();
|
||||
}
|
||||
|
||||
bool ResourceRegistryRef::isAlive(MeshHandle handle) const {
|
||||
return registry->meshPool.isAlive(handle);
|
||||
}
|
||||
|
||||
bool ResourceRegistryRef::isAlive(RenderTargetHandle handle) const {
|
||||
return registry->renderTargetPool.isAlive(handle);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,9 @@ void Panel::draw(const FrameInfo& frameInfo) {
|
||||
}
|
||||
|
||||
bool open = true;
|
||||
ImGui::Begin(config.name.c_str(), config.hasCloseButton() ? &open : nullptr,
|
||||
config.getWindowFlags());
|
||||
this->shown = ImGui::Begin(config.name.c_str(),
|
||||
config.hasCloseButton() ? &open : nullptr,
|
||||
config.getWindowFlags());
|
||||
onUpdate(frameInfo);
|
||||
ImGui::End();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user