Add handling for camera intrinsics
This commit is contained in:
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const Math::CameraIntrinsicWithResolution FALLBACK_INTRINSICS;
|
||||
}
|
||||
|
||||
ArBackgroundDrawable::ArBackgroundDrawable(const Ptr<AR::ArSession>& arSession)
|
||||
: Drawable(DrawEncoder::GetDrawEncoder<ArBackgroundDrawable>(), DrawPhase::BACKGROUND)
|
||||
, m_arSession(arSession)
|
||||
@@ -18,9 +23,11 @@ namespace OpenVulkano::Scene
|
||||
m_shader.topology = Topology::TRIANGLE_STRIP;
|
||||
m_shader.AddShaderProgram(ShaderProgramType::VERTEX, "Shader/background");
|
||||
m_shader.AddShaderProgram(ShaderProgramType::FRAGMENT, "Shader/background");
|
||||
//m_shader.AddDescriptorSetLayoutBinding(DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_shader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
m_shader.AddDescriptorSetLayoutBinding(Texture::DESCRIPTOR_SET_LAYOUT_BINDING);
|
||||
SetShader(&m_shader);
|
||||
m_intrinsicsBuffer.Init(sizeof(Math::CameraIntrinsicWithResolution), &FALLBACK_INTRINSICS);
|
||||
m_intrinsicsBuffer.updateFrequency = UpdateFrequency::Always;
|
||||
if (m_arSession)
|
||||
m_arSession->OnNewFrame += EventHandler(this, &ArBackgroundDrawable::OnNewArFrame);
|
||||
}
|
||||
@@ -57,8 +64,10 @@ namespace OpenVulkano::Scene
|
||||
m_lastFrame = std::move(m_currentFrame);
|
||||
m_currentFrame = std::move(m_nextFrame);
|
||||
m_nextFrame = nullptr;
|
||||
m_texture = m_currentFrame->GetImageTexture();
|
||||
m_intrinsicsBuffer.data = &m_currentFrame->GetFrameMetadata().intrinsic;
|
||||
m_intrinsicsBuffer.updated = true;
|
||||
}
|
||||
if (m_currentFrame) m_texture = m_currentFrame->GetImageTexture();
|
||||
if (!m_texture) m_texture = &Texture::PLACEHOLDER;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user