Commit 7f1e422a authored by Philip Trettner's avatar Philip Trettner

separated default cam and rendering

parent 06c36b5a
......@@ -83,6 +83,17 @@ bool GlfwApp::shouldClose() const
void GlfwApp::init()
{
if (!mUseDefaultCamera && mUseDefaultRendering)
glow::error() << "Cannot use default rendering without default camera in GlfwApp.";
if (mUseDefaultCamera || mUseDefaultRendering)
{
// create camera with some sensible defaults
mCamera = std::make_shared<camera::GenericCamera>();
mCamera->setPosition({ 2, 2, 2 });
mCamera->setTarget({ 0, 0, 0 });
}
if (mUseDefaultRendering)
{
// include paths (BEFORE pipeline init)
......@@ -90,11 +101,6 @@ void GlfwApp::init()
DefaultShaderParser::addIncludePath(util::pathOf(__FILE__) + "/../../../material/shader");
DefaultShaderParser::addIncludePath(util::pathOf(__FILE__) + "/../../../debugging/shader");
// create camera with some sensible defaults
mCamera = std::make_shared<camera::GenericCamera>();
mCamera->setPosition({2, 2, 2});
mCamera->setTarget({0, 0, 0});
// set up rendering pipeline
mPipeline = pipeline::RenderingPipeline::create(mCamera);
......@@ -137,10 +143,8 @@ void GlfwApp::render(float elapsedSeconds)
void GlfwApp::renderPass(const pipeline::RenderPass &pass, float elapsedSeconds)
{
if (mUseDefaultRendering)
{
debug()->renderPass(pass);
}
if (mUseDefaultRendering)
debug()->renderPass(pass);
}
void GlfwApp::onResize(int w, int h)
......
......@@ -102,7 +102,8 @@ private:
double mOutputStatsInterval = 5.0; ///< number of seconds between stats output (0.0 for never)
bool mQueryStats = true; ///< if true, queries stats (vertices, fragments, ...)
bool mUseDefaultRendering = true; ///< if true, uses default rendering pipeline setup
bool mUseDefaultCamera = true; ///< if true, uses default camera
bool mUseDefaultRendering = true; ///< if true, uses default rendering pipeline setup (requires default cam)
bool mUseDefaultCameraHandling = true; ///< if true, implements default cam handling
double mCurrentTime = 0.0; ///< current frame time (starts with 0)
......@@ -157,7 +158,8 @@ public:
GLOW_GETTER(Camera);
GLOW_GETTER(Pipeline);
GLOW_PROPERTY(UseDefaultCameraHandling);
GLOW_PROPERTY(UseDefaultCamera);
GLOW_PROPERTY(UseDefaultCameraHandling);
GLOW_PROPERTY(CameraMoveSpeed);
GLOW_PROPERTY(CameraTurnSpeed);
GLOW_PROPERTY(CameraScrollSpeed);
......
Markdown is supported
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