~ use clearcolor from scene instead of using black

~ camera should use it's own getters, not access the m_camera object directly

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2019-09-09 09:46:29 +02:00
parent d13ad3fdca
commit e285b313e0
2 changed files with 5 additions and 5 deletions

View File

@ -319,14 +319,14 @@ int main (int argc, char* argv[])
// change viewport to render to the correct portion of the display // change viewport to render to the correct portion of the display
IrrlichtContext->getDevice ()->getVideoDriver ()->setViewPort (*cur); IrrlichtContext->getDevice ()->getVideoDriver ()->setViewPort (*cur);
IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene (false, true, irr::video::SColor(0, 0, 0, 0)); IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene (false, true, sceneRender->getScene ()->getClearColor ().toSColor());
IrrlichtContext->getDevice ()->getSceneManager ()->drawAll (); IrrlichtContext->getDevice ()->getSceneManager ()->drawAll ();
IrrlichtContext->getDevice ()->getVideoDriver ()->endScene (); IrrlichtContext->getDevice ()->getVideoDriver ()->endScene ();
} }
} }
else else
{ {
IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene (true, true, irr::video::SColor(0, 0, 0, 0)); IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene (true, true, sceneRender->getScene ()->getClearColor ().toSColor());
IrrlichtContext->getDevice ()->getSceneManager ()->drawAll (); IrrlichtContext->getDevice ()->getSceneManager ()->drawAll ();
IrrlichtContext->getDevice ()->getVideoDriver ()->endScene (); IrrlichtContext->getDevice ()->getVideoDriver ()->endScene ();
} }

View File

@ -8,7 +8,7 @@ CCamera::CCamera (CScene* scene, Core::Scenes::CCamera* camera) :
m_scene (scene) m_scene (scene)
{ {
this->m_sceneCamera = scene->getContext ()->getDevice ()->getSceneManager ()->addCameraSceneNode ( this->m_sceneCamera = scene->getContext ()->getDevice ()->getSceneManager ()->addCameraSceneNode (
scene, *this->m_camera->getCenter (), *this->m_camera->getEye (), scene->nextId () scene, *this->getCenter (), *this->getEye (), scene->nextId ()
); );
} }
@ -37,8 +37,8 @@ void CCamera::setOrthogonalProjection (irr::f32 width, irr::f32 height)
irr::core::matrix4 identity; identity.makeIdentity (); irr::core::matrix4 identity; identity.makeIdentity ();
irr::core::matrix4 orthogonalProjection; orthogonalProjection.buildProjectionMatrixOrthoLH ( irr::core::matrix4 orthogonalProjection; orthogonalProjection.buildProjectionMatrixOrthoLH (
width, height, width, height,
0.0f, this->getEye ()->Z,
this->m_camera->getUp ()->Y this->getCenter ()->Z
); );
this->m_sceneCamera->setProjectionMatrix (orthogonalProjection); this->m_sceneCamera->setProjectionMatrix (orthogonalProjection);