Verified Commit 26df15dc authored by Josch Morgenstern's avatar Josch Morgenstern
Browse files

[#42] changes to invocation of cameraManager

parent 63a9167f
......@@ -18,16 +18,8 @@ int main(int argc, const char** argv) {
true
);
vkcv::CameraManager cameraManager(window, windowWidth, windowHeight);
uint32_t camIndex = cameraManager.addCamera();
uint32_t controllerIndex = cameraManager.addController(vkcv::ControllerType::PILOT, camIndex);
cameraManager.getCamera(camIndex).setPosition(glm::vec3(0.f, 0.f, 3.f));
cameraManager.getCamera(camIndex).setNearFar(0.1, 30);
uint32_t camIndex2 = cameraManager.addCamera();
uint32_t controllerIndex2 = cameraManager.addController(vkcv::ControllerType::TRACKBALL, camIndex2);
cameraManager.getCamera(camIndex2).setPosition(glm::vec3(0.f, 0.f, 3.f));
cameraManager.getCamera(camIndex2).setNearFar(0.1, 30);
vkcv::CameraManager cameraManager(window, windowWidth, windowHeight);
uint32_t camIndex = cameraManager.addCamera(vkcv::ControllerType::PILOT);
window.initEvents();
......@@ -236,7 +228,8 @@ int main(int argc, const char** argv) {
auto end = std::chrono::system_clock::now();
auto deltatime = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
start = end;
cameraManager.update(deltatime.count() * 0.000001);
cameraManager.update(std::chrono::duration<double>(deltatime).count());
const float sunTheta = std::chrono::duration_cast<std::chrono::milliseconds>(end - appStartTime).count() * 0.001f;
lightInfo.direction = glm::normalize(glm::vec3(std::cos(sunTheta), 1, std::sin(sunTheta)));
......@@ -260,7 +253,7 @@ int main(int argc, const char** argv) {
lightInfo.lightMatrix = projectionLight * viewLight;
lightBuffer.fill({ lightInfo });
const glm::mat4 viewProjectionCamera = cameraManager.getActiveController().getCamera().getMVP();
const glm::mat4 viewProjectionCamera = cameraManager.getActiveCamera().getMVP();
mainPassMatrices.clear();
mvpLight.clear();
......
......@@ -142,11 +142,8 @@ int main(int argc, const char** argv) {
vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage });
vkcv::CameraManager cameraManager(window, windowWidth, windowHeight);
uint32_t camIndex = cameraManager.addCamera();
uint32_t controllerIndex = cameraManager.addController(vkcv::ControllerType::PILOT, camIndex);
uint32_t camIndex2 = cameraManager.addCamera();
uint32_t controllerIndex2 = cameraManager.addController(vkcv::ControllerType::TRACKBALL, camIndex2);
uint32_t camIndex0 = cameraManager.addCamera(vkcv::ControllerType::PILOT);
uint32_t camIndex1 = cameraManager.addCamera(vkcv::ControllerType::TRACKBALL);
auto start = std::chrono::system_clock::now();
......@@ -172,7 +169,7 @@ int main(int argc, const char** argv) {
auto deltatime = end - start;
start = end;
cameraManager.update(std::chrono::duration<double>(deltatime).count());
glm::mat4 mvp = cameraManager.getActiveController().getCamera().getMVP();
glm::mat4 mvp = cameraManager.getActiveCamera().getMVP();
vkcv::PushConstantData pushConstantData((void*)&mvp, sizeof(glm::mat4));
......
......@@ -163,15 +163,7 @@ int main(int argc, const char** argv) {
const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle();
vkcv::CameraManager cameraManager(window, windowWidth, windowHeight);
uint32_t camIndex = cameraManager.addCamera();
cameraManager.getCamera(camIndex).setPosition(glm::vec3(0.0f, 0.0f, 0.0f));
cameraManager.getCamera(camIndex).setCenter(glm::vec3(0.0f, 0.0f, -1.0f));
uint32_t controllerIndex = cameraManager.addController(vkcv::ControllerType::PILOT, camIndex);
uint32_t camIndex2 = cameraManager.addCamera();
cameraManager.getCamera(camIndex2).setPosition(glm::vec3(0.0f, 0.0f, 0.0f));
cameraManager.getCamera(camIndex2).setCenter(glm::vec3(0.0f, 0.0f, -1.0f));
uint32_t controllerIndex2 = cameraManager.addController(vkcv::ControllerType::TRACKBALL, camIndex2);
uint32_t camIndex = cameraManager.addCamera(vkcv::ControllerType::PILOT);
while (window.isWindowOpen())
{
......@@ -185,8 +177,8 @@ int main(int argc, const char** argv) {
auto end = std::chrono::system_clock::now();
auto deltatime = end - start;
start = end;
cameraManager.update(std::chrono::duration<double>(deltatime).count());
glm::mat4 mvp = cameraManager.getActiveController().getCamera().getMVP();
cameraManager.update(std::chrono::duration<double>(deltatime).count());
glm::mat4 mvp = cameraManager.getActiveCamera().getMVP();
vkcv::PushConstantData pushConstantData((void*)&mvp, sizeof(glm::mat4));
auto cmdStream = core.createCommandStream(vkcv::QueueType::Graphics);
......
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